Skip to content
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

feat: migrate project to uv #577

Merged
merged 1 commit into from
Jan 19, 2025
Merged
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
25 changes: 0 additions & 25 deletions .github/dependabot.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"schedule": [
"on sunday"
],
"packageRules": [
{
"groupName": "non-development dependencies",
"matchDepTypes": [
"dependencies"
]
},
{
"groupName": "development dependencies",
"matchDepTypes": [
"devDependencies"
]
}
],
"lockFileMaintenance": {
"enabled": true
}
}
19 changes: 9 additions & 10 deletions .github/workflows/python_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade poetry
poetry install
- uses: astral-sh/setup-uv@v5
- name: Install the project
env:
UV_PYTHON: ${{ matrix.python-version }}
run: uv sync --all-extras --dev
- name: Lint and test
run: |
make -k lint test
env:
UV_PYTHON: ${{ matrix.python-version }}
run: make -k lint test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ __pycache__
.mypy_cache
.coverage
*.whl
*.tar.gz
*.tar.gz
.venv
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
## Build targets
.PHONY: lint test format lint-pylint lint-black lint-mypy lint-bandit
test:
poetry run pytest -vv --log-level=DEBUG --cov aws_sqs_batchlib --cov-report term-missing
uv run pytest -vv --log-level=DEBUG --cov aws_sqs_batchlib --cov-report term-missing

lint: lint-ruff-check lint-ruff-format lint-mypy lint-bandit
lint-ruff-check:
poetry run ruff check
uv run ruff check
lint-ruff-format:
poetry run ruff format --check
uv run ruff format --check
lint-mypy:
poetry run mypy aws_sqs_batchlib benchmark
uv run mypy aws_sqs_batchlib benchmark
lint-bandit:
poetry run bandit -q -r aws_sqs_batchlib benchmark
uv run bandit -q -r aws_sqs_batchlib benchmark

format:
poetry run ruff format
poetry run ruff check --fix
uv run ruff format
uv run ruff check --fix
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,9 @@ assert res == {

## Development

Requires Python 3 and Poetry. Useful commands:
Requires Python 3 and uv. Useful commands:

```bash
# Setup environment
poetry install

# Run tests (integration test requires rights to create, delete and use DynamoDB tables)
make test

Expand All @@ -155,15 +152,15 @@ make format

## Benchmarks & Manual Testing

Use `benchmark/end2end.py` to benchmark and test the library functionality and performance. Execute following commands in Poetry virtualenv (execute `poetry shell` to get there):
Use `benchmark/end2end.py` to benchmark and test the library functionality and performance. Execute following commands in project virtualenv:

```bash
# Setup
export PYTHONPATH=$(pwd)
export AWS_DEFAULT_REGION=eu-north-1

# Send, receive and delete 512 messages, run test 5 times
python3 benchmark/end2end.py \
uv run benchmark/end2end.py \
--queue-url https://sqs.eu-north-1.amazonaws.com/123456789012/MyQueue --num-messages 512 --iterations 5
```

Expand Down
1,589 changes: 0 additions & 1,589 deletions poetry.lock

This file was deleted.

42 changes: 23 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
[tool.poetry]
[project]
name = "aws-sqs-batchlib"
version = "3.0.0"
description = "Library for working with Amazon SQS"
authors = ["Sami Jaktholm <sjakthol@outlook.com>"]
authors = [
{ name = "Sami Jaktholm", email = "sjakthol@outlook.com" }
]
license = "MIT"
readme = 'README.md'
requires-python = ">=3.8"
dependencies = [
"boto3"
]

[tool.poetry.dependencies]
python = ">=3.8,<4.0.0"
boto3 = "^1.28"

[tool.poetry.group.dev.dependencies]
bandit = "^1.7.9"
boto3-stubs = {extras = ["sqs"], version = "^1.35"}
moto = {extras = ["sqs"], version = "^5.0"}
mypy = "^1.11.2"
pyformance = "^0.4"
pytest = "^8.3.2"
pytest-cov = "^5.0"
ruff = ">=0.6.4,<0.10.0"
typing-extensions = "^4.12"
[tool.uv]
dev-dependencies = [
"bandit",
"boto3-stubs[sqs]",
"moto[sqs]",
"mypy",
"pyformance",
"pytest",
"pytest-cov",
"ruff",
"typing-extensions"
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.ruff]
lint.select = ["E", "F", "I"]
lint.extend-select = ["I"]
Loading
Loading