You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
33
33
- Implement `Send + Sync` for `PyErr`. `PyErr::new`, `PyErr::from_type`, `PyException::py_err` and `PyException::into` have had these bounds added to their arguments. [#1067](https://github.com/PyO3/pyo3/pull/1067)
34
34
- Change `#[pyproto]` to return NotImplemented for operators for which Python can try a reversed operation. #[1072](https://github.com/PyO3/pyo3/pull/1072)
35
35
-`PyModule::add` now uses `IntoPy<PyObject>` instead of `ToPyObject`. #[1124](https://github.com/PyO3/pyo3/pull/1124)
36
+
- Add nested modules as `&PyModule` instead of using the wrapper generated by `#[pymodule]`. [#1143](https://github.com/PyO3/pyo3/pull/1143)
The `#[pymodule]` procedural macro attribute takes care of exporting the initialization function of your module to Python. It can take as an argument the name of your module, which must be the name of the `.so` or `.pyd` file; the default is the Rust function's name.
35
+
The `#[pymodule]` procedural macro attribute takes care of exporting the initialization function of your
36
+
module to Python. It can take as an argument the name of your module, which must be the name of the `.so`
37
+
or `.pyd` file; the default is the Rust function's name.
36
38
37
-
If the name of the module (the default being the function name) does not match the name of the `.so` or `.pyd` file, you will get an import error in Python with the following message:
39
+
If the name of the module (the default being the function name) does not match the name of the `.so` or
40
+
`.pyd` file, you will get an import error in Python with the following message:
38
41
`ImportError: dynamic module does not define module export function (PyInit_name_of_your_module)`
39
42
40
-
To import the module, either copy the shared library as described in [the README](https://github.com/PyO3/pyo3) or use a tool, e.g. `maturin develop` with [maturin](https://github.com/PyO3/maturin) or `python setup.py develop` with [setuptools-rust](https://github.com/PyO3/setuptools-rust).
43
+
To import the module, either copy the shared library as described in [the README](https://github.com/PyO3/pyo3)
44
+
or use a tool, e.g. `maturin develop` with [maturin](https://github.com/PyO3/maturin) or
45
+
`python setup.py develop` with [setuptools-rust](https://github.com/PyO3/setuptools-rust).
41
46
42
47
## Documentation
43
48
44
-
The [Rust doc comments](https://doc.rust-lang.org/stable/book/first-edition/comments.html) of the module initialization function will be applied automatically as the Python docstring of your module.
49
+
The [Rust doc comments](https://doc.rust-lang.org/stable/book/first-edition/comments.html) of the module
50
+
initialization function will be applied automatically as the Python docstring of your module.
45
51
46
52
```python
47
53
import rust2py
@@ -53,7 +59,8 @@ Which means that the above Python code will print `This module is implemented in
53
59
54
60
## Modules as objects
55
61
56
-
In Python, modules are first class objects. This means that you can store them as values or add them to dicts or other modules:
62
+
In Python, modules are first class objects. This means that you can store them as values or add them to
0 commit comments