Skip to content

Commit

Permalink
leverage uv
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob-keller committed Jan 7, 2025
1 parent 7432338 commit 762f9ba
Show file tree
Hide file tree
Showing 6 changed files with 3,280 additions and 66 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install build dependencies
run: python -m pip install build twine
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build distribution 📦
run: python -m build
run: uv build
- name: Check distribution 📦
run: python -m twine check --strict dist/*
run: uvx twine check --strict dist/*
- name: Upload distribution 📦
uses: actions/upload-artifact@v4
with:
Expand All @@ -56,32 +52,27 @@ jobs:
- 3.12
- 3.13
fail-fast: false
env:
UV_FROZEN: 1
timeout-minutes: 5

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Lock and sync dependencies
run: |
python -m pip install -U pip pip-tools
pip-compile --all-extras pyproject.toml requirements-dev.in
pip-sync
pip install -e .
- name: Run pre-commit hooks
run: |
make pre-commit
uv run make pre-commit
- name: Run unittests
env:
COLOR: 'yes'
run: |
make mototest
uv run make mototest
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
ci:
autoupdate_schedule: quarterly
skip: [uv-lock] # https://github.com/astral-sh/uv/issues/10167

repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
Expand All @@ -19,6 +20,10 @@ repos:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.15
hooks:
- id: uv-lock
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
Expand Down
25 changes: 9 additions & 16 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,24 @@ First of all, clone the repository::

$ git clone [email protected]:aio-libs/aiobotocore.git

Create virtualenv with at least python3.8 (older versions are not supported).
For example, using ``virtualenvwrapper`` commands could look like::

$ cd aiobotocore
$ mkvirtualenv --python=`which python3.8` aiobotocore
Make sure the Python package and project manager `uv <https://docs.astral.sh/uv/>`_ is installed.

Create a virtual environment::

After that, please install libraries required for development::

$ pip install pip-tools
$ pip-compile --all-extras pyproject.toml requirements-dev.in
$ pip-sync
$ pip install -e .
$ cd aiobotocore
$ uv venv

Install pre-commit hooks::

$ pre-commit install
$ uv run pre-commit install

Congratulations, you are ready to run the test suite.

There are two set of tests, those that can be mocked through `moto <https://github.com/getmoto/moto>`_ running in docker, and those that require running against a personal amazon key. The CI only runs the moto tests.

To run the moto tests::

$ make mototest
$ uv run make mototest

To run the non-moto tests, make sure you have your amazon key and secret accessible via environment variables::

Expand All @@ -47,15 +40,15 @@ To run the non-moto tests, make sure you have your amazon key and secret accessi

Execute full tests suite::

$ make test
$ uv run make test

Execute full tests suite with coverage::

$ make cov
$ uv run make cov

To run individual use following command::

$ pytest -sv tests/test_monitor.py -k test_name
$ uv run pytest -sv tests/test_monitor.py -k test_name


Reporting an Issue
Expand Down
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,45 @@ boto3 = [
Repository = "https://github.com/aio-libs/aiobotocore"
Documentation = "https://aiobotocore.aio-libs.org"

[dependency-groups]
botocore-dev = [
# keep in sync with https://github.com/boto/botocore/blob/develop/requirements-dev.txt
# "wheel==0.43.0",
# "behave==1.2.5",
# "jsonschema==4.21.1",
"coverage==7.2.7",
# "setuptools==71.1.0;python_version>='3.12'",
# "packaging==24.1;python_version>='3.12'", # Requirement for setuptools>=71

# Pytest specific deps
"pytest==8.1.1",
"pytest-cov==5.0.0",
"pytest-xdist==3.5.0",
# "atomicwrites>=1.0", # Windows requirement
# "colorama>0.3.0", # Windows requirement
]
dev = [
"dill ~=0.3.3", # Used in test_patches.py
"docker ~=7.1",
"docutils ~=0.16", # Used in test_version.py
"moto[server,s3,sqs,awslambda,dynamodb,cloudformation,sns,batch,ec2,rds] ~=4.2.9",
"packaging ~=24.1", # Used in test_version.py
"pip ~=24.3.1", # Used in test_version.py
"pre-commit ~=3.5.0",
"pytest-asyncio ~=0.23.8",
"requests ~=2.32.3", # Used in test_version.py
"time-machine ~=2.15.0",
"tomli; python_version<'3.11'", # Used in test_version.py
"werkzeug ~=3.0.6", # Used in moto_server.py
]

[tool.uv]
default-groups = [
"botocore-dev",
"dev",
]
required-version = ">=0.5.14"

[tool.setuptools.dynamic]
version = { attr = "aiobotocore.__version__" }
readme = { file = ["README.rst", "CHANGES.rst"] }
Expand Down
31 changes: 0 additions & 31 deletions requirements-dev.in

This file was deleted.

Loading

0 comments on commit 762f9ba

Please sign in to comment.