Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Python CI

on:
push:
branches:
- '**'
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Install dependencies
run: uv sync --all-extras

- name: Run linting
run: uv run ruff check .

- name: Run tests
run: uv run pytest
Comment on lines +34 to +35
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

CI runs pytest unconditionally, but the current test suite connects to https://opal-demo.obiba.org with real credentials. This makes CI dependent on an external service and likely to be flaky/fail in GitHub Actions. Consider marking these as integration tests (e.g., @pytest.mark.integration) and skipping by default unless an env var/secret is provided, or mock the Opal API for CI.

Suggested change
- name: Run tests
run: uv run pytest
- name: Run unit tests
run: uv run pytest -m "not integration"
- name: Run integration tests (requires Opal credentials)
if: ${{ secrets.OPAL_USERNAME != '' && secrets.OPAL_PASSWORD != '' }}
run: uv run pytest -m "integration"

Copilot uses AI. Check for mistakes.
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Python Deployment

on:
push:
tags:
- '*'

jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install dependencies
run: uv sync --all-extras

- name: Run tests
run: uv run pytest
Comment on lines +28 to +29
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

This workflow runs pytest before publishing, but the tests currently hit https://opal-demo.obiba.org over the network. That makes releases dependent on external service availability and can block publishing due to transient outages. Consider separating unit tests from integration tests and only running integration tests on a dedicated workflow/environment with required secrets.

Suggested change
- name: Run tests
run: uv run pytest
- name: Run unit tests (exclude integration/network tests)
run: uv run pytest -m "not integration"

Copilot uses AI. Check for mistakes.

- name: Build package
run: uv build

- name: Publish to PyPI
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 365
days-before-issue-close: 14
exempt-issue-labels: "pinned, security"
stale-issue-label: "stale"
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."
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."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@ coverage
*.sln
*.sw?

# VSCode
.history
__pycache__

debug.py
.serena/
plans/
.venv/
46 changes: 46 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Ruff configuration file

# Exclude a variety of commonly ignored directories.
extend-exclude = [
"__pycache__",
".git",
".venv",
".eggs",
".nox",
".tox",
".svn",
".hg",
"build",
"dist",
".mypy_cache",
".pytest_cache",
]

# Assume Python 3.10.
target-version = "py310"

# Line length with preview to format
line-length = 120
preview = true

[lint]
# Enable flake8-bugbear rules
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"SIM", # flake8-simplify
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]

# Ignore B008 for Typer - typer.Option in argument defaults is standard Typer practice
# Ignore E501 - long lines in help text are acceptable
ignore = ["B008", "E501"]

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
29 changes: 17 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
install:
poetry install
uv sync --all-extras

test:
poetry run pytest
uv run --all-extras pytest

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

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

build:
poetry build
format:
uv run ruff format .

check: format fix

publish:
poetry publish --build
build:
uv build

clean:
rm -rf dist

local-install:
pip install ./dist/datashield_opal-*.tar.gz
local-install: clean build
pip install ./dist/datashield-*.tar.gz

local-install-force: clean build
pip install ./dist/datashield-*.tar.gz --break-system-packages
Comment on lines +25 to +28
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

local-install installs ./dist/datashield-*.tar.gz, but the distribution name is datashield-opal (likely producing datashield_opal-*.tar.gz / datashield_opal-*.whl). This target will fail or install the wrong artifact; adjust the glob to match the actual built filename(s).

Suggested change
pip install ./dist/datashield-*.tar.gz
local-install-force: clean build
pip install ./dist/datashield-*.tar.gz --break-system-packages
pip install ./dist/datashield-opal-*.tar.gz
local-install-force: clean build
pip install ./dist/datashield-opal-*.tar.gz --break-system-packages

Copilot uses AI. Check for mistakes.
2 changes: 1 addition & 1 deletion datashield_opal/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from datashield_opal.impl import OpalDriver
from datashield_opal.impl import OpalDriver as OpalDriver
Loading
Loading