Skip to content

Commit 68ce6f3

Browse files
authored
Merge pull request #630 from sanders41/version
Add dynamic version to pyo3 projects
2 parents cf89e45 + 45b379a commit 68ce6f3

4 files changed

+5
-3
lines changed

src/project_generator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ authors = [
487487
license = { file = "LICENSE" }
488488
{% endif -%}
489489
readme = "README.md"
490+
dynamic = ["version"]
490491
requires-python = ">={{ min_python_version }}"
491492
dependencies = []
492493
@@ -512,6 +513,7 @@ authors = [{name = "{{ creator }}", email = "{{ creator_email }}"}]
512513
license = "{{ license }}"
513514
{% endif -%}
514515
readme = "README.md"
516+
dynamic = ["version"]
515517
dependencies = []
516518
517519
[tool.maturin]

src/snapshots/python_project__project_generator__tests__save_pyproject_toml_file_apache_pyo3.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ source: src/project_generator.rs
33
expression: content
44
snapshot_kind: text
55
---
6-
"[build-system]\nrequires = [\"maturin>=1.5,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"my-project\"\ndescription = \"This is a test\"\nauthors = [\n { name = \"Arthur Dent\", email = \"[email protected]\" },\n]\nlicense = { file = \"LICENSE\" }\nreadme = \"README.md\"\nrequires-python = \">=3.9\"\ndependencies = []\n\n[dependency-groups]\ndev = [\n \"maturin==1.0.0\",\n \"mypy[faster-cache]==1.0.0\",\n \"pre-commit==1.0.0\",\n \"pytest==1.0.0\",\n \"pytest-cov==1.0.0\",\n \"ruff==1.0.0\",\n]\n\n[tool.maturin]\nmodule-name = \"my_project._my_project\"\nbinding = \"pyo3\"\nfeatures = [\"pyo3/extension-module\"]\n\n[tool.mypy]\ncheck_untyped_defs = true\ndisallow_untyped_defs = true\n\n[[tool.mypy.overrides]]\nmodule = [\"tests.*\"]\ndisallow_untyped_defs = false\n\n[tool.pytest.ini_options]\nminversion = \"6.0\"\naddopts = \"--cov=my_project --cov-report term-missing --no-cov-on-fail\"\n\n[tool.coverage.report]\nexclude_lines = [\"if __name__ == .__main__.:\", \"pragma: no cover\"]\n\n[tool.ruff]\nline-length = 100\ntarget-version = \"py39\"\nfix = true\n\n[tool.ruff.lint]\nselect = [\n \"E\", # pycodestyle\n \"B\", # flake8-bugbear\n \"W\", # Warning\n \"F\", # pyflakes\n \"UP\", # pyupgrade\n \"I001\", # unsorted-imports\n \"T201\", # print found\n \"T203\", # pprint found\n \"RUF022\", # Unsorted __all__\n \"RUF023\", # Unforted __slots__\n]\nignore=[\n # Recommended ignores by ruff when using formatter\n \"E501\",\n \"W191\",\n \"E111\",\n \"E114\",\n \"E117\",\n \"D206\",\n \"D300\",\n \"Q000\",\n \"Q001\",\n \"Q002\",\n \"Q003\",\n \"COM812\",\n \"COM819\",\n \"ISC001\",\n \"ISC002\",\n]\n"
6+
"[build-system]\nrequires = [\"maturin>=1.5,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"my-project\"\ndescription = \"This is a test\"\nauthors = [\n { name = \"Arthur Dent\", email = \"[email protected]\" },\n]\nlicense = { file = \"LICENSE\" }\nreadme = \"README.md\"\ndynamic = [\"version\"]\nrequires-python = \">=3.9\"\ndependencies = []\n\n[dependency-groups]\ndev = [\n \"maturin==1.0.0\",\n \"mypy[faster-cache]==1.0.0\",\n \"pre-commit==1.0.0\",\n \"pytest==1.0.0\",\n \"pytest-cov==1.0.0\",\n \"ruff==1.0.0\",\n]\n\n[tool.maturin]\nmodule-name = \"my_project._my_project\"\nbinding = \"pyo3\"\nfeatures = [\"pyo3/extension-module\"]\n\n[tool.mypy]\ncheck_untyped_defs = true\ndisallow_untyped_defs = true\n\n[[tool.mypy.overrides]]\nmodule = [\"tests.*\"]\ndisallow_untyped_defs = false\n\n[tool.pytest.ini_options]\nminversion = \"6.0\"\naddopts = \"--cov=my_project --cov-report term-missing --no-cov-on-fail\"\n\n[tool.coverage.report]\nexclude_lines = [\"if __name__ == .__main__.:\", \"pragma: no cover\"]\n\n[tool.ruff]\nline-length = 100\ntarget-version = \"py39\"\nfix = true\n\n[tool.ruff.lint]\nselect = [\n \"E\", # pycodestyle\n \"B\", # flake8-bugbear\n \"W\", # Warning\n \"F\", # pyflakes\n \"UP\", # pyupgrade\n \"I001\", # unsorted-imports\n \"T201\", # print found\n \"T203\", # pprint found\n \"RUF022\", # Unsorted __all__\n \"RUF023\", # Unforted __slots__\n]\nignore=[\n # Recommended ignores by ruff when using formatter\n \"E501\",\n \"W191\",\n \"E111\",\n \"E114\",\n \"E117\",\n \"D206\",\n \"D300\",\n \"Q000\",\n \"Q001\",\n \"Q002\",\n \"Q003\",\n \"COM812\",\n \"COM819\",\n \"ISC001\",\n \"ISC002\",\n]\n"

src/snapshots/python_project__project_generator__tests__save_pyproject_toml_file_mit_pyo3.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ source: src/project_generator.rs
33
expression: content
44
snapshot_kind: text
55
---
6-
"[build-system]\nrequires = [\"maturin>=1.5,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"my-project\"\ndescription = \"This is a test\"\nauthors = [\n { name = \"Arthur Dent\", email = \"[email protected]\" },\n]\nlicense = { file = \"LICENSE\" }\nreadme = \"README.md\"\nrequires-python = \">=3.9\"\ndependencies = []\n\n[dependency-groups]\ndev = [\n \"maturin==1.0.0\",\n \"mypy[faster-cache]==1.0.0\",\n \"pre-commit==1.0.0\",\n \"pytest==1.0.0\",\n \"pytest-cov==1.0.0\",\n \"ruff==1.0.0\",\n]\n\n[tool.maturin]\nmodule-name = \"my_project._my_project\"\nbinding = \"pyo3\"\nfeatures = [\"pyo3/extension-module\"]\n\n[tool.mypy]\ncheck_untyped_defs = true\ndisallow_untyped_defs = true\n\n[[tool.mypy.overrides]]\nmodule = [\"tests.*\"]\ndisallow_untyped_defs = false\n\n[tool.pytest.ini_options]\nminversion = \"6.0\"\naddopts = \"--cov=my_project --cov-report term-missing --no-cov-on-fail\"\n\n[tool.coverage.report]\nexclude_lines = [\"if __name__ == .__main__.:\", \"pragma: no cover\"]\n\n[tool.ruff]\nline-length = 100\ntarget-version = \"py39\"\nfix = true\n\n[tool.ruff.lint]\nselect = [\n \"E\", # pycodestyle\n \"B\", # flake8-bugbear\n \"W\", # Warning\n \"F\", # pyflakes\n \"UP\", # pyupgrade\n \"I001\", # unsorted-imports\n \"T201\", # print found\n \"T203\", # pprint found\n \"RUF022\", # Unsorted __all__\n \"RUF023\", # Unforted __slots__\n]\nignore=[\n # Recommended ignores by ruff when using formatter\n \"E501\",\n \"W191\",\n \"E111\",\n \"E114\",\n \"E117\",\n \"D206\",\n \"D300\",\n \"Q000\",\n \"Q001\",\n \"Q002\",\n \"Q003\",\n \"COM812\",\n \"COM819\",\n \"ISC001\",\n \"ISC002\",\n]\n"
6+
"[build-system]\nrequires = [\"maturin>=1.5,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"my-project\"\ndescription = \"This is a test\"\nauthors = [\n { name = \"Arthur Dent\", email = \"[email protected]\" },\n]\nlicense = { file = \"LICENSE\" }\nreadme = \"README.md\"\ndynamic = [\"version\"]\nrequires-python = \">=3.9\"\ndependencies = []\n\n[dependency-groups]\ndev = [\n \"maturin==1.0.0\",\n \"mypy[faster-cache]==1.0.0\",\n \"pre-commit==1.0.0\",\n \"pytest==1.0.0\",\n \"pytest-cov==1.0.0\",\n \"ruff==1.0.0\",\n]\n\n[tool.maturin]\nmodule-name = \"my_project._my_project\"\nbinding = \"pyo3\"\nfeatures = [\"pyo3/extension-module\"]\n\n[tool.mypy]\ncheck_untyped_defs = true\ndisallow_untyped_defs = true\n\n[[tool.mypy.overrides]]\nmodule = [\"tests.*\"]\ndisallow_untyped_defs = false\n\n[tool.pytest.ini_options]\nminversion = \"6.0\"\naddopts = \"--cov=my_project --cov-report term-missing --no-cov-on-fail\"\n\n[tool.coverage.report]\nexclude_lines = [\"if __name__ == .__main__.:\", \"pragma: no cover\"]\n\n[tool.ruff]\nline-length = 100\ntarget-version = \"py39\"\nfix = true\n\n[tool.ruff.lint]\nselect = [\n \"E\", # pycodestyle\n \"B\", # flake8-bugbear\n \"W\", # Warning\n \"F\", # pyflakes\n \"UP\", # pyupgrade\n \"I001\", # unsorted-imports\n \"T201\", # print found\n \"T203\", # pprint found\n \"RUF022\", # Unsorted __all__\n \"RUF023\", # Unforted __slots__\n]\nignore=[\n # Recommended ignores by ruff when using formatter\n \"E501\",\n \"W191\",\n \"E111\",\n \"E114\",\n \"E117\",\n \"D206\",\n \"D300\",\n \"Q000\",\n \"Q001\",\n \"Q002\",\n \"Q003\",\n \"COM812\",\n \"COM819\",\n \"ISC001\",\n \"ISC002\",\n]\n"

src/snapshots/python_project__project_generator__tests__save_pyproject_toml_file_no_license_pyo3.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ source: src/project_generator.rs
33
expression: content
44
snapshot_kind: text
55
---
6-
"[build-system]\nrequires = [\"maturin>=1.5,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"my-project\"\ndescription = \"This is a test\"\nauthors = [\n { name = \"Arthur Dent\", email = \"[email protected]\" },\n]\nreadme = \"README.md\"\nrequires-python = \">=3.9\"\ndependencies = []\n\n[dependency-groups]\ndev = [\n \"maturin==1.0.0\",\n \"mypy[faster-cache]==1.0.0\",\n \"pre-commit==1.0.0\",\n \"pytest==1.0.0\",\n \"pytest-cov==1.0.0\",\n \"ruff==1.0.0\",\n]\n\n[tool.maturin]\nmodule-name = \"my_project._my_project\"\nbinding = \"pyo3\"\nfeatures = [\"pyo3/extension-module\"]\n\n[tool.mypy]\ncheck_untyped_defs = true\ndisallow_untyped_defs = true\n\n[[tool.mypy.overrides]]\nmodule = [\"tests.*\"]\ndisallow_untyped_defs = false\n\n[tool.pytest.ini_options]\nminversion = \"6.0\"\naddopts = \"--cov=my_project --cov-report term-missing --no-cov-on-fail\"\n\n[tool.coverage.report]\nexclude_lines = [\"if __name__ == .__main__.:\", \"pragma: no cover\"]\n\n[tool.ruff]\nline-length = 100\ntarget-version = \"py39\"\nfix = true\n\n[tool.ruff.lint]\nselect = [\n \"E\", # pycodestyle\n \"B\", # flake8-bugbear\n \"W\", # Warning\n \"F\", # pyflakes\n \"UP\", # pyupgrade\n \"I001\", # unsorted-imports\n \"T201\", # print found\n \"T203\", # pprint found\n \"RUF022\", # Unsorted __all__\n \"RUF023\", # Unforted __slots__\n]\nignore=[\n # Recommended ignores by ruff when using formatter\n \"E501\",\n \"W191\",\n \"E111\",\n \"E114\",\n \"E117\",\n \"D206\",\n \"D300\",\n \"Q000\",\n \"Q001\",\n \"Q002\",\n \"Q003\",\n \"COM812\",\n \"COM819\",\n \"ISC001\",\n \"ISC002\",\n]\n"
6+
"[build-system]\nrequires = [\"maturin>=1.5,<2.0\"]\nbuild-backend = \"maturin\"\n\n[project]\nname = \"my-project\"\ndescription = \"This is a test\"\nauthors = [\n { name = \"Arthur Dent\", email = \"[email protected]\" },\n]\nreadme = \"README.md\"\ndynamic = [\"version\"]\nrequires-python = \">=3.9\"\ndependencies = []\n\n[dependency-groups]\ndev = [\n \"maturin==1.0.0\",\n \"mypy[faster-cache]==1.0.0\",\n \"pre-commit==1.0.0\",\n \"pytest==1.0.0\",\n \"pytest-cov==1.0.0\",\n \"ruff==1.0.0\",\n]\n\n[tool.maturin]\nmodule-name = \"my_project._my_project\"\nbinding = \"pyo3\"\nfeatures = [\"pyo3/extension-module\"]\n\n[tool.mypy]\ncheck_untyped_defs = true\ndisallow_untyped_defs = true\n\n[[tool.mypy.overrides]]\nmodule = [\"tests.*\"]\ndisallow_untyped_defs = false\n\n[tool.pytest.ini_options]\nminversion = \"6.0\"\naddopts = \"--cov=my_project --cov-report term-missing --no-cov-on-fail\"\n\n[tool.coverage.report]\nexclude_lines = [\"if __name__ == .__main__.:\", \"pragma: no cover\"]\n\n[tool.ruff]\nline-length = 100\ntarget-version = \"py39\"\nfix = true\n\n[tool.ruff.lint]\nselect = [\n \"E\", # pycodestyle\n \"B\", # flake8-bugbear\n \"W\", # Warning\n \"F\", # pyflakes\n \"UP\", # pyupgrade\n \"I001\", # unsorted-imports\n \"T201\", # print found\n \"T203\", # pprint found\n \"RUF022\", # Unsorted __all__\n \"RUF023\", # Unforted __slots__\n]\nignore=[\n # Recommended ignores by ruff when using formatter\n \"E501\",\n \"W191\",\n \"E111\",\n \"E114\",\n \"E117\",\n \"D206\",\n \"D300\",\n \"Q000\",\n \"Q001\",\n \"Q002\",\n \"Q003\",\n \"COM812\",\n \"COM819\",\n \"ISC001\",\n \"ISC002\",\n]\n"

0 commit comments

Comments
 (0)