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

Modernize metadata, support uv #319

Merged
merged 1 commit into from
Feb 3, 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
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI
on:
push:
branches:
- main
tags:
- v*
pull_request:

permissions:
contents: read

env:
UV_SYSTEM_PYTHON: 1

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
cache-suffix: ${{ matrix.python-version }}
- name: Install
run: make EXTRAS=dev install
- name: Test
run: make test
- name: Lint
run: make lint

build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install
run: make EXTRAS=dev install
- name: Build
run: python -m build
- name: Upload
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist

publish:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
7 changes: 4 additions & 3 deletions aiosqlite/tests/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,10 @@ async def test_backup_aiosqlite(self):
def progress(a, b, c):
print(a, b, c)

async with aiosqlite.connect(":memory:") as db1, aiosqlite.connect(
":memory:"
) as db2:
async with (
aiosqlite.connect(":memory:") as db1,
aiosqlite.connect(":memory:") as db2,
):
await db1.execute("create table foo (i integer, k charvar(250))")
await db1.executemany(
"insert into foo values (?, ?)", [(1, "hello"), (2, "world")]
Expand Down
46 changes: 27 additions & 19 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
.venv:
python -m venv .venv
source .venv/bin/activate && make install
echo 'run `source .venv/bin/activate` to develop aiosqlite'

venv: .venv
PKG:=aiosqlite
EXTRAS:=dev,docs

UV:=$(shell uv --version)
ifdef UV
VENV:=uv venv
PIP:=uv pip
else
VENV:=python -m venv
PIP:=python -m pip
endif

install:
python -m pip install -U pip
python -m pip install -Ue .[dev,docs]
$(PIP) install -Ue .[$(EXTRAS)]

release: lint test clean
flit publish

format:
python -m ufmt format aiosqlite
.venv:
$(VENV) .venv

lint:
python -m flake8 aiosqlite
python -m ufmt check aiosqlite
venv: .venv
source .venv/bin/activate && make install
echo 'run `source .venv/bin/activate` to activate virtualenv'

test:
python -m coverage run -m aiosqlite.tests
python -m coverage run -m $(PKG).tests
python -m coverage report
python -m mypy -p aiosqlite
python -m mypy -p $(PKG)

lint:
python -m flake8 $(PKG)
python -m ufmt check $(PKG)

format:
python -m ufmt format $(PKG)

perf:
python -m unittest -v aiosqlite.tests.perf
python -m unittest -v $(PKG).tests.perf

.PHONY: html
html: .venv README.rst docs/*.rst docs/conf.py
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["flit_core >=2,<4"]
requires = ["flit_core >=3.8,<4"]
build-backend = "flit_core.buildapi"

[project]
Expand All @@ -8,7 +8,7 @@ readme = "README.rst"
license = {file="LICENSE"}
dynamic = ["version", "description"]
authors = [
{name="Amethyst Reese", email="amy@n7.gg"},
{name="Amethyst Reese", email="amethyst@n7.gg"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -17,7 +17,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Libraries",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"typing_extensions >= 4.0",
]
Expand All @@ -26,6 +26,7 @@ dependencies = [
dev = [
"attribution==1.7.1",
"black==24.3.0",
"build>=1.2",
"coverage[toml]==7.4.4",
"flake8==7.0.0",
"flake8-bugbear==24.2.6",
Expand All @@ -36,7 +37,7 @@ dev = [
]
docs = [
"sphinx==7.2.6",
"sphinx-mdinclude==0.5.3",
"sphinx-mdinclude==0.6.1",
]

[project.urls]
Expand Down