diff --git a/docs/pages/guides/packaging_compiled.md b/docs/pages/guides/packaging_compiled.md index 3e508391..d270c3f9 100644 --- a/docs/pages/guides/packaging_compiled.md +++ b/docs/pages/guides/packaging_compiled.md @@ -189,16 +189,11 @@ name = "_core" # "cdylib" is necessary to produce a shared library for Python to import from. crate-type = ["cdylib"] -[package.metadata.maturin] -name = "package._core" -python-packages = ["package"] -python-source = "src" - [dependencies] rand = "0.8.3" [dependencies.pyo3] -version = "0.18.1" +version = "0.19.1" # "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so) # "abi3-py38" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.8 features = ["extension-module", "abi3-py38"] diff --git a/{{cookiecutter.project_name}}/pyproject.toml b/{{cookiecutter.project_name}}/pyproject.toml index 284303f6..a99fd15d 100644 --- a/{{cookiecutter.project_name}}/pyproject.toml +++ b/{{cookiecutter.project_name}}/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "whey" requires = ["pdm-backend"] build-backend = "pdm.backend" {%- elif cookiecutter.backend == "maturin" %} -requires = ["maturin>=0.12,<0.15"] +requires = ["maturin>=0.15,<2"] build-backend = "maturin" {%- elif cookiecutter.backend == "hatch" %} requires = ["hatchling"] @@ -15,7 +15,7 @@ build-backend = "hatchling.build" requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" {%- elif cookiecutter.backend == "flit" %} -requires = ["flit_core >=3.4"] +requires = ["flit_core>=3.4"] build-backend = "flit_core.buildapi" {%- elif cookiecutter.backend == "setuptools" %} requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4"] @@ -199,6 +199,15 @@ build-dir = "build/{wheel_tag}" [tool.whey] source-dir = "src" +{%- elif cookiecutter.backend == "maturin" %} + + +[tool.maturin] +module-name = "{{ cookiecutter.__project_slug }}._core" +python-packages = ["{{ cookiecutter.__project_slug }}"] +python-source = "src" +sdist-generator = "git" # default is cargo + {%- elif cookiecutter.backend == "hatch" %} diff --git a/{{cookiecutter.project_name}}/{% if cookiecutter.backend=='maturin' %}Cargo.toml{% endif %} b/{{cookiecutter.project_name}}/{% if cookiecutter.backend=='maturin' %}Cargo.toml{% endif %} index cea5b9b2..92df8bb3 100644 --- a/{{cookiecutter.project_name}}/{% if cookiecutter.backend=='maturin' %}Cargo.toml{% endif %} +++ b/{{cookiecutter.project_name}}/{% if cookiecutter.backend=='maturin' %}Cargo.toml{% endif %} @@ -8,16 +8,11 @@ name = "_core" # "cdylib" is necessary to produce a shared library for Python to import from. crate-type = ["cdylib"] -[package.metadata.maturin] -name = "{{ cookiecutter.__project_slug }}._core" -python-packages = ["{{ cookiecutter.__project_slug }}"] -python-source = "src" - [dependencies] rand = "0.8.3" [dependencies.pyo3] -version = "0.18.1" +version = "0.19.1" # "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so) # "abi3-py38" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.8 features = ["extension-module", "abi3-py38"]