diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..e4c513d --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing + +## Development setup + +```bash +uv sync --all-extras --dev +uv run pytest -q +uv run ruff check . +``` + +## Opening a pull request + +1. Apply **exactly one** label before merging: + + | Label | When to use | + |---|---| + | `breaking` | Public API change, backward-incompatible | + | `feature` | New functionality, backward-compatible | + | `fix` | Bug fix | + | `dependencies` | Dependency version update | + | `chore` | CI changes, refactoring, test additions, docs — anything that does not affect the public-facing package. Bypasses the label gate; excluded from the changelog and does not bump the version. | + +2. When merging (squash), write a clear extended description in the merge dialog. That text — not the PR's opening description — becomes the changelog entry for this change. Leave it blank for `chore` PRs. + +## Versioning and releases + +Versions are derived from git tags; there is no version string in any source file. Releases are triggered by a maintainer publishing the standing draft release on the repository's Releases page. There is no automated commit-back to `main`. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..46ef5eb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,66 @@ +name: "🐞 Bug Report" +description: Report a reproducible bug. +type: "Bug" +body: + - type: checkboxes + attributes: + label: Pre-flight + options: + - label: I searched existing issues and this is not a duplicate. + required: true + + - type: textarea + id: summary + attributes: + label: Summary + description: One or two sentences describing the bug. + validations: + required: true + + - type: textarea + id: reproduction + attributes: + label: Reproduction + description: Steps and/or a minimal code example that reproduces the issue. Wrap code in triple backticks. + placeholder: | + 1. Import X and call Y with Z + 2. Observe error + + ```python + # minimal example + ``` + validations: + required: true + + - type: textarea + id: actual + attributes: + label: Actual behaviour + validations: + required: true + + - type: textarea + id: expected + attributes: + label: Expected behaviour + validations: + required: true + + - type: textarea + id: logs + attributes: + label: Error output + description: Full traceback if applicable. Formatted automatically. + render: python-traceback + + - type: textarea + id: system + attributes: + label: System info + description: | + Run this in your environment and paste the output: + + ```shell + python <(curl -s https://raw.githubusercontent.com/AustralianCancerDataNetwork/cava-devops/main/scripts/cava_system_info.py) + ``` + render: shell diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..a6cc5b1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Discussions + url: https://github.com/orgs/AustralianCancerDataNetwork/discussions + about: Questions and general discussion about the CAVA stack. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..7b1d3ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,32 @@ +name: "🚀 Feature Request" +description: Propose a new feature or enhancement. +type: "Feature" +body: + - type: checkboxes + attributes: + label: Pre-flight + options: + - label: I searched existing issues and this has not been requested before. + required: true + + - type: textarea + id: problem + attributes: + label: Problem or motivation + description: What are you trying to do that you currently cannot? + validations: + required: true + + - type: textarea + id: proposal + attributes: + label: Proposed solution + description: How would you like this to work? + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: Other approaches you considered and why you ruled them out. diff --git a/.github/ISSUE_TEMPLATE/not_working.yml b/.github/ISSUE_TEMPLATE/not_working.yml new file mode 100644 index 0000000..176a64e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/not_working.yml @@ -0,0 +1,65 @@ +name: "❗ Something is not working" +description: Something behaves unexpectedly but you are not sure if it is a bug. +body: + - type: checkboxes + attributes: + label: Pre-flight + options: + - label: I searched existing issues for this problem. + required: true + + - type: textarea + id: summary + attributes: + label: Problem summary + description: 1-2 sentences describing what is not working. + validations: + required: true + + - type: textarea + id: reproduction + attributes: + label: Reproduction + description: Steps and/or a minimal code example. Wrap code in triple backticks. + placeholder: | + 1. Import X and call Y with Z + 2. Observe unexpected behaviour + + ```python + # minimal example + ``` + validations: + required: true + + - type: textarea + id: actual + attributes: + label: Actual outcome + validations: + required: true + + - type: textarea + id: expected + attributes: + label: Expected outcome + validations: + required: true + + - type: textarea + id: logs + attributes: + label: Error messages + description: Full traceback if applicable. Formatted automatically. + render: python-traceback + + - type: textarea + id: system + attributes: + label: System info + description: | + Run this in your environment and paste the output: + + ```shell + python <(curl -s https://raw.githubusercontent.com/AustralianCancerDataNetwork/cava-devops/main/scripts/cava_system_info.py) + ``` + render: shell diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..159dda2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,9 @@ +## Summary + + + +## Checklist + +- [ ] Applied exactly one label (`breaking`, `feature`, `fix`, `dependencies`, or `chore`) +- [ ] Tests pass locally (`uv run pytest -q`) +- [ ] Lint passes (`uv run ruff check .`) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..e2d05a1 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,33 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +commitish: main + +categories: + - title: Breaking Changes + labels: ['breaking'] + - title: Features + labels: ['feature'] + - title: Fixes + labels: ['fix'] + - title: Dependencies + labels: ['dependencies'] + +template: | + $CHANGES + +change-template: | + - **$TITLE** (#$NUMBER) by @$AUTHOR + $BODY + +version-resolver: + major: + labels: ['breaking'] + minor: + labels: ['feature'] + patch: + labels: ['fix', 'dependencies'] + default: patch + +exclude-labels: ['chore'] + +autolabeler: [] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bbff58..c503318 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,29 +1,12 @@ name: CI - on: - push: - branches: [main] pull_request: - + branches: [main] + types: [opened, synchronize, reopened, labeled, unlabeled] jobs: - ruff: - name: ruff - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install ruff - run: | - python -m pip install --upgrade pip - pip install ruff - - - name: Run ruff - run: | - ruff check src tests + label-gate: + uses: AustralianCancerDataNetwork/cava-devops/.github/workflows/label-gate.yml@main + build-test: + uses: AustralianCancerDataNetwork/cava-devops/.github/workflows/build-test-postgres.yml@main + with: + postgres-db: orm_loader_test diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0dfbfb1..0854e63 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,8 +2,8 @@ name: Deploy Docs on: push: - branches: - - main + tags: ['v*'] + workflow_dispatch: permissions: contents: write diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml new file mode 100644 index 0000000..4844c62 --- /dev/null +++ b/.github/workflows/merge.yml @@ -0,0 +1,13 @@ +name: Release Update +on: + pull_request: + types: [closed] +jobs: + sync-description: + if: github.event.pull_request.merged == true + uses: AustralianCancerDataNetwork/cava-devops/.github/workflows/sync-pr-description.yml@main + draft: + needs: [sync-description] + if: needs.sync-description.result == 'success' + uses: AustralianCancerDataNetwork/cava-devops/.github/workflows/release-drafter.yml@main + secrets: inherit diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a2af408 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,19 @@ +name: Publish +on: + push: + tags: ['v*'] +jobs: + build: + uses: AustralianCancerDataNetwork/cava-devops/.github/workflows/publish.yml@main + publish: + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write + environment: + name: pypi + url: https://pypi.org/p/orm-loader + steps: + - uses: actions/download-artifact@v4 + with: { name: dist, path: dist/ } + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index dc4c693..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish to PyPI - -on: - release: - types: [published] - - -jobs: - publish: - runs-on: ubuntu-latest - permissions: - id-token: write # REQUIRED for trusted publishing - contents: read - environment: - name: pypi - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install build tools - run: python -m pip install --upgrade build - - - name: Build package - run: python -m build - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 38ea4e8..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Tests - -on: - push: - branches: [main] - pull_request: - -jobs: - tests: - name: pytest (Python ${{ matrix.python-version }}) - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:16 - env: - POSTGRES_USER: test - POSTGRES_PASSWORD: test - POSTGRES_DB: orm_loader_test - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 5s - --health-timeout 5s - --health-retries 10 - - strategy: - fail-fast: false - matrix: - python-version: - - "3.12" - - "3.13" - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: pip - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e ".[dev,postgres]" - - - name: Run pytest - env: - PYTHONPATH: src - TEST_POSTGRES_URL: postgresql+psycopg://test:test@localhost:5432/orm_loader_test - run: pytest diff --git a/CHANGELOG.md b/CHANGELOG.md index 382ca4a..b458e79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +> [!NOTE] +> This file is no longer maintained. Release history from this point forward is in [GitHub Releases](https://github.com/AustralianCancerDataNetwork/orm-loader/releases). + # 0.5.0 - paginated merge support via optional `merge_batch_size` parameter to bound memory per transaction on large datasets - more efficient backend resolving diff --git a/pyproject.toml b/pyproject.toml index a7209ce..d1f0278 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orm-loader" -version = "0.5.2" +dynamic = ["version"] description = "Generic base classes to handle ORM functionality for multiple downstream datamodels" readme = "README.md" authors = [ @@ -34,8 +34,15 @@ Repository = "https://github.com/AustralianCancerDataNetwork/orm-loader" Issues = "https://github.com/AustralianCancerDataNetwork/orm-loader/issues" [build-system] -requires = ["uv_build>=0.9.2,<0.10.0"] -build-backend = "uv_build" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "vcs" +raw-options = { tag_regex = '^v?(?P[0-9]+\.[0-9]+\.[0-9]+)$' } + +[tool.hatch.build.targets.wheel] +packages = ["src/orm_loader"] [project.optional-dependencies] postgres = [ @@ -58,8 +65,8 @@ dev = [ [project.entry-points."omop.config"] orm_loader = "orm_loader.config:OrmLoaderConfig" -[tool.setuptools] -packages = ["orm_loader"] +[tool.uv] +cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true } }] [tool.ruff] line-length = 100 diff --git a/src/orm_loader/config.py b/src/orm_loader/config.py index 0c1f3b6..8fd8f4c 100644 --- a/src/orm_loader/config.py +++ b/src/orm_loader/config.py @@ -22,8 +22,6 @@ class OrmLoaderConfig(PackageConfigBase): display_name="ORM Loader Test Database", description="PostgreSQL database for running orm-loader integration tests.", connection_name_hint="pg_test_orm", - is_cdm_database=False, - cdm_schema_default="public", connection_defaults=DatabaseConfig( dialect="postgresql+psycopg", host="localhost",