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
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For the complete development guide, please see **[docs/development.md](../docs/d
## Quick Start

1. Clone the repository
2. Run `make .venv && source .venv/bin/activate && make pip`
2. Run `uv sync --extra dev`
3. Run `make all` to verify everything works

## Before Submitting a Pull Request
Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: ISC
version: 2
updates:
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
Expand All @@ -17,4 +17,4 @@ updates:
interval: "weekly"
commit-message:
prefix: "ci"
include: "scope"
include: "scope"
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: ISC


name: CI

on:
Expand All @@ -15,7 +14,7 @@ permissions:
contents: read

jobs:
test:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -26,6 +25,7 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- run: make pip
- uses: astral-sh/setup-uv@v7
- run: make sync-frozen
- run: make lint
- run: make coverage
- run: make coverage
21 changes: 7 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
contents: write

jobs:
deploy:
docs-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
Expand All @@ -28,24 +28,17 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: |
pip install -e .[dev]
- run: make sync-frozen

- name: Configure Git
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com

- name: Deploy dev-main docs
if: github.ref == 'refs/heads/main'
run: |
mike deploy --push --branch website dev-main
- if: github.ref == 'refs/heads/main'
run: make docs-deploy-dev-main

- name: Deploy versioned docs
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
mike deploy --push --update-aliases --branch website $VERSION latest
mike set-default --push --branch website latest
- if: startsWith(github.ref, 'refs/tags/v')
run: make docs-deploy-versioned VERSION=${GITHUB_REF#refs/tags/v}
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@v7
- run: sudo apt-get install -y patchelf
- run: make pip
- run: make sync-frozen
- run: make publish
env:
TWINE_USERNAME: __token__
Expand Down
56 changes: 32 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,38 @@
#
# SPDX-License-Identifier: ISC

.PHONY: all format lint test coverage clean publish pip reuse .venv docs-serve docs-build

.PHONY: all sync sync-frozen format lint test coverage clean build dist repair-wheels publish reuse docs-serve docs-build docs-deploy-dev-main docs-deploy-versioned

all: format lint coverage build

pip:
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
sync:
uv sync --extra dev

sync-frozen:
uv sync --frozen --extra dev

reuse:
reuse annotate \
uv run reuse annotate \
--copyright "Alexandre Gomes Gaigalas <alganet@gmail.com>" \
--license ISC \
--recursive .

.venv:
python -m venv .venv
. .venv/bin/activate && make pip

format: reuse
python -m black apywire tests
python -m isort apywire tests
uv run black apywire tests
uv run isort apywire tests

lint:
python -m reuse lint
python -m flake8 apywire tests
python -m mypy apywire tests
uv run reuse lint
uv run flake8 apywire tests
uv run mypy apywire tests

test:
python -m pytest -q
uv run pytest -q

coverage:
rm -f apywire/*.so apywire/wiring.c
python -m pytest --cov
uv run pytest --cov

clean:
find . -name __pycache__ -type d -exec rm -rf {} +
Expand All @@ -43,24 +42,33 @@ clean:
rm -rf .mypy_cache .pytest_cache *.egg-info dist build

build:
python setup.py build_ext --inplace
uv run python setup.py build_ext --inplace

dist:
python -m build
uv run python -m build

repair-wheels:
python -m pip install --upgrade auditwheel
auditwheel repair dist/*.whl -w dist/repaired
uv run auditwheel repair dist/*.whl -w dist/repaired
rm -f dist/*.whl
mv dist/repaired/*.whl dist/
rm -rf dist/repaired

publish: dist repair-wheels
python -m pip install --upgrade twine
python -m twine upload dist/*
uv run twine upload dist/*

docs-serve:
python -m mkdocs serve
uv run mkdocs serve

docs-build:
python -m mkdocs build
uv run mkdocs build

docs-deploy-dev-main:
uv run mike deploy --push --branch website dev-main

docs-deploy-versioned:
@if [ -z "$(VERSION)" ]; then \
echo "VERSION is required (e.g. make $@ VERSION=0.2.0)"; \
exit 2; \
fi
uv run mike deploy --push --update-aliases --branch website $(VERSION) latest
uv run mike set-default --push --branch website latest
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Lazy object wiring and dependency injection for Python 3.12+
## Installation

```bash
pip install apywire
uv pip install apywire
```

## Quick Example
Expand Down Expand Up @@ -58,8 +58,8 @@ make docs-serve # http://127.0.0.1:8000
## Development

```bash
make .venv && source .venv/bin/activate # Setup
make all # Format, lint, test, build
uv sync --extra dev # Setup
make all # Format, lint, test, build
```

See [docs/development.md](docs/development.md) for guidelines.
Expand Down
6 changes: 6 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ precedence = "aggregate"
SPDX-FileCopyrightText = "2025 Alexandre Gomes Gaigalas <alganet@gmail.com>"
SPDX-License-Identifier = "ISC"

[[annotations]]
path = "uv.lock"
precedence = "aggregate"
SPDX-FileCopyrightText = "2025 Alexandre Gomes Gaigalas <alganet@gmail.com>"
SPDX-License-Identifier = "ISC"

8 changes: 3 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ Clone the repository and set up your development environment:
git clone https://github.com/alganet/apywire.git
cd apywire

# Create virtual environment and install dependencies
make .venv
source .venv/bin/activate
make pip
# Install dev dependencies
uv sync --extra dev
```

This will:
1. Create a `.venv` virtual environment
1. Create (or update) a `.venv` project environment
2. Install all development dependencies including mkdocs, pytest, mypy, etc.

## Development Workflow
Expand Down
8 changes: 3 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ This guide will help you get up and running with apywire quickly.

## Installation

Install apywire using pip:
Install apywire using uv:

```bash
pip install apywire
uv pip install apywire
```

apywire requires Python 3.12 or later and has no external runtime dependencies.
Expand All @@ -25,9 +25,7 @@ If you want to contribute to apywire or run the tests:
```bash
git clone https://github.com/alganet/apywire.git
cd apywire
make .venv
source .venv/bin/activate
make pip
uv sync --extra dev
```

## Quick Start
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apywire provides a CLI for generating specs from class introspection and compili
The CLI is included with apywire:

```bash
pip install apywire
uv pip install apywire
```

Verify the installation:
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ setup(
### Step 3: Build

```bash
python setup.py build_ext --inplace
uv run python setup.py build_ext --inplace
```

This generates `wiring.c` and `wiring.so` (compiled extension).
Expand Down Expand Up @@ -326,7 +326,7 @@ assert wired_runtime.now() == wired_compiled.now()
```bash
# In your CI/CD pipeline
python scripts/generate_wiring.py
python setup.py build_ext --inplace # Optional: Cython compile
uv run python setup.py build_ext --inplace # Optional: Cython compile
```

### 2. Version Control Generated Code
Expand Down
4 changes: 2 additions & 2 deletions examples/kv_store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ We instantiate `fakeredis.FakeRedis` directly from the configuration file, passi
This example requires `fakeredis` and `pyyaml`.

```bash
pip install -r requirements.txt
uv run --with fakeredis --with pyyaml --with apywire python main.py
```

## Running the Example

```bash
python main.py
uv run --with fakeredis --with pyyaml --with apywire python main.py
```

Expected output:
Expand Down
6 changes: 0 additions & 6 deletions examples/kv_store/requirements.txt

This file was deleted.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ dev = [
"pytest-cov",
"pytest",
"reuse",
"setuptools",
"twine",
"tomli_w",
"types-setuptools",
"wheel",
]

[tool.setuptools.packages.find]
Expand Down
Loading