diff --git a/.cookiecutter.json b/.cookiecutter.json index d694f06..d97dce2 100644 --- a/.cookiecutter.json +++ b/.cookiecutter.json @@ -1,5 +1,5 @@ { - "_commit": "b36862f08dac62022ba33f94c31be4bac4181340", + "_commit": "a2d5945a169185d37abe3b1eaad1871ece5d9eec", "_max_python_version_minor_int": 14, "_min_python_version_minor_int": 10, "_template": "C:\\Users\\56kyl\\source\\repos\\cookiecutter-robust-python", diff --git a/.cruft.json b/.cruft.json index 6a62f59..cd9dd7c 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "C:\\Users\\56kyl\\source\\repos\\cookiecutter-robust-python", - "commit": "b36862f08dac62022ba33f94c31be4bac4181340", + "commit": "a2d5945a169185d37abe3b1eaad1871ece5d9eec", "checkout": null, "context": { "cookiecutter": { @@ -20,7 +20,7 @@ "license": "MIT", "development_status": "Development Status :: 1 - Planning", "_template": "C:\\Users\\56kyl\\source\\repos\\cookiecutter-robust-python", - "_commit": "b36862f08dac62022ba33f94c31be4bac4181340", + "_commit": "a2d5945a169185d37abe3b1eaad1871ece5d9eec", "_min_python_version_minor_int": 10, "_max_python_version_minor_int": 14, "python_versions": [ diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index c0f80c0..a5c3457 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -12,7 +12,7 @@ on: - "pyproject.toml" - ".github/workflows/build-docs.yml" - ".ruff.toml" # Affects docstrings via linting - - "pyrightconfig.json" # Affects type hints in docs + - "pyrightconfig.json" # Basedpyright config - affects type hints in docs push: branches: diff --git a/.gitignore b/.gitignore index 9fced39..046acd4 100644 --- a/.gitignore +++ b/.gitignore @@ -56,8 +56,9 @@ Thumbs.db # Windows thumbnail cache # MyPy cache (if used standalone or by IDE) .mypy_cache/ -# Pyright cache +# Pyright/Basedpyright cache .pyright/ +.basedpyright/ # Ruff cache .ruff_cache/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f2607f4..e2d1e44 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,7 +4,7 @@ "ms-python.python", "ms-python.vscode-pylance", "charliermarsh.ruff", - "ms-pyright.pyright", + "detachhead.basedpyright", // Git + pre-commit workflow "ryanluker.vscode-pre-commit", diff --git a/.vscode/settings.json b/.vscode/settings.json index 8882727..97ac959 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,7 @@ "ruff.args": ["--config", "${workspaceFolder}/.ruff.toml"], "python.linting.enabled": true, "python.linting.ruffEnabled": true, - // Pyright + // Basedpyright "python.analysis.typeCheckingMode": "basic", // Pytest diff --git a/CHANGELOG.md b/CHANGELOG.md index af10fb9..932587c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## v0.10.0 (2025-11-24) + ## v0.9.0 (2025-11-17) ## v0.8.0 (2025-11-17) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77f207c..2b0d54b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -121,7 +121,7 @@ This project follows these standards: - **Code formatting:** [Ruff][ruff-documentation] (automatically applied by pre-commit) - **Linting:** Ruff with comprehensive rule set -- **Type checking:** [Pyright][pyright-documentation] +- **Type checking:** [Basedpyright][basedpyright-documentation] - **Security:** [Bandit][bandit-documentation] for security linting - **Commit messages:** [Conventional Commits][conventional-commits] format preferred - **Testing:** [pytest][pytest-documentation] with good coverage @@ -168,7 +168,7 @@ Common Nox sessions for development: # Code quality uvx nox -s format-python # Format with Ruff uvx nox -s lint-python # Lint with Ruff -uvx nox -s typecheck # Type check with Pyright +uvx nox -s typecheck # Type check with Basedpyright uvx nox -s security-python # Security checks # Testing @@ -206,6 +206,7 @@ _This project was generated from the [cookiecutter-robust-python][cookiecutter-r [discussions]: https://github.com/56kyle/robust-maturin-demo/discussions [uv-documentation]: https://docs.astral.sh/uv/ [ruff-documentation]: https://docs.astral.sh/ruff/ +[basedpyright-documentation]: https://github.com/detachhead/basedpyright [pyright-documentation]: https://github.com/microsoft/pyright [bandit-documentation]: https://bandit.readthedocs.io/ [conventional-commits]: https://www.conventionalcommits.org/ diff --git a/noxfile.py b/noxfile.py index 6a5b86a..94df5a6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -14,13 +14,7 @@ nox.options.default_venv_backend = "uv" os.environ.setdefault("PYO3_USE_ABI3_FORWARD_COMPATIBILITY", "1") -# Logic that helps avoid metaprogramming in cookiecutter-robust-python -MIN_PYTHON_VERSION_SLUG: int = int("3.10".lstrip("3.")) -MAX_PYTHON_VERSION_SLUG: int = int("3.14".lstrip("3.")) - -PYTHON_VERSIONS: List[str] = [ - f"3.{VERSION_SLUG}" for VERSION_SLUG in range(MIN_PYTHON_VERSION_SLUG, MAX_PYTHON_VERSION_SLUG + 1) -] +PYTHON_VERSIONS: List[str] = ['3.10', '3.11', '3.12', '3.13', '3.14'] DEFAULT_PYTHON_VERSION: str = PYTHON_VERSIONS[-1] REPO_ROOT: Path = Path(__file__).parent.resolve() @@ -120,11 +114,11 @@ def lint_rust(session: Session) -> None: @nox.session(python=PYTHON_VERSIONS, name="typecheck") def typecheck(session: Session) -> None: - """Run static type checking (Pyright) on Python code.""" + """Run static type checking (Basedpyright) on Python code.""" session.log("Installing type checking dependencies...") session.install("-e", ".", "--group", "dev") - session.log(f"Running Pyright check with py{session.python}.") + session.log(f"Running Basedpyright check with py{session.python}.") session.run("pyright", "--pythonversion", session.python) diff --git a/pyproject.toml b/pyproject.toml index 6c3556f..dfd99fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "robust-maturin-demo" -version = "0.9.0" +version = "0.10.0" description = "robust-maturin-demo" authors = [ { name = "Kyle Oliver", email = "56kyleoliver+cookiecutter-robust-python@gmail.com" }, @@ -41,7 +41,7 @@ dev = [ "pip-audit>=2.9.0", "pytest>=8.3.5", "pytest-cov>=6.1.1", - "pyright>=1.1.400", + "basedpyright>=1.34.0", ] docs = [ "furo>=2024.8.6", @@ -70,3 +70,4 @@ build-backend = "maturin" [tool.maturin] rust-src = "rust" +manifest-path = "rust/Cargo.toml" diff --git a/pyrightconfig.json b/pyrightconfig.json index ba7ffda..45eaad7 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -32,8 +32,10 @@ "reportPropertyTypeMismatch": "warning", "reportReturnTypeFromAnnotation": "warning", "reportMissingReturnType": "warning", - "basic": true, "reportMissingParameterType": "warning", "reportOptionalOperand": "warning", - "pythonVersion": "3.10" + "pythonVersion": "3.10", + + "reportAny": "error", + "reportExplicitAny": "warning" } diff --git a/uv.lock b/uv.lock index 93eed14..d4afab0 100644 --- a/uv.lock +++ b/uv.lock @@ -80,6 +80,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/48/ca/ba5f909b40ea12ec542d5d7bdd13ee31c4d65f3beed20211ef81c18fa1f3/bandit-1.8.6-py3-none-any.whl", hash = "sha256:3348e934d736fcdb68b6aa4030487097e23a501adf3e7827b63658df464dddd0", size = 133808, upload-time = "2025-07-06T03:10:49.134Z" }, ] +[[package]] +name = "basedpyright" +version = "1.34.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nodejs-wheel-binaries" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/77/ded02ba2b400807b291fa2b9d29ac7f473e86a45d1f5212d8276e9029107/basedpyright-1.34.0.tar.gz", hash = "sha256:7ae3b06f644fac15fdd14a00d0d1f12f92a8205ae1609aabd5a0799b1a68be1d", size = 22803348, upload-time = "2025-11-19T14:48:16.38Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/9e/ced31964ed49f06be6197bd530958b6ddca9a079a8d7ee0ee7429cae9e27/basedpyright-1.34.0-py3-none-any.whl", hash = "sha256:e76015c1ebb671d2c6d7fef8a12bc0f1b9d15d74e17847b7b95a3a66e187c70f", size = 11865958, upload-time = "2025-11-19T14:48:13.724Z" }, +] + [[package]] name = "beautifulsoup4" version = "4.13.4" @@ -705,6 +717,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d2/1d/1b658dbd2b9fa9c4c9f32accbfc0205d532c8c6194dc0f2a4c0428e7128a/nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9", size = 22314, upload-time = "2024-06-04T18:44:08.352Z" }, ] +[[package]] +name = "nodejs-wheel-binaries" +version = "24.11.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e4/89/da307731fdbb05a5f640b26de5b8ac0dc463fef059162accfc89e32f73bc/nodejs_wheel_binaries-24.11.1.tar.gz", hash = "sha256:413dfffeadfb91edb4d8256545dea797c237bba9b3faefea973cde92d96bb922", size = 8059, upload-time = "2025-11-18T18:21:58.207Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e4/5f/be5a4112e678143d4c15264d918f9a2dc086905c6426eb44515cf391a958/nodejs_wheel_binaries-24.11.1-py2.py3-none-macosx_13_0_arm64.whl", hash = "sha256:0e14874c3579def458245cdbc3239e37610702b0aa0975c1dc55e2cb80e42102", size = 55114309, upload-time = "2025-11-18T18:21:21.697Z" }, + { url = "https://files.pythonhosted.org/packages/fa/1c/2e9d6af2ea32b65928c42b3e5baa7a306870711d93c3536cb25fc090a80d/nodejs_wheel_binaries-24.11.1-py2.py3-none-macosx_13_0_x86_64.whl", hash = "sha256:c2741525c9874b69b3e5a6d6c9179a6fe484ea0c3d5e7b7c01121c8e5d78b7e2", size = 55285957, upload-time = "2025-11-18T18:21:27.177Z" }, + { url = "https://files.pythonhosted.org/packages/d0/79/35696d7ba41b1bd35ef8682f13d46ba38c826c59e58b86b267458eb53d87/nodejs_wheel_binaries-24.11.1-py2.py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:5ef598101b0fb1c2bf643abb76dfbf6f76f1686198ed17ae46009049ee83c546", size = 59645875, upload-time = "2025-11-18T18:21:33.004Z" }, + { url = "https://files.pythonhosted.org/packages/b4/98/2a9694adee0af72bc602a046b0632a0c89e26586090c558b1c9199b187cc/nodejs_wheel_binaries-24.11.1-py2.py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:cde41d5e4705266688a8d8071debf4f8a6fcea264c61292782672ee75a6905f9", size = 60140941, upload-time = "2025-11-18T18:21:37.228Z" }, + { url = "https://files.pythonhosted.org/packages/d0/d6/573e5e2cba9d934f5f89d0beab00c3315e2e6604eb4df0fcd1d80c5a07a8/nodejs_wheel_binaries-24.11.1-py2.py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:78bc5bb889313b565df8969bb7423849a9c7fc218bf735ff0ce176b56b3e96f0", size = 61644243, upload-time = "2025-11-18T18:21:43.325Z" }, + { url = "https://files.pythonhosted.org/packages/c7/e6/643234d5e94067df8ce8d7bba10f3804106668f7a1050aeb10fdd226ead4/nodejs_wheel_binaries-24.11.1-py2.py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:c79a7e43869ccecab1cae8183778249cceb14ca2de67b5650b223385682c6239", size = 62225657, upload-time = "2025-11-18T18:21:47.708Z" }, + { url = "https://files.pythonhosted.org/packages/4d/1c/2fb05127102a80225cab7a75c0e9edf88a0a1b79f912e1e36c7c1aaa8f4e/nodejs_wheel_binaries-24.11.1-py2.py3-none-win_amd64.whl", hash = "sha256:10197b1c9c04d79403501766f76508b0dac101ab34371ef8a46fcf51773497d0", size = 41322308, upload-time = "2025-11-18T18:21:51.347Z" }, + { url = "https://files.pythonhosted.org/packages/ad/b7/bc0cdbc2cc3a66fcac82c79912e135a0110b37b790a14c477f18e18d90cd/nodejs_wheel_binaries-24.11.1-py2.py3-none-win_arm64.whl", hash = "sha256:376b9ea1c4bc1207878975dfeb604f7aa5668c260c6154dcd2af9d42f7734116", size = 39026497, upload-time = "2025-11-18T18:21:54.634Z" }, +] + [[package]] name = "nox" version = "2025.5.1" @@ -896,19 +924,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/05/e7/df2285f3d08fee213f2d041540fa4fc9ca6c2d44cf36d3a035bf2a8d2bcc/pyparsing-3.2.3-py3-none-any.whl", hash = "sha256:a749938e02d6fd0b59b356ca504a24982314bb090c383e3cf201c95ef7e2bfcf", size = 111120, upload-time = "2025-03-25T05:01:24.908Z" }, ] -[[package]] -name = "pyright" -version = "1.1.403" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "nodeenv" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/fe/f6/35f885264ff08c960b23d1542038d8da86971c5d8c955cfab195a4f672d7/pyright-1.1.403.tar.gz", hash = "sha256:3ab69b9f41c67fb5bbb4d7a36243256f0d549ed3608678d381d5f51863921104", size = 3913526, upload-time = "2025-07-09T07:15:52.882Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/49/b6/b04e5c2f41a5ccad74a1a4759da41adb20b4bc9d59a5e08d29ba60084d07/pyright-1.1.403-py3-none-any.whl", hash = "sha256:c0eeca5aa76cbef3fcc271259bbd785753c7ad7bcac99a9162b4c4c7daed23b3", size = 5684504, upload-time = "2025-07-09T07:15:50.958Z" }, -] - [[package]] name = "pytest" version = "8.4.1" @@ -1027,7 +1042,7 @@ wheels = [ [[package]] name = "robust-maturin-demo" -version = "0.9.0" +version = "0.10.0" source = { editable = "." } dependencies = [ { name = "loguru" }, @@ -1039,12 +1054,12 @@ dependencies = [ [package.dev-dependencies] dev = [ { name = "bandit" }, + { name = "basedpyright" }, { name = "commitizen" }, { name = "nox" }, { name = "pip-audit" }, { name = "pre-commit" }, { name = "pre-commit-hooks" }, - { name = "pyright" }, { name = "pytest" }, { name = "pytest-cov" }, { name = "ruff" }, @@ -1071,12 +1086,12 @@ requires-dist = [ [package.metadata.requires-dev] dev = [ { name = "bandit", specifier = ">=1.8.3" }, + { name = "basedpyright", specifier = ">=1.34.0" }, { name = "commitizen", specifier = ">=4.7.0" }, { name = "nox", specifier = ">=2025.5.1" }, { name = "pip-audit", specifier = ">=2.9.0" }, { name = "pre-commit", specifier = ">=4.2.0" }, { name = "pre-commit-hooks", specifier = ">=5.0.0" }, - { name = "pyright", specifier = ">=1.1.400" }, { name = "pytest", specifier = ">=8.3.5" }, { name = "pytest-cov", specifier = ">=6.1.1" }, { name = "ruff", specifier = ">=0.11.9" },