diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..fba8997 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,23 @@ +name: Checks + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + release-planning: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7.0.1 + - uses: actions/setup-python@v7.0.0 + with: + python-version: '3.12' + - run: python -m pip install -r requirements-dev.txt + - run: python -m unittest discover -s tests -v + - name: Show version-gated release candidates (no publishing) + run: python scripts/release_plan.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cbee42b --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.venv/ +__pycache__/ +*.py[cod] +*.egg-info/ +build/ +dist/ +.coverage +.pytest_cache/ +.ruff_cache/ +.DS_Store diff --git a/AGENTS.md b/AGENTS.md index 086c6b2..c7bd561 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,21 +1,23 @@ -# OpenVax2 planning repository +# OpenVax2 planning and release preparation ## Current scope -The user requested documentation and design planning now, with an implementation -sweep later, after ongoing package PRs finish. Maintain that phase boundary until -the user requests implementation. +The user requested documentation and design planning, then authorized public +hosting, Apache 2.0 licensing, and preparation for independent package releases. +The package migration sweep remains deferred until ongoing package PRs finish. - Work on a documentation branch; keep recommendations distinct from accepted decisions and observed facts. - Read sibling repositories as evidence. Preserve their branches, worktrees, uncommitted changes, editables, tags, and release state. -- Do not import package source, change dependency bounds, create environments, - install packages, or enable releases as part of planning. +- Prepare and test release tooling in an isolated tooling environment as needed. + Do not import library source, change sibling package bounds, or publish Python + packages/container images as part of this preparation. - Date observations and identify source commits. A local branch is not evidence that a PR has merged or a package has shipped. -- Planning documents do not require package version bumps, package tests, or - releases. Check document links and consistency instead. +- Planning documents do not require library version bumps or releases. Check + document links and consistency. For release-tooling changes, run the tests in + CONTRIBUTING.md and inspect the generated release plan. - Before implementation, refresh the inventory and read the applicable source repository instructions. Resolve their release rules explicitly for the monorepo instead of copying automatic release behavior into the root. @@ -32,6 +34,6 @@ and report any constraint that prevents a current version. Do not silently downgrade packages or force incompatible installs. Distinguish this shared environment from repository-local release environments. -This planning task does not maintain that environment. Future workspace and +This preparation does not maintain that environment. Future workspace and release validation should use dedicated environments. Switching the shared environment's editable paths is a separate migration step after validation. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..81d613f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,88 @@ +# Contributing to OpenVax2 + +## Current phase: design and release-tooling preparation + +Open a branch and PR for changes. The repository currently contains documentation +and a release planner, with no imported library packages. Run these checks using +Python 3.11 or later in a repository-local environment: + +```sh +python3 -m venv .venv +.venv/bin/python -m pip install -r requirements-dev.txt +.venv/bin/python -m unittest discover -s tests -v +.venv/bin/python scripts/release_plan.py +git diff --check +``` + +The current plan should contain empty `publish` and `skip` arrays. Do not invent +placeholder package versions, create empty PyPI projects, or migrate source just +to populate the registry. Root documentation/tooling changes do not require +library version bumps. Preserve the shared environment as described in +[AGENTS.md](AGENTS.md). + +## After migration: work on one package + +The following commands describe the intended workflow after the workspace and +its `test` dependency group exist. They are not runnable in today's scaffold. + +```sh +# From the monorepo root, install varcode and its dependency closure. +uv sync --package varcode --group test + +# Run from the package directory so tests and fixtures have their expected paths. +cd packages/varcode +uv run --package varcode --group test python -m pytest tests +``` + +Workspace dependencies resolve to sibling source, so editing `pyensembl` can be +tested immediately through `varcode`. Selecting one member does not create a +separate virtual environment per member. Preserve each package's established +lint/test wrapper where it supplies required environment or fixture setup; +the direct pytest command above is the simple case. +[uv workspace behavior](https://docs.astral.sh/uv/concepts/projects/workspaces/) + +For a public API change, identify and test transitive consumers. CI initially +runs all core suites, then may select affected suites once dependency tracking +is proven. Do not remove a compatibility bound merely to make a local sync pass. + +## Independent-package validation + +Build from the package directory with workspace sources disabled, then test the +wheel in a fresh environment outside the checkout. For example, after migration: + +```sh +# Run from packages/varcode; uv must be available on PATH. +uv build --no-sources --out-dir /tmp/openvax-varcode-dist +``` + +Install the resulting exact wheel into a dedicated test environment and run +`python -m pip check`, import/CLI/resource checks, and its behavioral tests without +editable installs or `PYTHONPATH` pointing at source. Build from the sdist too. +If the change needs an unreleased sibling, install its candidate wheel in the +same clean environment. A separate lane checks compatibility with released +dependencies where applicable. The build flag alone does not test runtime +dependency correctness. +[uv build guidance](https://docs.astral.sh/uv/guides/package/) + +## Cross-package PRs and versions + +Keep implementation and consumer changes together. Identify touched packages, +new API requirements, and validation in the PR. When ready to release, bump the +existing authoritative version in each affected package and update its notes. +Published dependency metadata changes count as package changes. Do not bump an +unchanged consumer just because it depends on a newly released producer. + +Example: change `varcode` and adapt `isovar`; release those two if both need new +versions. If `gtfparse` is unchanged, its version and PyPI files remain untouched. +Tests may run for all three. If an `openvax` stack release should adopt the new +pair, update its exact component pins, run stack integration tests, and bump its +own version. Otherwise, existing stack releases keep their previous pins. + +Never publish from a working developer environment. The future release job +builds from a clean selected commit, validates candidate artifacts, and uploads +those exact files. See [release policy](releases/README.md). + +## Contributions and licensing + +New original contributions use Apache 2.0. Keep existing copyright/license +notices when importing source and document third-party material separately. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..7444f21 --- /dev/null +++ b/NOTICE @@ -0,0 +1,6 @@ +OpenVax2 +Copyright 2026 OpenVax contributors + +Original repository materials are licensed under the Apache License, Version 2.0. +Imported packages and third-party materials retain their own copyright notices +and applicable licenses. diff --git a/README.md b/README.md index f327a32..83bc925 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,99 @@ -# OpenVax2 monorepo planning +[![Checks](https://github.com/openvax/openvax2/actions/workflows/checks.yml/badge.svg)](https://github.com/openvax/openvax2/actions/workflows/checks.yml) +[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) -Status: **design draft; implementation deferred**. Started 2026-10-07. +# OpenVax2 -Repository: [openvax/openvax2](https://github.com/openvax/openvax2). +**One development repository. Independent Python packages. A tested combined stack.** -The proposed monorepo would let related OpenVax libraries evolve in one pull -request while continuing to ship independent PyPI packages. Existing package -names, imports, command-line entry points, and version histories would remain. +OpenVax2 is the public home for planning the OpenVax monorepo: annotation, +variant interpretation, peptide generation, MHC prediction, and vaccine ranking. +The goal is to change related libraries in one PR while preserving their existing +PyPI names, imports, command-line tools, and independent versions. -This repository currently contains planning documents only. Ongoing work stays -in the existing repositories. The implementation sweep starts after the relevant -PRs land and the migration baseline is recorded. +**Status:** design and release-tooling preparation. No libraries have been +migrated and no packages or container images are published from this repository +yet. Ongoing PRs continue in their original repositories before the implementation +sweep. The [source inventory](docs/inventory.md) records a dated planning snapshot. -## Read the plan +## What will users install? + +We plan to support all three paths. The combined products are conveniences built +from the same individual releases; users can keep installing just one library. + +| Artifact | Purpose | Version policy | Availability | +| --- | --- | --- | --- | +| Individual PyPI packages, e.g. `varcode`, `isovar`, `vaxrank` | Use a library or CLI with its declared dependencies | Each retains its own version | Existing upstream releases remain available | +| `openvax` PyPI metapackage | Install a tested combination of OpenVax Python packages with one command | Its own stack version pins the selected component versions | Planned; name availability/ownership must be confirmed before publishing | +| `ghcr.io/openvax/openvax2` runtime image | Run that combined stack with Python and required redistributable system libraries | Stack version plus image revision; record immutable digest | Planned | + +**Yes, the intended Python convenience install is `pip install openvax`.** It +will be a small dependency-only metapackage under `packages/openvax/`, not a copy +of all the library source or a replacement import namespace. Existing imports +such as `from varcode import Variant` will remain. That install command is a +future interface, not an installation instruction for a released product today. + +The metapackage pins a compatible set of component releases. It does not freeze +every third-party dependency or install operating-system libraries. The Docker +image adds the full locked Python environment and system runtime. Large genomes, +model downloads, and user data remain explicit, versioned inputs mounted or +downloaded into caches. Restricted predictor binaries require separate provision. +See [combined artifacts](docs/distribution.md) for exact boundaries and examples. + +## Developing one package or several + +Each imported package will own its code, tests, build metadata, version, release +notes, and public dependencies under `packages//`. A uv workspace will +resolve sibling dependencies to editable source during development. + +- **One-package change:** work in its directory, run its tests, and test affected + consumers. Bump only that package when preparing its release. +- **Cross-package change:** update the producer and consumers together in one PR. + Bump each package whose code or published dependency requirements change. +- **Independent install check:** build each affected wheel and test it outside + the checkout against declared dependencies. A shared development environment + cannot prove an individual distribution is complete. +- **Combined-stack update:** choose tested component versions and bump the + metapackage separately. A component release need not immediately update the + combined stack or release unrelated libraries. + +[CONTRIBUTING.md](CONTRIBUTING.md) gives the current tooling commands and the +planned workspace/isolated development commands. The repository root is tooling; +it will not itself be a Python distribution. + +## Releases follow package versions + +**An unchanged package version is never republished.** A new repository commit, +docs edit, another package's version bump, or a Docker rebuild is not a reason +to upload every package again. + +The checked-in [release planner](scripts/release_plan.py) compares each registered +package's authoritative version with its last recorded published version. It +selects increases, skips equal versions, and rejects downgrades. The registry is +empty until migration, so today's plan has no release candidates. CI runs the +planner and its tests; it has no publishing step or publishing credentials. + +The eventual publisher will recheck PyPI, validate artifacts and dependency +order, and publish only the selected package/version pairs. Stack metapackage +releases follow the same rule. Docker image revisions have their own lifecycle +so system updates do not force Python package releases. + +Read [release tooling and policy](releases/README.md) for state management, +version sources, retries, and the remaining production work. + +## Documentation | Document | Purpose | | --- | --- | -| [Design](docs/design.md) | Package layout, dependencies, CI, and independent releases | -| [Inventory](docs/inventory.md) | Dated source evidence, package relationships, and migration constraints | -| [Migration plan](docs/migration-plan.md) | Readiness gates, implementation work, validation, and cutover | -| [Decision log](docs/decisions.md) | Recommendations, unresolved choices, and acceptance criteria | -| [Agent instructions](AGENTS.md) | Planning scope and environment preservation | - -## Working proposal - -- Bring the closely coupled annotation and vaccine-ranking packages into - `packages//`. -- Use a uv workspace for packages that can share a compatible development - environment; retain separate environments where needed. -- Keep each package independently buildable, installable, versioned, and - publishable. The repository root is tooling, not a new PyPI distribution. -- Validate cross-package changes together and validate individual wheels in - clean environments. -- Automate release planning and publish only packages with releasable changes. - -These are proposed defaults, not an approved migration or a working workspace. -There is no root `pyproject.toml`, lockfile, package import, or publishing workflow -yet. The final package list remains an open decision. - -## Next milestone - -Complete the readiness register in the [migration plan](docs/migration-plan.md) -after ongoing PRs settle. Then select exact source commits and implement the -first workspace and packaging checks in a reviewable sweep. +| [Contributing](CONTRIBUTING.md) | Individual and coordinated development | +| [Combined artifacts](docs/distribution.md) | Metapackage, locks, Docker, and data/model boundaries | +| [Release policy](releases/README.md) | Publish only changed package versions | +| [Design](docs/design.md) | Workspace, dependencies, validation, and architecture | +| [Inventory](docs/inventory.md) | Source snapshots and constraints to revisit after PRs land | +| [Migration plan](docs/migration-plan.md) | Readiness, implementation, validation, and cutover | +| [Decision log](docs/decisions.md) | Established direction and open decisions | + +## License + +Original OpenVax2 materials are licensed under the [Apache License 2.0](LICENSE). +See [NOTICE](NOTICE). Imported packages preserve their licenses and attribution; +third-party tools, reference datasets, and model assets retain their own terms. diff --git a/docs/decisions.md b/docs/decisions.md index 13df65e..567382e 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -5,16 +5,17 @@ implementation or permission to publish packages. ## Established direction -- **Documentation first.** The user requested design planning now and an - implementation sweep after ongoing package PRs finish. +- **Prepare now, migrate later.** The user requested design planning and release + preparation now, with package migration after ongoing PRs finish. - **Preserve individual PyPI packages.** This is the direction being evaluated; existing names and imports should continue working. - **Preserve the shared environment and local work.** The user's environment maintenance policy is recorded in [AGENTS.md](../AGENTS.md). -- **Hosting.** The user selected `openvax/openvax2` on GitHub. The repository is - private pending an explicit public-visibility decision, with `main` as its - default branch. This changes the planning repository's location, not the - implementation scope. +- **Hosting and license.** The user explicitly requested public visibility and + Apache 2.0 for `openvax/openvax2`. The default branch is `main`. +- **Independent release gates.** Publish a distribution only when its own + version increases (or for an intentional first release); unchanged versions + are skipped. The read-only planner and its CI tests implement selection now. ## Decision register @@ -23,14 +24,16 @@ implementation or permission to publish packages. | D01 | Initial members | Closely coupled core listed in the design; evaluate `serializable` and `mhcgnomes` with it | Confirm canonical repositories, ownership, coupling, and the final allowlist | | D02 | Adjacent projects | Keep MHCflurry, MHCseqs, Osteosarc, Oncoref, and PirlyGenes external initially | Confirm which change frequently enough with the core to justify inclusion; external constraints still matter | | D03 | Dependency manager | uv workspace for the compatible core | Resolve post-PR constraints in a fresh environment and record chosen uv/Python versions | -| D04 | Versions and releases | Independent versions, package-qualified tags, release manifest | Agree how this replaces per-repository every-PR release rules | +| D04 | Versions and releases | Independent versions, package-qualified tags, release manifest; unchanged versions never republished | Version gating requested by user; finish publisher and reconcile imported release rules at migration | | D05 | Git history | Import full source histories without rewriting original repositories; rehearse a prefix/subtree merge | Verify history navigation, license retention, historical tag naming, and repository size | -| D06 | Hosting | `openvax/openvax2`, private, default branch `main` | Destination selected by the user; public visibility remains undecided; confirm package-specific ownership before source migration | +| D06 | Hosting and license | `openvax/openvax2`, public, Apache 2.0, default branch `main` | Explicitly requested by user; preserve imported licenses and confirm package ownership at migration | | D07 | Cutover baseline | Import selected merged commits after ongoing PRs settle | Fill the readiness register with PR links, exact SHAs, releases, and owners | | D08 | Python and platforms | Preserve current package support; choose a common development interpreter | Verify actual wheel availability and tests for each supported combination | | D09 | Publishing authority | One release path per package using existing PyPI projects | Inventory current automation; test replacement publisher configuration before cutover | | D10 | Issues and docs | Preserve original URLs, link selected active issues into the new workflow, retain docs redirects | Decide tracking location and per-package documentation hosting | | D11 | Editables after migration | Switch paths deliberately only after wheel/workspace verification | Inventory existing editable paths and any local work; follow the shared environment policy | +| D12 | Combined Python install | `openvax` metapackage with its own version and exact tested component pins | Recommended design; confirm PyPI name/ownership and core package set before first release | +| D13 | Combined runtime | `ghcr.io/openvax/openvax2`, stack version plus image revision | Recommended design; validate Linux targets, production locks, native libraries, and external model/data acquisition | ## Evidence that would change the recommendation diff --git a/docs/design.md b/docs/design.md index 65dc8b6..8d6e3f0 100644 --- a/docs/design.md +++ b/docs/design.md @@ -22,7 +22,8 @@ Start by evaluating `datacache`, `gtfparse`, `sercol`, `pyensembl`, `varcode`, `mhcgnomes` alongside them, with their source ownership confirmed. The [inventory](inventory.md) distinguishes these candidates from adjacent projects. -Proposed eventual structure; these directories are not implemented yet: +Proposed eventual structure; library directories and the workspace are not +implemented yet: ```text openvax2/ @@ -36,7 +37,9 @@ openvax2/ LICENSE varcode/ isovar/ + openvax/ # dependency-only combined-stack metapackage ... + releases/ # registry and publication state docs/ .github/workflows/ ``` @@ -53,6 +56,11 @@ and training workflows can remain separate from the core workspace. Heavy model files, reference downloads, caches, and analysis outputs do not belong in the source import. Preserve mechanisms for acquiring required versioned assets. +Provide a separate `openvax` metapackage selecting a tested component set and a +runtime container adding locked Python and system dependencies. Both are planned +products. They do not merge library APIs or force a shared library version. See +[combined artifacts](distribution.md) and [contribution workflows](../CONTRIBUTING.md). + ## Development dependencies and published dependencies uv workspaces provide member-specific `pyproject.toml` files, a common lockfile, @@ -136,7 +144,10 @@ updates. If a consumer starts requiring a new producer version, its changed dependency metadata requires a consumer release even if its code is unchanged. An unchanged consumer whose existing bounds still apply does not need a release. Root planning and tooling documentation alone should not release every package. -This proposed policy must explicitly replace conflicting imported instructions. +The user explicitly requested version-gated publishing. This policy must replace +conflicting imported instructions during migration. The current read-only +[release planner](../releases/README.md) selects version increases against a +recorded published baseline; the production publisher remains future work. Release tags are package-qualified, for example `varcode/v10.10.0` (illustrative, not a reserved release). Each package keeps one authoritative version source; @@ -180,6 +191,11 @@ coupling. A single combined distribution would reduce release count but change the installation footprint and existing package boundaries. A single version for every distribution would simplify numbering at the cost of unrelated releases. +A dependency-only metapackage provides a combined install while retaining +independent distributions. Its own version identifies a tested component set; +an image revision can update system dependencies without republishing Python +packages. This is the recommended combined-artifact approach. + The monorepo adds migration work for history, issue links, CI paths, documentation hosting, and publishing permissions. The first implementation should preserve behavior and measure whether a representative producer/consumer change can be diff --git a/docs/distribution.md b/docs/distribution.md new file mode 100644 index 0000000..711e3ef --- /dev/null +++ b/docs/distribution.md @@ -0,0 +1,102 @@ +# Individual packages and the combined stack + +Status: recommended product design; artifacts are not built or published yet. +The implementation sweep will establish the exact member set and supported +platforms after ongoing PRs finish. + +## Three artifacts with different responsibilities + +| Artifact | Contains | Does not contain | +| --- | --- | --- | +| Individual library wheel/sdist | That library, its required bundled resources, and dependency metadata | Sibling source bundled into the library | +| `openvax` metapackage | Metadata selecting a tested set of exact component versions | Duplicate implementation, system packages, or a new combined import API | +| OpenVax2 container image | Released components, locked Python dependencies, Python interpreter, and required redistributable native runtime | User samples, every reference genome/model, or restricted third-party executables | + +The metapackage and image serve different installation needs, so plan for both. +Researchers extending Python code can use the individual wheels or metapackage. +Pipeline operators can use a verified container digest to reproduce the shipped +runtime without assembling native dependencies manually. + +## The `openvax` metapackage + +Put it under `packages/openvax/`; keep the workspace root non-published. It has an +independent stack version and ordinary Python dependency metadata, so pip users +need no workspace or Git checkout. Pin the included OpenVax component versions +exactly. Keep normal compatible dependency ranges in the reusable libraries. + +The intended interface is `python -m pip install openvax==`. +Version placeholders in this document are illustrative, not commands for an +existing release. PyPI returned 404 for `openvax` on 2026-10-07; that does not +reserve the name or prove it can be claimed. Confirm availability and ownership +at publication time; `openvax-stack` is a possible fallback name. + +Start with one curated core stack. Add extras for genuinely optional capabilities +only when the dependency graph supports them; do not advertise a lightweight +extra if a required library already pulls in its heavy dependencies. In +particular, current MHCTools requires MHCflurry. An inference stack should not +implicitly include every development, notebook, or model-training dependency. + +The stack version is a compatibility snapshot, not a shared version imposed on +every component. A new `varcode` release can ship independently. Adopting it in +the stack is a separate change to the metapackage pins and its version, with +integration tests. Previously published metapackage versions retain their pins. + +Component pins do not freeze the entire third-party dependency graph. Distribute +resolved environment locks alongside each stack release for supported targets, +with hashes and the selected Python/platform recorded. Users needing the shipped +runtime use those locks or the container digest. A development `uv.lock` with +editable workspace members is not the production installation manifest. + +Dependencies belong in standard distribution metadata, which installers use to +resolve requirements. [PyPA metadata specification](https://packaging.python.org/en/latest/specifications/pyproject-toml/#dependencies-optional-dependencies) + +## Runtime image + +Target `ghcr.io/openvax/openvax2:-r`, backed by an +immutable image digest. Build from the metapackage's released wheels and exported +production locks, never editable source. Start with a CPU inference/runtime image +on the first validated Linux architecture. Add GPU and additional architectures +only with dedicated build and behavioral checks. + +Pin the base image by digest, record the OS packages and resolved Python graph, +and attach a manifest identifying component versions, source commits, lock hashes, +image digest, and required external asset versions. Use ordinary package CLIs in +the container; keep it usable for Python scripts as well. Smoke-test installed +CLIs, resource loading, prediction adapters, and representative reports. +[Docker guidance on base-image pinning](https://docs.docker.com/build/building/best-practices/#pin-base-image-versions) + +"All dependencies" means the dependencies required for the documented stack and +its supported capabilities. Inventory the actual native requirements during +implementation, including report-generation libraries. Document external service +requirements and host GPU drivers separately if GPU support is added. + +Keep user inputs and outputs on mounts. Provide an explicit data/cache volume for +versioned genome annotations, reference tables, and model bundles. Record model +and dataset identifiers/checksums with results. Redistribute only assets permitted +by their terms; Apache 2.0 on this repository does not relicense third-party +predictors or data. Package-specific downloads and licensed-tool setup remain +visible steps, not surprise downloads during imports. + +An OS-only update produces a new image revision, for example from `S-r1` to +`S-r2`, while keeping stack version `S` and all Python package versions unchanged. +Do not overwrite immutable version/revision tags. A convenience tag such as +`latest` may move, but reproducible runs should use the digest. + +## Delivery order and release examples + +1. Migrate and independently validate the selected libraries. +2. Build the metapackage against their published releases; verify a clean pip + install and stack integration tests before its first release. +3. Build and test the runtime image from that released stack and production locks. + +| Change | Individual distributions | Metapackage | Image | +| --- | --- | --- | --- | +| Root README edit | No publication | No publication | No release required | +| Varcode fix, same supported API | Publish Varcode only after its version bump | Update only when a new stack snapshot adopts it | Build when that stack snapshot is selected | +| Varcode API change requiring Isovar adaptation | Bump/publish both, dependency first | Bump if adopting the new pair | Build after the selected stack is released | +| New tested component combination | Reuse existing releases | Bump/publish its changed pins | Build corresponding stack image | +| System-library fix with the same Python stack | No publication | No publication | Increment image revision | + +The release planner never infers that a component bump requires all these +artifacts. Each Python distribution has its own version gate; the image has its +own reviewed build inputs and revision. See [release policy](../releases/README.md). diff --git a/docs/migration-plan.md b/docs/migration-plan.md index e8518dd..e330bf6 100644 --- a/docs/migration-plan.md +++ b/docs/migration-plan.md @@ -1,8 +1,9 @@ # Migration plan -Status: documentation phase, 2026-10-07. All implementation checkboxes below -remain open. Ongoing PR completion is a prerequisite, not something this planning -task has verified. See the [design](design.md) and [decisions](decisions.md). +Status: design and release preparation, 2026-10-07. Package migration and +production publishing remain pending. Ongoing PR completion is a prerequisite, +not something this task has verified. See the [design](design.md) and +[decisions](decisions.md). ## Phase 0: planning deliverables @@ -10,6 +11,9 @@ task has verified. See the [design](design.md) and [decisions](decisions.md). - [x] Inventory a representative set of local source commits and their relationships. - [x] Separate proposed defaults from decisions needing evidence. - [x] Record implementation gates and preservation of existing local work. +- [x] Publish the planning repository publicly with Apache 2.0 licensing. +- [x] Prepare a read-only package-version release planner and CI tests. +- [x] Document individual development, the combined metapackage, and runtime image. ## Phase 1: select a ready baseline @@ -89,7 +93,10 @@ behavior or packaging differences. Workspace-only success is insufficient. ## Phase 4: rehearse independent releases -- [ ] Implement version/release-note checks and a manifest for selected packages. +- [ ] Register migrated packages and seed verified published-version baselines + for the existing planner; extend it for any additional version-source schemes. +- [ ] Implement release-note/artifact checks and the production publication + manifest, including registry reconciliation and partial-release recovery. - [ ] Rehearse building, staging, and verifying a producer/consumer release pair while leaving an unrelated package untouched. - [ ] Verify dependency ordering, cycle detection, package-qualified tags, and @@ -100,6 +107,11 @@ behavior or packaging differences. Workspace-only success is insufficient. when that publishing rehearsal is authorized. - [ ] Prepare documentation links, issue references, project URLs, and the transition notices for old repositories. +- [ ] Confirm the `openvax` PyPI name/ownership and implement the metapackage with + tested component pins and its own version. Verify its clean pip install. +- [ ] Export production locks without editable sources; build and smoke-test + the selected CPU runtime image with versioned system dependencies and explicit + data/model acquisition. Define immutable tags and image revision handling. Exit evidence: a reviewable release manifest, verified artifacts, rehearsal results, and a concrete cutover checklist. This phase does not itself imply diff --git a/releases/README.md b/releases/README.md new file mode 100644 index 0000000..fc338a4 --- /dev/null +++ b/releases/README.md @@ -0,0 +1,95 @@ +# Version-gated releases + +## Implemented now + +`scripts/release_plan.py` is a read-only planner. CI runs its tests and prints a +JSON plan. No package publishing, image building, registry access, or state +updates occur in this script or the current workflow. The package registry and +published baseline are intentionally empty until packages migrate. + +The planner uses these inputs: + +- [packages.json](packages.json): explicit package allowlist, directory, and + optional Python version-file location. Versions are not duplicated here. +- [published.json](published.json): last confirmed published version per package. + Seed existing packages from verified PyPI releases at migration time. + +For a migrated package, an illustrative registration is: + +```json +{ + "name": "varcode", + "path": "packages/varcode", + "version_file": "varcode/version.py", + "version_variable": "__version__" +} +``` + +`version_file` is relative to the package directory. The planner reads a literal +top-level assignment with Python's AST; it never imports the module. Omit that +field for a package whose version lives in `project.version` in `pyproject.toml`. +Other dynamic version schemes need an explicit adapter before registration. +The future build check must verify that wheel metadata matches the planned name +and version, particularly for dynamic metadata. + +The published baseline maps distribution names to version strings. A completely +new distribution must explicitly set `"first_release": true` instead of +accidentally treating an unknown existing package as new. This flag does not +skip future registry, name-ownership, or artifact checks. + +| Version relative to last confirmed publication | Planner result | +| --- | --- | +| Equal, including equivalent PEP 440 spellings | Skip | +| Higher stable version | Candidate for publication | +| Lower version | Error | +| Missing baseline without explicit first release | Error | +| Prerelease, development, or local version | Error; initial policy is stable releases only | + +Comparison is against the last published version, not the previous Git commit. +A version bump remains pending through subsequent documentation commits until +publication completes. A changed file with an unchanged version never causes +automatic publication. The planner sorts output by name for readability; that +order is **not** dependency order or authorization to deploy. + +## Required production publisher, implemented in the later sweep + +1. Lock release execution to one run per repository and use a clean selected + `main` commit. Resolve the plan's versions from that commit, not a moving branch. +2. Reconcile the baseline with actual PyPI state. If the version already exists, + do not rebuild/overwrite it. Verify recorded artifact identity, finish a + recorded partial upload using identical files, or stop for reconciliation. + The local ledger alone is not sufficient protection against duplicate uploads. +3. Compare package/shipped inputs with the last released source commit. Reject a + proposed release that omits required dependency/version changes. For normal + PRs, surface pending package changes without automatically publishing or + forcing unrelated version bumps. Shared build-input changes need explicit + affected-package accounting. +4. Build wheels and sdists only for candidate packages. Check names, versions, + supported Python, dependency metadata, package data, licenses, and the sdist + round trip. Hash and retain artifacts before publication. +5. Resolve and test the full candidate dependency set. Derive dependency order + from built metadata; reject cycles and unavailable prerequisites. Test the + affected consumers even when their unchanged versions will not be published. +6. Publish the selected artifacts through per-project PyPI Trusted Publishers. + Wait for dependencies to be installable before publishing consumers. A + package tag such as `varcode/v10.10.0` must match the built version and source. +7. After verifying each successful package/version, record publication state, + source SHA, hashes, and URLs. Update the version baseline through a reviewed + state change; a partial failure must preserve completed records and keep + remaining candidates pending. A state-only commit must not cause new uploads. + +Do not attach a generic `uv publish dist/*` to every push. Do not run all legacy +`deploy.sh` scripts after any monorepo merge. Branch protection and release +workflow permissions will be configured with the migrated packages and their +existing PyPI ownership. No production publisher is enabled in this preparation. + +## Metapackage and image + +Register the `openvax` metapackage like any other distribution when implemented. +Changing its component pins requires its own version bump. Publishing a library +alone does not update the metapackage automatically. + +Images are keyed by a released stack version plus an image revision. A base-OS +or runtime-lock update can produce a new image revision without republishing +Python packages. The image pipeline must use verified released artifacts and +record immutable digests. See [combined artifacts](../docs/distribution.md). diff --git a/releases/packages.json b/releases/packages.json new file mode 100644 index 0000000..2986067 --- /dev/null +++ b/releases/packages.json @@ -0,0 +1,4 @@ +{ + "schema_version": 1, + "packages": [] +} diff --git a/releases/published.json b/releases/published.json new file mode 100644 index 0000000..98a2bea --- /dev/null +++ b/releases/published.json @@ -0,0 +1,4 @@ +{ + "schema_version": 1, + "packages": {} +} diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..3acd8e6 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +packaging>=25.0,<27 diff --git a/scripts/release_plan.py b/scripts/release_plan.py new file mode 100644 index 0000000..fa5b1d6 --- /dev/null +++ b/scripts/release_plan.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 +"""Plan version-gated releases. Never build, upload, or change release state.""" + +import argparse +import ast +import json +from pathlib import Path +import sys +import tomllib + +from packaging.utils import canonicalize_name +from packaging.version import Version + + +def load_manifest(path): + data = json.loads(path.read_text()) + if not isinstance(data, dict) or data.get("schema_version") != 1: + raise ValueError(f"Unsupported manifest schema: {path}") + return data["packages"] + + +def contained_path(root, relative): + if not isinstance(relative, str) or Path(relative).is_absolute(): + raise ValueError(f"Expected relative path: {relative!r}") + path = (root / relative).resolve() + if not path.is_relative_to(root.resolve()): + raise ValueError(f"Path escapes its package or repository: {relative}") + return path + + +def stable_version(value): + if not isinstance(value, str): + raise ValueError("Versions must be strings") + version = Version(value) + if version.is_prerelease or version.is_devrelease or version.local is not None: + raise ValueError(f"Expected a stable public version: {value}") + return version + + +def package_version(root, entry, name): + package = contained_path(root, entry["path"]) + source = entry.get("version_file") + if source is None: + metadata = tomllib.loads((package / "pyproject.toml").read_text())["project"] + if canonicalize_name(metadata["name"], validate=True) != name: + raise ValueError(f"Project name does not match registry: {name}") + return stable_version(metadata["version"]) + source = contained_path(package, source) + variable = entry.get("version_variable", "__version__") + values = [] + for node in ast.parse(source.read_text()).body: + targets = node.targets if isinstance(node, ast.Assign) else ( + [node.target] if isinstance(node, ast.AnnAssign) else [] + ) + if any(isinstance(target, ast.Name) and target.id == variable for target in targets): + values.append(ast.literal_eval(node.value)) + if len(values) != 1: + raise ValueError(f"Expected one literal {variable} assignment in {source}") + return stable_version(values[0]) + + +def plan(root): + entries = load_manifest(root / "releases/packages.json") + published = load_manifest(root / "releases/published.json") + if not isinstance(entries, list) or not isinstance(published, dict): + raise ValueError("Expected a package list and a published-version mapping") + known = {} + for name, version in published.items(): + normalized = canonicalize_name(name, validate=True) + if normalized in known: + raise ValueError(f"Duplicate published package: {normalized}") + known[normalized] = stable_version(version) + result = {"publish": [], "skip": []} + seen = set() + for entry in entries: + name = canonicalize_name(entry["name"], validate=True) + if name in seen: + raise ValueError(f"Duplicate package registration: {name}") + seen.add(name) + current = package_version(root, entry, name) + previous = known.get(name) + if previous is None and entry.get("first_release") is not True: + raise ValueError(f"{name}: seed published version or explicitly set first_release") + if previous is not None and current < previous: + raise ValueError(f"{name}: version decreased from {previous} to {current}") + if previous is not None and current == previous: + result["skip"].append({"name": name, "version": str(current), "reason": "unchanged version"}) + else: + result["publish"].append({ + "name": name, + "path": entry["path"], + "version": str(current), + "previous_version": str(previous) if previous is not None else None, + }) + if set(known) - seen: + raise ValueError("Published packages removed from registry; reconcile retirement explicitly") + for rows in result.values(): + rows.sort(key=lambda row: row["name"]) + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parents[1]) + args = parser.parse_args() + try: + result = plan(args.root.resolve()) + except (ValueError, TypeError, KeyError, OSError, SyntaxError) as error: + print(f"Release planning failed: {error}", file=sys.stderr) + return 1 + print(json.dumps(result, indent=2)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/test_release_plan.py b/tests/test_release_plan.py new file mode 100644 index 0000000..f518138 --- /dev/null +++ b/tests/test_release_plan.py @@ -0,0 +1,110 @@ +import json +from pathlib import Path +import tempfile +import unittest + +from scripts.release_plan import plan + + +class ReleasePlanTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory() + self.addCleanup(self.temp.cleanup) + self.root = Path(self.temp.name) + (self.root / "releases").mkdir() + + def write(self, entries, published): + for file, packages in [("packages", entries), ("published", published)]: + (self.root / f"releases/{file}.json").write_text(json.dumps({ + "schema_version": 1, "packages": packages, + })) + + def package(self, name, version): + directory = self.root / "packages" / name + directory.mkdir(parents=True, exist_ok=True) + (directory / "pyproject.toml").write_text( + f'[project]\nname = "{name}"\nversion = "{version}"\n' + ) + return {"name": name, "path": f"packages/{name}"} + + def test_empty_registry_does_nothing(self): + self.write([], {}) + self.assertEqual(plan(self.root), {"publish": [], "skip": []}) + + def test_only_increased_package_is_selected(self): + self.write([self.package("producer", "1.2.1"), self.package("consumer", "4.0")], + {"producer": "1.2.0", "consumer": "4.0.0"}) + result = plan(self.root) + self.assertEqual([p["name"] for p in result["publish"]], ["producer"]) + self.assertEqual([p["name"] for p in result["skip"]], ["consumer"]) + + def test_docs_change_and_repeated_planning_do_not_release_unchanged_package(self): + self.write([self.package("example", "1.0")], {"example": "1.0"}) + (self.root / "README.md").write_text("Updated docs") + for _ in range(2): + self.assertEqual(plan(self.root)["publish"], []) + + def test_pending_bump_survives_later_commits_until_published_state_advances(self): + entry = self.package("example", "1.1") + self.write([entry], {"example": "1.0"}) + self.assertEqual(len(plan(self.root)["publish"]), 1) + (self.root / "README.md").write_text("Later docs change") + self.assertEqual(len(plan(self.root)["publish"]), 1) + self.write([entry], {"example": "1.1"}) + self.assertEqual(plan(self.root)["publish"], []) + + def test_unknown_existing_package_requires_baseline(self): + self.write([self.package("example", "1.0")], {}) + with self.assertRaisesRegex(ValueError, "seed published version"): + plan(self.root) + + def test_intentional_first_release(self): + entry = self.package("example", "0.1.0") + entry["first_release"] = True + self.write([entry], {}) + self.assertEqual(plan(self.root)["publish"][0]["previous_version"], None) + + def test_downgrade_and_nonstable_versions_rejected(self): + for version in ["0.9", "1.1rc1", "1.1.dev1", "1.1+local"]: + with self.subTest(version=version): + self.write([self.package("example", version)], {"example": "1.0"}) + with self.assertRaises(ValueError): + plan(self.root) + + def test_dynamic_version_read_without_executing_module(self): + entry = self.package("example", "1.0") + entry["version_file"] = "version.py" + (self.root / entry["path"] / "version.py").write_text( + 'raise RuntimeError("must not execute")\n__version__ = "1.1"\n' + ) + self.write([entry], {"example": "1.0"}) + self.assertEqual(plan(self.root)["publish"][0]["version"], "1.1") + + def test_duplicate_normalized_name_rejected(self): + self.write([self.package("my-lib", "1.0"), self.package("my_lib", "1.0")], + {"my-lib": "1.0"}) + with self.assertRaisesRegex(ValueError, "Duplicate package"): + plan(self.root) + + def test_path_escape_rejected(self): + entry = self.package("example", "1.0") + entry["path"] = "../outside" + self.write([entry], {"example": "1.0"}) + with self.assertRaisesRegex(ValueError, "escapes"): + plan(self.root) + + def test_source_name_mismatch_rejected(self): + entry = self.package("example", "1.0") + entry["name"] = "wrong" + self.write([entry], {"wrong": "1.0"}) + with self.assertRaisesRegex(ValueError, "does not match"): + plan(self.root) + + def test_removal_requires_explicit_reconciliation(self): + self.write([], {"example": "1.0"}) + with self.assertRaisesRegex(ValueError, "removed"): + plan(self.root) + + +if __name__ == "__main__": + unittest.main()