David Hewitt
8e8b484169
add #[pyo3(signature = (...))]
attribute ( #2702 )
2022-10-25 07:23:21 +01:00
David Hewitt
78ba70d2b4
pymodule: only allow initializing once per process
2022-08-09 19:52:25 +01:00
mejrs
984fdf57c7
Use Python:;with_gil in tests
2022-07-19 19:34:23 +02:00
mejrs
6f1cf1b662
Add more lints
2022-03-23 08:07:28 +01:00
David Hewitt
ddf13ea98f
clippy: enable some more lints
2022-03-03 07:23:28 +00:00
David Hewitt
ff37f24625
macros: accept paths in wrap_x macros
2021-12-30 12:46:57 +00:00
David Hewitt
6433d884fc
dev: remove self dev dependency
2021-12-08 07:48:58 +00:00
David Hewitt
c9a4cd1f87
deprecations: remove items deprecated in PyO3 0.14
2021-11-19 16:33:29 +00:00
David Hewitt
d11943ab6d
macros-backend: don't error on #[doc(hidden)]
2021-07-08 23:41:24 +01:00
messense
b5b9a480cd
Add wrap_pyfunction
macro to prelude
2021-06-24 22:34:55 +08:00
David Hewitt
18e0aa17e0
pymodule: accept #[pyo3(name = "...")]
option
2021-06-06 08:41:20 +01:00
David Hewitt
9b8b133905
pyfunction: document #[pyo3(pass_module)]
2021-06-05 17:36:50 +01:00
David Hewitt
a109640850
pyfn: deprecate name argument
2021-05-20 08:54:29 +01:00
David Hewitt
4d46abde73
macros: support #[pyo3(name = "...")]
2021-05-07 22:35:52 +01:00
messense
acd4601d2f
Remove __doc__ from module's __all__
2021-03-20 11:25:36 +08:00
Yuji Kanagawa
acf7271879
Merge pull request #1494 from PyO3/enhance-py-run
...
Extend py_run! to take locals dict and refactor tests using it
2021-03-17 12:52:33 +09:00
kngwyu
9b88a452e2
Refactor tests to use shorter macros
2021-03-14 23:43:53 +09:00
David Hewitt
b10cefdca2
pymodule: remove call_function etc.
2021-03-14 11:19:55 +00:00
David Hewitt
b2675b11fe
rust 1.50: clippy and lint fixes
2021-02-11 22:03:34 +00:00
Sebastian Pütz
22881a3c2f
Change add_function, ensure static docstrings.
...
Change add_function to take `&PyCFunction` instead of a wrapper
fn and ensure that dostrings of functions are `&'static str`.
2020-09-09 12:37:37 +02:00
Sebastian Pütz
64b06ea9ec
Change add_submodule()
to take &PyModule
.
...
The C-exported wrapper generated through `#[pymodule]` is only
required for the top-level module.
2020-09-05 15:54:57 +02:00
Sebastian Pütz
e65b849ab6
Doc fixes, changelog and rename.
2020-09-05 10:20:22 +02:00
Sebastian Pütz
795c054511
Possible to pass PyModule as first arg.
...
This commit makes it possible to access the module of a function
by passing the `need_module` argument to the pyfn and pyfunction
macros.
2020-09-04 09:01:21 +02:00
Sebastian Pütz
3214249010
Make python function wrapper creation fallible.
...
Wrapping a function can fail if we can't get the module name.
Based on suggestion by @kngwyu
2020-09-03 15:48:32 +02:00
Sebastian Pütz
5bbca1a052
Set the module of #[pyfunction]
s.
...
Previously neither the module nor the name of the module of
pyfunctions were registered. This commit passes the module and
its name when creating a new pyfunction.
PyModule::add_function and PyModule::add_module have been added and are
set to replace `add_wrapped` in a future release. `add_wrapped` is kept
for compatibility reasons during the transition.
Depending on whether a `PyModule` or `Python` is the argument for the
Python function-wrapper, the module will be registered with the function.
2020-09-03 14:49:28 +02:00
David Hewitt
82cb815afa
Use IntoPy<PyObject> for PyModule::add
2020-08-30 16:24:20 +01:00
David Hewitt
1f37dbc1a7
Various fixes to edge cases with GILGuard
2020-08-06 14:32:59 +01:00
kngwyu
40077245ea
Fix PyModule::dict
2020-03-16 15:45:54 +09:00
kngwyu
e63e0cbf5a
Make it enable to take &PyClass as arguments as pyfunctions/methods
2020-03-04 13:37:26 +09:00
kngwyu
a6fed34e23
Fix clippy warnings in build.rs and tests
2020-02-10 14:53:13 +09:00
Ivan Enderlin
8ed2662251
test: Fix a typo in an error message
...
Thank for the awesome project!
2020-01-24 08:44:23 +01:00
David Hewitt
4b18830f1e
Add #[name]
attribute support for #[pyfunction]
2019-12-17 22:14:28 +00:00
Georg Brandl
ab802cd829
Document and test argument parsing annotations for pyfunctions
2019-06-16 22:13:50 +09:00
kngwyu
0f9a3b1194
Expose py_run macro
2019-06-13 18:18:06 +09:00
Martin Larralde
99fdafbb88
Allow setting the module name for a pyclass ( #499 )
...
* Add `MODULE` const value to `PyTypeInfo` trait
* Allow setting module name in `pyclass` macro arguments
* Add `$module` argument to `pyobject_native_type` macro in `pyo3::types`
* Set the right module for builtin types in `pyo3::types`
* Add `module` argument to example `word_count.WordCounter` class
* Add `module` argument of `pyclass` macro to guide
* Reformat code using `rustfmt`
* Add tests and entry in CHANGELOG.md for `module` argument in `pyclass`
* Make `$module` parameter in `pyobject_native_type` optional
* Make `pyobject_native_type` declare module as `Some("builtins")` by default
2019-06-03 12:18:44 +09:00
ijl
2bb0d05a30
Drop support for python2
2019-03-29 12:37:26 +00:00
konstin
97189a16b9
Try fixing cargo fmt on travis ci
2019-03-24 17:19:15 +01:00
Miles Granger
711155d7ad
Update tests & docs with IntoPyDict::into_py_dict(py)
2019-03-20 20:04:00 +01:00
konstin
6cd07c369c
Simpler new and clippy fixes
2019-02-23 18:38:00 +01:00
konstin
ad590bd158
Some api improvements
2019-02-23 18:01:22 +01:00
konstin
9e53418aad
Less feature(specialization)
2019-02-01 18:09:51 +01:00
konstin
c868cc3e4b
Fix test
2019-02-01 16:31:18 +01:00
konstin
0495ee52d3
ffi2 to rust 2018
2019-02-01 15:25:58 +01:00
konstin
936f0153e8
Migrate to rust 2018
2019-02-01 14:23:29 +01:00
konstin
9c8c5a6063
Rename #[pymodinit] to #[pymodule]
2018-11-15 19:43:29 +01:00
konstin
863ffb161f
Add wrap_module macro
2018-11-15 19:43:29 +01:00
konstin
3a95d163ca
New rustfmt version
...
You might need to upgrade to the latest nightly to get the same results
2018-09-28 23:34:57 +02:00
konstin
302c099a76
Big refactoring to shrink the prelude
2018-09-21 23:34:28 +02:00
konstin
4c1ff24b2b
Fix raw identifiers
2018-09-03 20:50:18 +02:00
konstin
991a8b94d2
More nightly fixes
2018-08-19 20:42:17 +02:00