-
Notifications
You must be signed in to change notification settings - Fork 0
feat: use uv as package manager, ruff as linter, add github actions #1
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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
|
||||||||||
| - name: Run tests | |
| run: uv run pytest | |
| - name: Run unit tests (exclude integration/network tests) | |
| run: uv run pytest -m "not integration" |
| 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 }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,4 +27,11 @@ coverage | |
| *.sln | ||
| *.sw? | ||
|
|
||
| # VSCode | ||
| .history | ||
| __pycache__ | ||
|
|
||
| debug.py | ||
| .serena/ | ||
| plans/ | ||
| .venv/ | ||
| 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]+?))$" |
| 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
|
||||||||||||||||||
| 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 |
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI runs
pytestunconditionally, but the current test suite connects tohttps://opal-demo.obiba.orgwith 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.