-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to use uv instead of poetry (#2288)
* Migrate to use uv instead of poetry Signed-off-by: Bernát Gábor <[email protected]> * Support dependency groups in TOML on<3.11 Signed-off-by: Bernát Gábor <[email protected]> * Check codespeed workaround Signed-off-by: Bernát Gábor <[email protected]> --------- Signed-off-by: Bernát Gábor <[email protected]>
- Loading branch information
1 parent
dd92cd0
commit 107168c
Showing
19 changed files
with
3,002 additions
and
2,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
branches: [ "main" ] | ||
schedule: | ||
- cron: "26 1 * * 4" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
analyze: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,35 +5,47 @@ on: | |
tags: | ||
- '**' | ||
|
||
env: | ||
dists-artifact-name: python-package-distributions | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
if: "success() && startsWith(github.ref, 'refs/tags/')" | ||
runs-on: ubuntu-24.04 | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/pypoetry | ||
~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
fetch-depth: 0 | ||
- name: Install the latest version of uv | ||
uses: astral-sh/setup-uv@v5 | ||
- name: Build package | ||
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
python-version: 3.8 | ||
- name: Build publish | ||
run: | | ||
python -m pip install poetry poetry-dynamic-versioning | ||
poetry install | ||
poetry build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
name: ${{ env.dists-artifact-name }} | ||
path: dist/* | ||
|
||
release: | ||
name: Publish package to PyPI | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: release | ||
url: https://pypi.org/project/datamodel-code-generator/${{ github.ref_name }} | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ env.dists-artifact-name }} | ||
path: dist/ | ||
- name: Publish to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_password }} | ||
attestations: true | ||
|
||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
if: "success() && startsWith(github.ref, 'refs/tags/')" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,23 +18,29 @@ We are waiting for your contributions to `datamodel-code-generator`. | |
$ git clone [email protected]:<your username>/datamodel-code-generator.git | ||
$ cd datamodel-code-generator | ||
|
||
## 2. Install [poetry](https://github.com/python-poetry/poetry) | ||
$ curl -sSL https://install.python-poetry.org | python3 - | ||
## 2. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) | ||
$ curl -LsSf https://astral.sh/uv/install.sh | sh | ||
|
||
## 3. Create virtual environment | ||
$ uv venv -p 3.13 --python-preference managed | ||
|
||
## 3. Install dependencies | ||
$ poetry install --all-extras | ||
$ uv sync | ||
|
||
## 4. Create new branch and rewrite code. | ||
$ git checkout -b new-branch | ||
|
||
## 5. Run unittest (you should pass all test and coverage should be 100%) | ||
$ poetry run ./scripts/test.sh | ||
## 5. Activate the virtual environment | ||
$ source .venv/bin/python | ||
|
||
## 6. Run unittest (you should pass all test and coverage should be 100%) | ||
$ ./scripts/test.sh | ||
|
||
## 6. Format code | ||
$ poetry run ./scripts/format.sh | ||
## 7. Format code | ||
$ ./scripts/format.sh | ||
|
||
## 7. Check lint (mypy) | ||
$ poetry run ./scripts/lint.sh | ||
## 8. Check lint (mypy) | ||
$ ./scripts/lint.sh | ||
|
||
## 8. Commit and Push... | ||
## 9. Commit and Push... | ||
``` |
Oops, something went wrong.