-
Notifications
You must be signed in to change notification settings - Fork 18
chore: Migrate from Poetry to uv and Hatchling #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,10 @@ jobs: | |
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: ./.github/actions/setup-semantic-release # node+semantic-release | ||
| - uses: ./.github/actions/setup # poetry | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
|
Comment on lines
+73
to
+76
|
||
| - id: semantic-release # branch policies defined in .releaserc | ||
| env: | ||
| GIT_AUTHOR_NAME: appland-release | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,12 +50,15 @@ oldest version currently supported (see the | |
|
|
||
| ## Dependency management | ||
|
|
||
| [poetry](https://https://python-poetry.org/) for dependency management: | ||
| [uv](https://docs.astral.sh/uv/) is used for dependency management and provides fast package installation: | ||
|
|
||
| ``` | ||
| % brew install poetry | ||
| % cd appmap-python | ||
| % poetry install | ||
| ```bash | ||
| # Install uv (macOS/Linux) | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
|
|
||
| # Install dependencies | ||
| cd appmap-python | ||
| uv sync --all-extras | ||
| ``` | ||
|
|
||
| ### wrapt | ||
|
||
|
|
@@ -69,64 +72,63 @@ To update `wrapt`, use `tox` (described below) to run the `vendoring` environmen | |
| ## Linting | ||
| [pylint](https://www.pylint.org/) for linting: | ||
|
|
||
| ``` | ||
| % cd appmap-python | ||
| % poetry run pylint appmap | ||
| ```bash | ||
| cd appmap-python | ||
| uv run tox -e lint | ||
|
|
||
| # Or run pylint directly | ||
| uv run pylint appmap | ||
|
|
||
| -------------------------------------------------------------------- | ||
| Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) | ||
|
|
||
| ``` | ||
|
|
||
| [Note that the current configuration has a threshold set which must be met for the Travis build to | ||
| pass. To make this easier to achieve, a number of checks have both been disabled. They should be | ||
| reenabled as soon as possible.] | ||
|
|
||
|
|
||
| ## Testing | ||
| ### pytest | ||
|
|
||
| Note that you must install the dependencies contained in | ||
| [requirements-dev.txt](requirements-dev.txt) before running tests. See the explanation in | ||
| [pyproject.toml](pyproject.toml) for details. | ||
| [pytest](https://docs.pytest.org/en/stable/) for testing: | ||
|
|
||
| Additionally, the tests currently require that you set `APPMAP=true` and | ||
| `APPMAP_DISPLAY_PARAMS=true`. | ||
| ```bash | ||
| cd appmap-python | ||
|
|
||
| [pytest](https://docs.pytest.org/en/stable/) for testing: | ||
| # Run all tests | ||
| APPMAP_DISPLAY_PARAMS=true uv run appmap-python pytest | ||
|
|
||
| ``` | ||
| % cd appmap-python | ||
| % pip install -r requirements-test.txt | ||
| % APPMAP=true APPMAP_DISPLAY_PARAMS=true poetry run pytest | ||
| # Run tests with a specific Python version | ||
| APPMAP_DISPLAY_PARAMS=true uv run --python 3.9 appmap-python pytest | ||
|
|
||
| # Run tests in parallel | ||
| APPMAP_DISPLAY_PARAMS=true uv run appmap-python pytest -n auto | ||
| ``` | ||
|
|
||
| ### tox | ||
| Additionally, the `tox` configuration provides the ability to run the tests for all | ||
| supported versions of Python and Django. | ||
| The `tox` configuration provides the ability to run the tests for all supported versions of Python and web frameworks (Django, Flask, SQLAlchemy). | ||
|
|
||
| `tox` requires that all the correct versions of Python to be available to create | ||
| the test environments. [pyenv](https://github.com/pyenv/pyenv) is an easy way to manage | ||
| multiple versions of Python, and the [xxenv-latest | ||
| plugin](https://github.com/momo-lab/xxenv-latest) can help get all the latest versions. | ||
| With `uv`, you don't need to pre-install Python versions - `uv` will automatically download and manage them: | ||
|
|
||
| ```bash | ||
| cd appmap-python | ||
|
|
||
| # Run full test matrix (all Python versions and frameworks) | ||
| uv run tox | ||
|
|
||
| ```sh | ||
| % brew install pyenv | ||
| % git clone https://github.com/momo-lab/xxenv-latest.git "$(pyenv root)"/plugins/xxenv-latest | ||
| % cd appmap-python | ||
| % pyenv latest local 3.{9,6,7,8} | ||
| % for v in 3.{9,6,7,8}; do pyenv latest install $v; done | ||
| % poetry run tox | ||
| # Run tests for a specific Python version | ||
| uv run tox -e py312-web | ||
|
|
||
| # Run tests for specific framework | ||
| uv run tox -e py312-django5 | ||
|
|
||
| # Update vendored wrapt dependency | ||
| uv run tox -e vendoring sync | ||
| ``` | ||
|
|
||
| ## Code Coverage | ||
| [coverage](https://coverage.readthedocs.io/) for coverage: | ||
|
|
||
| ``` | ||
| % cd appmap-python | ||
| % poetry run coverage run -m pytest | ||
| % poetry run coverage html | ||
| % open htmlcov/index.html | ||
| ```bash | ||
| cd appmap-python | ||
| uv run coverage run -m pytest | ||
| uv run coverage html | ||
| open htmlcov/index.html | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step name is slightly misleading: this installs
toxwith bothtox-uvandtox-gh-actions. Consider updating the step name to reflect the full set of tools being installed to reduce confusion when debugging CI.