Skip to content

Commit

Permalink
migrate to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Oct 11, 2024
1 parent 311df6b commit 9276888
Show file tree
Hide file tree
Showing 7 changed files with 317 additions and 475 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/calver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
with:
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Check for new commits
id: check
run: |
Expand All @@ -29,7 +26,6 @@ jobs:
- name: Prepare
id: prepare
run: |
pip install poetry
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
echo MINOR=$(date +%Y.%m) >> $GITHUB_ENV
Expand All @@ -38,7 +34,7 @@ jobs:
git checkout -b release
NEW_PATCH=$(git tag | grep $MINOR | wc -l)
VERSION=${MINOR}.${NEW_PATCH}
poetry version $VERSION
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
git commit -am $VERSION
git tag $VERSION
git push --tags origin $VERSION
Expand All @@ -47,6 +43,6 @@ jobs:
git checkout main
NEW_PATCH=$(git tag | grep $MINOR | wc -l)
VERSION=${MINOR}.${NEW_PATCH}-dev
poetry version $VERSION
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
git commit -am $VERSION
git push origin main
29 changes: 9 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,11 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') != true
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
- uses: astral-sh/setup-uv@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml', '**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: poetry install
run: |
pip install poetry
poetry install
- run: poetry run pyright
- run: poetry run ruff check edgedb_pydantic_codegen/
enable-cache: true
- run: uv run --frozen pyright
- run: uv run --frozen ruff check
if: always()

release:
Expand All @@ -38,14 +28,13 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v3
with:
python-version: "3.11"
- run: |
pip install poetry
poetry publish --build
enable-cache: true
- run: uv build
- run: uv publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
UV_PUBLISH_USERNAME: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
- run: |
gh release create ${{ github.ref_name }} dist/* \
--generate-notes \
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The generated models can be directly used with other libraries such as [FastAPI]

This is an alternative to the [built-in code generator](https://github.com/edgedb/edgedb-python/tree/master/edgedb/codegen) of the official [edgedb-python](https://github.com/edgedb/edgedb-python/tree/master) library.

## Install
## Usage

<p>
<a href="https://pypi.org/project/edgedb-pydantic-codegen" alt="Python version compatibility">
Expand All @@ -17,16 +17,10 @@ This is an alternative to the [built-in code generator](https://github.com/edged
<img src="https://img.shields.io/badge/calver-YYYY.0M.MICRO-22bfda" /></a>
</p>

```sh
pip3 install edgedb-pydantic-codegen
```

## Usage

In an EdgeDB initialized project, simply run

```sh
edgedb-pydantic-codegen <directory>
uvx edgedb-pydantic-codegen <directory>
```

All `*.edgeql` files in `<directory>` and its subdirectories will be processed and the generated code saved next to them.
Expand Down
Loading

0 comments on commit 9276888

Please sign in to comment.