Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove rust-cpython from project init/new template #2034

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions guide/src/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,16 @@ Options:
--compatibility [<compatibility>...]
Control the platform tag on linux.

Options are `manylinux` tags (for example `manylinux2014`/`manylinux_2_24`) or `musllinux`
tags (for example `musllinux_1_2`) and `linux` for the native linux tag.
Options are `manylinux` tags (for example `manylinux2014`/`manylinux_2_24`) or `musllinux` tags (for example `musllinux_1_2`) and `linux` for the native linux tag.

Note that `manylinux1` and `manylinux2010` is unsupported by the rust compiler. Wheels
with the native `linux` tag will be rejected by pypi, unless they are separately validated
by `auditwheel`.
Note that `manylinux1` and `manylinux2010` is unsupported by the rust compiler. Wheels with the native `linux` tag will be rejected by pypi, unless they are separately validated by `auditwheel`.

The default is the lowest compatible `manylinux` tag, or plain `linux` if nothing matched

This option is ignored on all non-linux platforms

-i, --interpreter [<INTERPRETER>...]
The python versions to build wheels for, given as the executables of interpreters such as
`python3.9` or `/usr/bin/python3.8`
The python versions to build wheels for, given as the executables of interpreters such as `python3.9` or `/usr/bin/python3.8`

-f, --find-interpreter
Find interpreters from the host machine
Expand All @@ -110,8 +106,7 @@ Options:
[possible values: pyo3, pyo3-ffi, rust-cpython, cffi, uniffi, bin]

-o, --out <OUT>
The directory to store the built wheels in. Defaults to a new "wheels" directory in the
project's target directory
The directory to store the built wheels in. Defaults to a new "wheels" directory in the project's target directory

--skip-auditwheel
Don't check for manylinux compliance
Expand Down
6 changes: 4 additions & 2 deletions guide/src/local_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ Options:
--pip-path <PIP_PATH>
Use a specific pip installation instead of the default one.

This can be used to supply the path to a pip executable when the current virtualenv does
not provide one.
This can be used to supply the path to a pip executable when the current virtualenv does not provide one.

-q, --quiet
Do not print cargo log messages
Expand All @@ -58,6 +57,9 @@ Options:
--future-incompat-report
Outputs a future incompatibility report at the end of the build (unstable)

--uv
Use `uv` to install packages instead of `pip`

-h, --help
Print help (see a summary with '-h')

Expand Down
6 changes: 3 additions & 3 deletions src/new_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub struct GenerateProjectOptions {
#[arg(
short,
long,
value_parser = ["pyo3", "rust-cpython", "cffi", "uniffi", "bin"]
value_parser = ["pyo3", "cffi", "uniffi", "bin"]
)]
bindings: Option<String>,
}
Expand Down Expand Up @@ -229,9 +229,9 @@ fn generate_project(
validate_name(temp.as_str()).map_err(|e| anyhow::anyhow!(e))?
};
let bindings_items = if options.mixed {
vec!["pyo3", "rust-cpython", "cffi", "uniffi"]
vec!["pyo3", "cffi", "uniffi"]
} else {
vec!["pyo3", "rust-cpython", "cffi", "uniffi", "bin"]
vec!["pyo3", "cffi", "uniffi", "bin"]
};
let bindings = if let Some(bindings) = options.bindings {
bindings
Expand Down
2 changes: 0 additions & 2 deletions src/templates/Cargo.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ crate-type = ["cdylib"]
[dependencies]
{% if bindings == "pyo3" -%}
pyo3 = "0.21.1"
{% elif bindings == "rust-cpython" -%}
cpython = "0.7.1"
{% elif bindings == "uniffi" -%}
uniffi = "0.27.0"

Expand Down
7 changes: 0 additions & 7 deletions src/templates/lib.rs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ fn {{crate_name}}(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
Ok(())
}
{%- elif bindings == "rust-cpython" -%}
use cpython::py_module_initializer;

py_module_initializer!({{crate_name}}, |py, m| {
m.add(py, "__doc__", "Module documentation string")?;
Ok(())
});
{%- elif bindings == "uniffi" -%}
fn add(a: u32, b: u32) -> u32 {
a + b
Expand Down
4 changes: 1 addition & 3 deletions src/templates/pyproject.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tests = [
]
{% endif -%}

{% if bindings in ["bin", "cffi", "pyo3", "rust-cpython"] or mixed_non_src -%}
{% if bindings in ["bin", "cffi", "pyo3"] or mixed_non_src -%}
[tool.maturin]
{% if bindings == "cffi" or bindings == "bin" -%}
bindings = "{{ bindings }}"
Expand All @@ -31,7 +31,5 @@ python-source = "python"
{% endif -%}
{% if bindings == "pyo3" -%}
features = ["pyo3/extension-module"]
{% elif bindings == "rust-cpython" -%}
features = ["cpython/extension-module"]
{% endif -%}
{% endif -%}
2 changes: 1 addition & 1 deletion test-crates/update_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

FILES = [
"README.md",
"guide/src/develop.md",
"guide/src/local_development.md",
"guide/src/tutorial.md",
"guide/src/distribution.md",
]
Expand Down
4 changes: 2 additions & 2 deletions tests/cmd/init.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Options:
--name <NAME> Set the resulting package name, defaults to the directory name
--mixed Use mixed Rust/Python project layout
--src Use Python first src layout for mixed Rust/Python project
-b, --bindings <BINDINGS> Which kind of bindings to use [possible values: pyo3, rust-cpython,
cffi, uniffi, bin]
-b, --bindings <BINDINGS> Which kind of bindings to use [possible values: pyo3, cffi, uniffi,
bin]
-h, --help Print help
4 changes: 2 additions & 2 deletions tests/cmd/new.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Options:
--name <NAME> Set the resulting package name, defaults to the directory name
--mixed Use mixed Rust/Python project layout
--src Use Python first src layout for mixed Rust/Python project
-b, --bindings <BINDINGS> Which kind of bindings to use [possible values: pyo3, rust-cpython,
cffi, uniffi, bin]
-b, --bindings <BINDINGS> Which kind of bindings to use [possible values: pyo3, cffi, uniffi,
bin]
-h, --help Print help