Skip to content

Commit ee6a074

Browse files
committed
feat: use uv as package manager, ruff as linter, add github actions
1 parent 3a1a7dd commit ee6a074

File tree

14 files changed

+821
-464
lines changed

14 files changed

+821
-464
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v4
25+
with:
26+
enable-cache: true
27+
28+
- name: Install dependencies
29+
run: uv sync --all-extras
30+
31+
- name: Run linting
32+
run: uv run ruff check .
33+
34+
- name: Run tests
35+
run: uv run pytest

.github/workflows/deploy.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Python Deployment
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.12"]
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v4
24+
25+
- name: Install dependencies
26+
run: uv sync --all-extras
27+
28+
- name: Run tests
29+
run: uv run pytest
30+
31+
- name: Build package
32+
run: uv build
33+
34+
- name: Publish to PyPI
35+
run: uv publish
36+
env:
37+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/stale.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Close inactive issues
2+
on:
3+
schedule:
4+
- cron: "30 1 * * *"
5+
6+
jobs:
7+
close-issues:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
steps:
13+
- uses: actions/stale@v5
14+
with:
15+
days-before-issue-stale: 365
16+
days-before-issue-close: 14
17+
exempt-issue-labels: "pinned, security"
18+
stale-issue-label: "stale"
19+
stale-issue-message: "This issue is stale because it has been open for a year with no activity. It will be closed if no further activity occurs. Thank you for your contributions."
20+
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale. Feel free to re-open it if it is still relevant."
21+
days-before-pr-stale: -1
22+
days-before-pr-close: -1
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@ coverage
2727
*.sln
2828
*.sw?
2929

30+
# VSCode
31+
.history
3032
__pycache__
33+
34+
debug.py
35+
.serena/
36+
plans/
37+
.venv/

.ruff.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Ruff configuration file
2+
3+
# Exclude a variety of commonly ignored directories.
4+
extend-exclude = [
5+
"__pycache__",
6+
".git",
7+
".venv",
8+
".eggs",
9+
".nox",
10+
".tox",
11+
".svn",
12+
".hg",
13+
"build",
14+
"dist",
15+
".mypy_cache",
16+
".pytest_cache",
17+
]
18+
19+
# Assume Python 3.10.
20+
target-version = "py310"
21+
22+
# Line length with preview to format
23+
line-length = 120
24+
preview = true
25+
26+
[lint]
27+
# Enable flake8-bugbear rules
28+
select = [
29+
"E", # pycodestyle errors
30+
"W", # pycodestyle warnings
31+
"F", # pyflakes
32+
"B", # flake8-bugbear
33+
"C4", # flake8-comprehensions
34+
"UP", # pyupgrade
35+
"SIM", # flake8-simplify
36+
]
37+
38+
# Allow autofix for all enabled rules (when `--fix`) is provided.
39+
fixable = ["ALL"]
40+
41+
# Ignore B008 for Typer - typer.Option in argument defaults is standard Typer practice
42+
# Ignore E501 - long lines in help text are acceptable
43+
ignore = ["B008", "E501"]
44+
45+
# Allow unused variables when underscore-prefixed.
46+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

Makefile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
install:
2-
poetry install
2+
uv sync --all-extras
33

44
test:
5-
poetry run pytest
5+
uv run --all-extras pytest
66

7-
test-api-admin:
8-
poetry run pytest tests/test_api_admin.py
7+
lint:
8+
uv run ruff check .
99

10-
test-api-analysis:
11-
poetry run pytest tests/test_api_analysis.py
10+
fix:
11+
uv run ruff check . --fix
1212

13-
build:
14-
poetry build
13+
format:
14+
uv run ruff format .
15+
16+
check: format fix
1517

16-
publish:
17-
poetry publish --build
18+
build:
19+
uv build
1820

1921
clean:
2022
rm -rf dist
2123

22-
local-install:
23-
pip install ./dist/datashield_opal-*.tar.gz
24+
local-install: clean build
25+
pip install ./dist/datashield-*.tar.gz
26+
27+
local-install-force: clean build
28+
pip install ./dist/datashield-*.tar.gz --break-system-packages

datashield_opal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from datashield_opal.impl import OpalDriver
1+
from datashield_opal.impl import OpalDriver as OpalDriver

0 commit comments

Comments
 (0)