From eb929c3f38a47daeaaf6c0178b5abc3b83f9ba27 Mon Sep 17 00:00:00 2001 From: gautam8387 Date: Tue, 11 Aug 2026 15:48:29 +0200 Subject: [PATCH 1/2] package versioning; wip --- .github/workflows/publish.yml | 14 +++++++------- .github/workflows/pytest.yml | 2 ++ .gitignore | 1 + cytetype/__init__.py | 3 +-- pyproject.toml | 14 ++++++++++---- tests/test_cli.py | 5 +++++ 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b2fbbab..3525a82 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,17 +17,17 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 with: - python-version: "3.x" # Use a recent stable version + ref: ${{ github.event.release.tag_name }} + fetch-depth: 0 - - name: Install build dependencies - run: python -m pip install build --user + - name: Set up uv + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.12" - name: Build package - run: python -m build + run: uv build --clear - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b3adf8c..b48556e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 diff --git a/.gitignore b/.gitignore index af49d6e..eb274c0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ build/ dist/ wheels/ *.egg-info +cytetype/_version.py .venv *.env diff --git a/cytetype/__init__.py b/cytetype/__init__.py index edd4240..6718fe9 100644 --- a/cytetype/__init__.py +++ b/cytetype/__init__.py @@ -1,7 +1,6 @@ -__version__ = "0.19.5" - import requests +from ._version import __version__ from .config import logger from .main import CyteType from .plotting import marker_dotplot diff --git a/pyproject.toml b/pyproject.toml index b817fa5..fb6bcb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ dev = [ ] [build-system] -requires = ["setuptools>=80.9.0", "wheel"] +requires = ["setuptools>=80.9.0", "setuptools-scm>=8", "wheel"] build-backend = "setuptools.build_meta" [tool.setuptools] @@ -52,8 +52,14 @@ packages = {find = {}} [tool.setuptools.package-data] cytetype = ["templates/*.html"] -[tool.setuptools.dynamic] -version = {attr = "cytetype.__version__"} +[tool.setuptools_scm] +version_file = "cytetype/_version.py" + +[tool.uv] +cache-keys = [ + { file = "pyproject.toml" }, + { git = { commit = true, tags = true } }, +] [tool.mypy] strict = false @@ -76,4 +82,4 @@ warn_unused_ignores = true ignore_missing_imports = false -exclude = ["^build/", "^dist/", "^.*\\.egg-info/"] +exclude = ["^build/", "^dist/", "^.*\\.egg-info/", "^cytetype/_version\\.py$"] diff --git a/tests/test_cli.py b/tests/test_cli.py index 5da0f6b..04990d7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,6 +1,7 @@ import os import stat import threading +from importlib.metadata import version as distribution_version from pathlib import Path from types import SimpleNamespace from urllib.error import HTTPError @@ -34,6 +35,10 @@ def credentials() -> StoredCredentials: ) +def test_public_version_matches_distribution_metadata() -> None: + assert cli.__version__ == distribution_version("cytetype") + + def test_credentials_round_trip_is_private_and_server_specific( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, From 09c49b50c9d4c30551835921c69c3420f9d61b4b Mon Sep 17 00:00:00 2001 From: gautam8387 Date: Tue, 11 Aug 2026 16:35:59 +0200 Subject: [PATCH 2/2] wip --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index af3a3ae..7781e72 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ For Seurat workflows, use [CyteTypeR](https://github.com/NygenAnalytics/CyteTypeR). > [!IMPORTANT] +> Already installed CyteType? Open a terminal and run `pip install -U cytetype` to update to the latest version before you start. +> > CyteType requires an API key. Use is free for academic and non-commercial research. Commercial use requires a [license](#license). ## Quick Start