Skip to content

Commit fa26592

Browse files
authored
feat: use uv as package manager, ruff added, github actions added (#2)
* feat: ruff added, github actions added * fix: code review of tests etc
1 parent d381389 commit fa26592

File tree

12 files changed

+515
-105
lines changed

12 files changed

+515
-105
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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ coverage
2727
*.sln
2828
*.sw?
2929

30-
.serena/
30+
# VSCode
31+
.history
3132
__pycache__
33+
34+
debug.py
35+
.serena/
36+
plans/
3237
.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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
install:
2-
uv sync
2+
uv sync --all-extras
33

44
test:
5-
uv run pytest
5+
uv run --all-extras pytest
6+
7+
lint:
8+
uv run ruff check .
9+
10+
fix:
11+
uv run ruff check . --fix
12+
13+
format:
14+
uv run ruff format .
15+
16+
check: format fix
617

718
build:
819
uv build
920

10-
publish:
11-
uv publish
12-
1321
clean:
1422
rm -rf dist
1523

16-
local-install:
24+
local-install: clean build
1725
pip install ./dist/datashield-*.tar.gz
26+
27+
local-install-force: clean build
28+
pip install ./dist/datashield-*.tar.gz --break-system-packages

datashield/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
from datashield.interface import DSConnection, DSLoginInfo, DSDriver, DSError
2-
from datashield.api import DSLoginBuilder, DSSession
1+
from datashield.interface import (
2+
DSConnection as DSConnection,
3+
DSLoginInfo as DSLoginInfo,
4+
DSDriver as DSDriver,
5+
DSError as DSError,
6+
)
7+
from datashield.api import DSLoginBuilder as DSLoginBuilder, DSSession as DSSession

0 commit comments

Comments
 (0)