Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 9 additions & 32 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Setup base (python, pip cache, tox)
name: Setup base (python, uv, tox)
description: "Setup Python, uv and tox for further steps"
inputs:
python:
description: "Python version to use"
Expand All @@ -11,41 +12,17 @@ outputs:
runs:
using: "composite"
steps:
- name: pip cache
uses: actions/cache@v4
with:
path: |
~/.cache/pip
key: ${{ runner.os }}-pip-${{ inputs.python }}

- name: Cargo cache
uses: actions/cache/@v4
with:
path: "~/.cargo"
key: ${{ runner.os }}-cargo

- name: Poetry cache
uses: actions/cache/@v4
with:
path: "~/.cache/pypoetry"
key: ${{ runner.os }}-poetry-${{ inputs.python }}
restore-keys: |
${{ runner.os }}-poetry-

- uses: actions/setup-python@v6
id: python
with:
python-version: ${{ inputs.python }}

- name: upgrade pip and install tox
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install tox, tox-uv and tox-gh-actions
shell: bash
run: |
python -m pip -q install --upgrade pip "setuptools==65.6.2"
pip -q install "tox<4" tox-gh-actions

- name: install Rust and Poetry
shell: bash
run : |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
source "$HOME/.cargo/env"
pip -q install poetry>=1.2.0
uv tool install tox --with tox-uv --with tox-gh-actions
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
with:
token: ${{ steps.app-token.outputs.token }}
- uses: ./.github/actions/setup-semantic-release # node+semantic-release
- uses: ./.github/actions/setup # poetry
- uses: ./.github/actions/setup
- id: semantic-release # branch policies defined in .releaserc
env:
GIT_AUTHOR_NAME: appland-release
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.tool-versions

poetry.lock
uv.lock

__pycache__/
*.py[cod]
Expand All @@ -22,3 +23,4 @@ htmlcov/
/ruff.toml

appmap.log
*.sqlite3
2 changes: 1 addition & 1 deletion .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ plugins:
- pyproject.toml
- - '@semantic-release/exec'
- prepareCmd: |
/bin/bash ./ci/scripts/build_with_poetry.sh
/bin/bash ./ci/scripts/build_with_uv.sh
# NOTE: @semantic-release/github plugin removed - GitHub release creation
# now happens in the publish job after smoke tests pass
86 changes: 44 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ 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
The one dependency that is not managed using `poetry` is `wrapt`. Because it's possible that
The one dependency that is not managed using `uv` is `wrapt`. Because it's possible that
projects that use `appmap` may also need an unmodified version of `wrapt` (e.g. `pylint` depends on
`astroid`, which in turn depends on `wrapt`), we use
[vendoring](https://github.com/pradyunsg/vendoring) to vendor `wrapt`.
Expand All @@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ set -e
set -o pipefail

if [ -z "$DISTRIBUTION_NAME" ] || [ "$DISTRIBUTION_NAME" = "appmap" ] ; then
exec poetry build $*
exec uv build $*
fi

echo "Altering distribution name to $DISTRIBUTION_NAME"
echo "Altering distribution name to $DISTRIBUTION_NAME"

cp -v pyproject.toml /tmp/pyproject.bak
sed -i -e "s/^name = \".*\"/name = \"${DISTRIBUTION_NAME}\"/" pyproject.toml
grep -n 'name = "' pyproject.toml

poetry build $*
uv build $*

echo "Not patching artifacts with Provides-Dist, they won't work anyway (this flow is solely for publishing test)"
cp -v /tmp/pyproject.bak pyproject.toml
1 change: 0 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ recursive=no

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
Expand Down
Loading
Loading