Skip to content
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
67 changes: 23 additions & 44 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Unit Tests

on:
pull_request:
branches: [ main ]
branches: [main]
push:
branches: [ main ]
branches: [main]
workflow_dispatch:

jobs:
Expand All @@ -15,46 +15,25 @@ jobs:
fail-fast: false
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
poetry-version: ["1.8.3"]
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # need all versions to be able to access server tree commit logs
persist-credentials: false
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # latest
with:
packages: python3-dev libldap2-dev libsasl2-dev
version: 1.0
- name: Load cached Poetry Binary
id: cached-poetry-binary
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}
- name: Install Poetry
if: steps.cached-poetry-binary.outputs.cache-hit != 'true'
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
shell: bash
run: poetry install --no-interaction --no-root ${{ inputs.install-args }}
- name: Test with pytest
run: |
poetry run pytest -rA
- uses: actions/checkout@v6
with:
fetch-depth: 0 # need all versions to be able to access server tree commit logs
persist-credentials: false
- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shenxiangzhuang

Would you mind reviewing this change where I use the uv official actions to set up Python and uv itself.
Ref: https://docs.astral.sh/uv/guides/integration/github/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to keep the original caching behavior, we could try https://github.com/astral-sh/setup-uv/blob/main/docs/caching.md. But if the CI isn't run as often, I think we're good to keep it as is.

with:
python-version: ${{ matrix.python-version }}
enable-cache: true # enable built-in caching of uv
- uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40 # latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not poetry related so I kept it.

with:
packages: python3-dev libldap2-dev libsasl2-dev
version: 1.0
- name: Install dependencies
run: uv sync --locked --all-extras --group test
- name: Test with pytest
run: uv run pytest -rA
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: example-dev example-run

example-dev:
@poetry run python3 examples/snippets/simple_app.py
@uv run examples/snippets/simple_app.py

example-run:
@poetry run hypercorn examples.snippets.simple_app:app
@uv run hypercorn examples.snippets.simple_app:app
44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,63 @@ else:

## Installation

Create and activate a virtual environment and then install `asfquart` using [pip](https://pip.pypa.io):
Create and activate a virtual environment and then install `asfquart` using [uv](https://docs.astral.sh/uv/) or [pip](https://pip.pypa.io):

```shell
pip install "asfquart"
# With uv
uv add asfquart

# With uv pip-compatible interface
uv pip install asfquart

# With standard pip
pip install asfquart
```

Note: Adding the `[aioldap]` extra will install optional dependencies for LDAP support that will
require additional [system dependencies](https://github.com/noirello/bonsai?tab=readme-ov-file#requirements-for-building):

```shell
# With uv
uv add asfquart --extra aioldap

# With uv pip-compatible interface
uv pip install "asfquart[aioldap]"

# With standard pip
pip install "asfquart[aioldap]"
```

## Building asfquart package
## Development

Prerequisites:
### Install development environment

- `poetry`: install e.g. with pipx `pipx install poetry`
Install the required dependencies for development:

Building the package:
```shell
uv sync
```

Install the optional dependencies for development:

```shell
poetry build
uv sync --extra aioldap
```

### Building asfquart package

Running the tests:

```shell
poetry run pytest
uv sync --all-extras --group test

uv run pytest
```

Building the package:

```shell
uv build
```

## Examples
Expand Down
54 changes: 28 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tool.poetry]
[project]
name = "asfquart"
version = "0.1.13"
authors = ["ASF Infrastructure <users@infra.apache.org>"]
requires-python = ">=3.10,<4"
authors = [{ name = "ASF Infrastructure", email = "users@infra.apache.org" }]
license = "Apache-2.0"
readme = "README.md"
classifiers = [
Expand All @@ -18,42 +19,43 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
description = "ASF Quart Framework"
repository = "https://github.com/apache/infrastructure-asfquart"

[tool.poetry.dependencies]
python = ">=3.10,<4"
aiohttp = "^3.9.2"
PyYAML = "^6.0.1"
quart = ">=0.20.0,<1"
ezt = "^1.1"
asfpy = ">=0.56,<1"
bonsai = { version = "*", optional = true }
easydict = "^1.13"
exceptiongroup = { version = ">=1.1.0", python = "<3.11" }
watchfiles = "^1.0.0,<2"
dependencies = [
"aiohttp>=3.9.2,<4",
"PyYAML>=6.0.1,<7",
"quart>=0.20.0,<1",
"ezt>=1.1,<2",
"asfpy>=0.56,<1",
"easydict>=1.13,<2",
"exceptiongroup>=1.1.0; python_version<'3.11'",
"watchfiles>=1.0.0,<2",
]

[tool.poetry.extras]
[project.optional-dependencies]
aioldap = ["bonsai"]

[tool.poetry.group.test.dependencies]
pytest = "7.2.0"
pytest-cov = "^4.0.0"
pytest-asyncio = "^0.20.3"
pytest-mock = "^3.10.0"
[dependency-groups]
test = [
"pytest==7.2.0",
"pytest-cov>=4.0.0,<5",
"pytest-asyncio>=0.20.3,<1",
"pytest-mock>=3.10.0,<4",
]

[project.urls]
Repository = "https://github.com/apache/infrastructure-asfquart"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["uv_build>=0.9.11,<0.10.0"]
build-backend = "uv_build"

[tool.pytest.ini_options]
minversion = "7.2"
testpaths = ["tests"]
testpaths = ["tests"]
pythonpath = ["src"]
python_files = "*.py"
markers = [
"config: Configuration parsing tests",
"session: Client session management tests",
"auth: Authentication/Authorization tests"
"auth: Authentication/Authorization tests",
]

asyncio_mode = "auto"
Loading