Georg Brandl
77f5fc107e
guide: better document negative index behavior w.r.t. PySequence
...
Fixes #2601
2022-11-20 08:09:50 +01:00
Georg Brandl
c489809938
Py/PyAny: deprecate cast_as() in favor of downcast()
...
They are (practically) identical on PyAny, and `downcast()` is the more
useful name.
2022-11-18 07:00:40 +01:00
David Hewitt
00fc0358b9
error when `#[pyo3(signature = ())]` used on invalid methods
2022-11-17 08:28:34 +00:00
messense
dee791de90
`pyo3-build-config`: rebuild when `PYO3_ENVIRONMENT_SIGNATURE` value changed
2022-11-09 20:28:18 +08:00
Marc Garcia
47490a7a31
Fix module name in getting started
2022-11-01 14:08:28 +07:00
David Hewitt
8e8b484169
add `#[pyo3(signature = (...))]` attribute ( #2702 )
2022-10-25 07:23:21 +01:00
David Hewitt
446c0e82f0
Merge pull request #2692 from mejrs/all
...
Implement get/set all on pyclass
2022-10-18 21:39:44 +01:00
Georg Brandl
676227d2a1
Make `is_instance()` and `is_subclass()` take `&PyAny` ( #2695 )
2022-10-18 19:22:23 +02:00
mejrs
d254134154
Implement get/set all on pyclass
2022-10-17 02:37:43 +02:00
C. Titus Brown
ca1c9c1dba
update per review
2022-10-16 11:04:15 -07:00
C. Titus Brown
8e6bf1875f
Apply suggestions from code review
...
Co-authored-by: Georg Brandl <georg@python.org>
2022-10-16 11:01:15 -07:00
C. Titus Brown
78e4130762
Update getting_started.md
2022-10-15 20:55:49 -07:00
C. Titus Brown
b265ee7907
Point new users at specific source file for Rust code.
...
This was a minor confusion for me so I thought I'd suggest the change - it was the first place I looked, but I did have to think about it :)
2022-10-15 20:49:24 -07:00
Bruno Kolenbrander
c9b26f57cd
Merge pull request #2657 from mejrs/decorator_fix
...
Update decorator to use Cell counter
2022-10-10 19:55:36 +02:00
mejrs
d8fa6be28a
is
2022-10-04 19:33:02 +02:00
mejrs
e0602b641c
Just use Cell
2022-10-04 19:05:44 +02:00
mejrs
611ea4db49
Update decorator to use atomics
2022-10-04 17:59:46 +02:00
David Hewitt
bd40011e93
release: 0.17.2
2022-10-04 08:13:53 +01:00
David Hewitt
372176630e
guide: doctest function/ subpages
2022-09-27 07:52:14 +01:00
Bruno Kolenbrander
fad5f6a07a
Merge pull request #2639 from mrob95/err-self-typo
...
docs: fixed typo in error_handling.md
2022-09-26 23:16:26 +02:00
smheidrich
2dd3c6c71f
Document needing resolve-config for pyo3 cfgs
2022-09-24 16:18:05 +02:00
smheidrich
a731c2ae60
Fix pyo3-build-config version in docs
2022-09-24 15:50:41 +02:00
Mike Roberts
4275abff0c
docs: fixed typo in error_handling.md
2022-09-24 14:03:13 +01:00
messense
86ce4d1a13
Add git repository and edit urls to user guide ( #2635 )
2022-09-23 00:56:25 +00:00
David Hewitt
c5ba1f0632
pyclass: better error and explanation why lifetimes are disallowed ( #2633 )
...
* pyclass: better error and explanation why lifetimes are disallowed
* extend detail on lifetimes
2022-09-22 11:14:06 +02:00
Federico Dolce
63f7df905d
Add chrono 0.4 integration ( #2612 )
...
Co-authored-by: Ivan Tham <pickfire@riseup.net>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-09-22 09:00:09 +02:00
Ryan Russell
04a7b5f14d
docs: codeblock labels to `rust,ignore` format
...
Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-09-10 11:21:04 -05:00
David Hewitt
5718adeec7
pyproto: remove deprecated feature
2022-09-06 08:38:44 +01:00
David Hewitt
caaf7bbda7
release: 0.17.1
2022-08-28 08:27:56 +01:00
David Hewitt
04c1ac87f1
release: 0.17.0
2022-08-23 21:21:19 +01:00
David Hewitt
f7537909a1
guide: note existence of PyFunction::new_closure
2022-08-23 20:49:14 +01:00
David Hewitt
86a11164e0
guide: note __hash__ can have any integer type up to 64 bits
2022-08-23 20:49:14 +01:00
David Hewitt
c5ecf47890
docs: note `__richcmp__` disables default `__hash__`
2022-08-23 20:49:14 +01:00
David Hewitt
fb05e1d7a7
guide: additional detail on how to handle foreign errors
2022-08-23 20:49:14 +01:00
David Hewitt
580e747521
guide: use sentence case, move function signatures to own section
2022-08-23 20:49:14 +01:00
David Hewitt
af60a359c5
guide: don't use `::pyo3`
2022-08-23 20:49:14 +01:00
David Hewitt
ef8ccc0deb
docs: demonstrate `NotImplemented` in `__richcmp__`
2022-08-23 20:49:14 +01:00
Sergey Kvachonok
97eaa77db8
docs: Update the guide for `python3-dll-a` v0.2.6
...
Bump the minimum `python3-dll-a` dependency version.
Document the implemented workaround for
https://github.com/PyO3/python3-dll-a/issues/28
2022-08-21 14:33:52 +03:00
David Hewitt
d0492b7c72
Merge pull request #2570 from davidhewitt/pyclass-frozen-tidy
...
pyclass: tidy up frozen implementation
2022-08-21 09:35:51 +01:00
David Hewitt
24456f3f41
pyclass: tidy up frozen implementation
2022-08-21 08:21:06 +01:00
David Hewitt
fd8026c7bb
pyclass: add `sequence` option to implement `sq_length`
2022-08-20 07:14:26 +01:00
Ashley Anderson
5d88e1d1c4
Update PyTryFrom for PyMapping and PySequence to more accurately check types ( #2477 )
...
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-08-10 21:03:18 +01:00
David Hewitt
78ba70d2b4
pymodule: only allow initializing once per process
2022-08-09 19:52:25 +01:00
Nathan Henrie
1ebceb4f86
Additional link args and troubleshooting for MacOS
...
Fixes https://github.com/PyO3/pyo3/issues/1800
Documents issues linking with the system python (`/usr/bin/python3`) as
well as reemphasizes the need for `--no-default-features` with `cargo
test` on MacOS
2022-08-02 16:52:53 -06:00
Sam Vente
6503128442
add first version of getting started page to the guide ( #2499 )
...
* add first version of getting started page to the guide
* add more info on maturin
2022-08-01 10:30:53 +08:00
Acshi Haggenmiller
6831b4875b
Add documentation for more workarounds for enabling the extension-module feature
...
Closes https://github.com/PyO3/pyo3/issues/2521
2022-07-29 00:03:51 -07:00
Jonas Pleyer
9d081e76a4
guide: python_from_rust: fix typo for call0
2022-07-25 12:36:51 -04:00
David Hewitt
209c942277
pyfunction: use extract_argument with holder to avoid extractext
2022-07-14 08:42:22 +01:00
David Hewitt
0391b3b0c1
inventory: update to 0.3
2022-07-03 15:22:25 +01:00
Bruno Kolenbrander
8babae655e
Merge pull request #2468 from mejrs/frozen
...
Add frozen documentation
2022-06-30 14:45:45 +02:00
mejrs
a62930bd95
Fix duplication
2022-06-28 19:53:45 +02:00
David Hewitt
4da9c3a55f
llvm-lines: use iterator to collect class items
2022-06-25 22:03:28 +01:00
David Hewitt
510c126f57
Merge pull request #2457 from yodaldevoid/enum_naming_improvements
...
Enum naming improvements
2022-06-22 22:12:06 +01:00
Gabriel Smith
845be0486a
guide: Update with enum naming macro changes
2022-06-22 09:36:40 -04:00
mejrs
e4e7e6e51c
Add frozen documentation
2022-06-22 01:47:40 +02:00
Sam Vente
cdb3b6ff32
remove outdated workaround in module documentation ( #2466 )
...
* remove workaround section in module.md that is no longer needed after merging #2081
* update changelong
* revert CHANGELOG
2022-06-21 21:02:10 +00:00
Georg Brandl
53b83cccbf
add `CompareOp::matches` ( #2460 )
2022-06-21 15:36:20 +02:00
David Hewitt
7725f17c46
pyclass: switch from immutable to frozen
2022-06-19 21:18:15 +01:00
David Hewitt
9dfeaa38d4
guide: add contributing page ( #2442 )
...
Co-authored-by: messense <messense@icloud.com>
2022-06-08 13:30:11 +00:00
David Hewitt
f22a69e223
guide: document platform tag for pypy
2022-06-03 20:10:02 +01:00
David Hewitt
126bf49b8b
Merge pull request #2377 from herquan/herquan_cr1
...
Add macro append_to_inittab (issue #2359 )
2022-05-24 08:02:47 +01:00
herquan
2ec477344d
Add macro append_to_inittab
...
Sometimes we need to debug in a real environment with our module installed. `append_to_inittab` will be a wrapper for PyImport_AppendInittab (https://docs.python.org/3/c-api/import.html#c.PyImport_AppendInittab ) and help us to do this
2022-05-24 07:42:15 +01:00
David Hewitt
0de0e3f8d6
Allow `#[classattr]` methods to be fallible
2022-05-17 21:19:41 +01:00
messense
c477718fe7
Add support for generating non-abi3 python import libraries for Windows
...
targets
2022-05-12 14:32:20 +08:00
Colin Jermain
f5357f9395
Updating debugging docs with more info on rust-gdb ( #2361 )
2022-05-10 07:00:56 +01:00
Bruno Kolenbrander
c57e5098b8
Fix IntoPyCallbackOutput paper cuts ( #2326 )
...
* Implement IntoPy for arrays of IntoPy
* Improve `IntoPyCallbackOutput` compile error
2022-05-09 18:15:43 +01:00
David Hewitt
bc8641c790
Merge pull request #2350 from mejrs/ignore-less
...
Expand on AsPyPointer docs and un-ignore doc examples
2022-05-06 06:51:54 +01:00
mejrs
5bdf6987c3
Delete section about immutability of pyclasses
2022-05-05 22:24:49 +02:00
David Hewitt
5d8fd4d30e
ffi: remove with_thread cfg
2022-05-05 07:26:05 +01:00
mejrs
8921d5d1c0
Fix CI
2022-05-03 11:36:24 +02:00
mejrs
f1e5d4c9a1
Un-ignore and expand on doc examples
2022-05-03 00:47:09 +02:00
Bruno Kolenbrander
dce4377eb4
Allow more methods to take interned arguments ( #2312 )
...
* Allow more methods to take interned arguments
* Changelog
* Unify name bounds
* Resolve merge conflict
* reduce use of py_decref
* Add some attr tests
* Update migration
2022-05-02 11:13:15 +02:00
cuishuang
19e32a0621
fix some typos
...
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-04-24 22:06:32 +08:00
David Hewitt
7e2d3117ce
cleanup: deprecate PyTypeObject trait
2022-04-23 13:36:32 +01:00
David Hewitt
76bc2a6a4a
Merge pull request #2322 from davidhewitt/opt-in-pyproto
...
pyproto: make deprecated feature opt-in
2022-04-23 13:34:21 +01:00
David Hewitt
e9bd41efb2
better mutability inheritance rules
2022-04-21 20:51:28 +01:00
David Hewitt
0787b670e8
pyproto: make deprecated feature opt-in
2022-04-21 20:19:14 +01:00
David Hewitt
7118e94947
Merge branch 'main' into immutable
2022-04-19 19:00:33 +01:00
Sergey Kvachonok
ae7e1f5ee9
pyo3-build-config: Build "abi3" extensions without an interpreter
...
Support compiling portable "abi3" extension modules even when
the build host Python interpreter configuration is not available
or the discovered Python interpreter version is not supported.
Maturin already implements this by building "abi3" extension wheels
with `PYO3_NO_PYTHON` environment veriable set for cargo when
an `abi3-py3*` feature is detected.
Closes #2292
2022-04-13 10:40:08 +03:00
Bruno Kolenbrander
bc6bd6099c
Merge branch 'main' into immutable
2022-04-12 14:22:33 +02:00
Sergey Kvachonok
4347624bd3
Mention `generate-abi3-import-lib` in the features guide
...
Update the feature list section of the user guide
to include `generate-abi3-import-lib` description.
2022-04-11 09:56:52 +03:00
Sergey Kvachonok
a7c0de3628
Document `generate-abi3-import-lib` crate feature
...
Update the user guide to describe its applicability to the native
and cross-compilation build scenarios.
2022-04-10 16:45:32 +03:00
David Hewitt
981eb2d90e
Merge pull request #2265 from davidhewitt/pyclass-mapping
...
pyclass: mapping flag
2022-04-04 19:54:37 +01:00
David Hewitt
9f3ccff8c9
guide: improve documentation for `#[pyclass(mapping)]`
2022-04-04 15:51:01 +01:00
Sergey Kvachonok
80675361f4
pyo3-build-config: Add `PYO3_CROSS_PYTHON_IMPLEMENTATION` env var
...
Adds a new cross-compile target interpreter configuration
environment variable.
This feature allows PyO3 to target PyPy on both Windows and Unix
cross compile targets.
2022-04-04 15:23:11 +03:00
David Hewitt
c16cc35b30
pyclass: mapping flag
2022-04-02 16:15:44 +01:00
mejrs
086424b88c
Merge branch 'main' of https://github.com/mejrs/pyo3 into immutable
2022-04-01 23:11:02 +02:00
Sergey Kvachonok
2d2b9f5c33
Update the user guide and add a ChangeLog entry
...
Update Architecture.md to reflect the current cross compilation
support state.
2022-04-01 11:32:46 +03:00
Bruno Kolenbrander
fb689340b4
Merge branch 'main' into lint-more
2022-03-23 09:34:31 +01:00
mejrs
6f1cf1b662
Add more lints
2022-03-23 08:07:28 +01:00
David Hewitt
87c79c0319
Merge pull request #2234 from davidhewitt/pyclass-args-refactor
...
pyclass: unify pyclass with its pyo3 arguments
2022-03-22 11:38:05 +00:00
David Hewitt
49c1d22606
docs: for #2234
2022-03-22 10:38:36 +00:00
Mo Mirza
143b7d368f
Replace nbsp with space ( #2237 )
...
This fixes markdown heading rendering
2022-03-20 16:45:33 +01:00
Georg Brandl
f084ceb9b1
guide: fix duplicated example for #[new]
...
The second one was probably intended to show a fallible `#[new]`.
Also show that the method does not need to be named `new()`, which
is nice because `new()` can be used for a Rust-level constructor
if they differ.
2022-03-06 10:57:49 +01:00
David Hewitt
0f1b8dd43f
Merge pull request #2207 from davidhewitt/tidy-doctests
...
guide: tidy up doctests
2022-03-05 16:18:43 +00:00
Alex Gaynor
01d8f1e696
added missing proc-macro invocation to migration guide ( #2209 )
2022-03-05 15:46:36 +00:00
David Hewitt
2bd64c4962
guide: tidy up doctests
2022-03-04 22:50:12 +00:00
Jerzy Spendel
eaa82b2856
Remove typying
2022-03-04 16:24:49 +01:00
Georg Brandl
6bc8943df5
changelog/guide: visibility is also important for wrap_pyfunction! now
...
Fixes #2202
2022-03-04 07:48:41 +01:00
David Hewitt
b59ee9b54b
misc: tidy ups pre 0.16
2022-02-27 10:02:28 +00:00
Georg Brandl
0678f11266
Protocols: implement __getattribute__
...
converting tp_getattro to a shared slot
Fixes #2186
2022-02-26 20:05:50 +01:00
Georg Brandl
03dc96bff1
Py/PyAny: remove PartialEq impl and add is() ( #2183 )
2022-02-25 19:39:45 +00:00
David Hewitt
7c865fcc25
Merge pull request #2173 from davidhewitt/deprecate-pyproto
...
pyproto: deprecate protocol traits
2022-02-24 23:54:40 +00:00
David Hewitt
424644181b
pymethods: add support for inplace concat & repeat
2022-02-24 23:07:24 +00:00
Rico Hageman
ed698c4b43
Add documentation related to from_py_with for the FromPyObject trait
2022-02-24 22:54:30 +01:00
Bruno Kolenbrander
af0cef0e59
Merge branch 'main' into object
2022-02-23 10:13:29 +01:00
mejrs
be84e0fbb9
Add numeric and object protocol examples
2022-02-23 10:09:45 +01:00
David Hewitt
253507b5dd
migration: add note on pymethods -> pyproto
2022-02-23 07:50:55 +00:00
Georg Brandl
a21cf677e3
docs: remove/deprecate pyproto
2022-02-23 07:50:55 +00:00
David Hewitt
d8ee35e19c
Merge pull request #2165 from mejrs/auto_trait
...
Implement Auto trait
2022-02-23 07:16:17 +00:00
mejrs
9e29c1058c
Gut specialization and implement auto trait
...
Implement auto trait
Implement auto trait
Undo oopsie
Fix versions
Fix CI errors
Fix CI
Remove more specialization remnants
2022-02-22 22:43:23 +01:00
David Hewitt
79123b396c
pyclass: deprecate gc option
2022-02-15 08:01:46 +00:00
David Hewitt
676295b8de
pymethods: support gc protocol
2022-02-15 08:01:23 +00:00
David Hewitt
f5b2a88a70
refactor: include __new__ as slot
2022-02-09 08:07:14 +00:00
David Hewitt
75e44585de
refactor: pass tp_alloc and tp_free via slots
2022-02-09 08:07:14 +00:00
mejrs
7520b49ac1
Implement opt-in immutable pyclasses
2022-02-08 18:08:18 +00:00
b05902132
78f5afc82e
Finish implementation for pyclass enums
2022-02-07 22:17:11 +00:00
David Hewitt
4fd01c3cd6
fix: guide example for pyclass expansion
2022-02-07 07:46:12 +00:00
David Hewitt
9def53317f
Merge pull request #2153 from davidhewitt/simplify-intrinsic-items
...
refactor: inline pyclass_intrinsic_items
2022-02-07 00:05:30 +00:00
David Hewitt
e39881c208
refactor: inline pyclass_intrinsic_items
2022-02-06 23:26:57 +00:00
David Hewitt
f75579a489
python-3.11: support buffer API on abi3
2022-02-06 22:46:45 +00:00
David Hewitt
ecfd2c2434
pyclass: simplify generated code for PyClassImpl
2022-02-05 16:58:01 +00:00
David Hewitt
558549e1c2
pyproto: split into new feature
2022-02-05 16:51:31 +00:00
David Hewitt
53c170078d
pymethods: seq methods from mapping methods
2022-02-05 15:59:22 +00:00
mejrs
463543ad58
Annotate Rust blocks with "rust"
2022-01-29 01:03:57 +01:00
Jakub Kołodziejczak
d1542a8a79
docs(guide): example of loading python file from path at runtime in a way that it sees its dependencies ( #2109 )
...
* docs(guide): example of loading python file from path at runtime in a way that it sees its dependencies
* docs: editorial fixes
suggested by @mejrs
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
2022-01-24 11:03:47 +01:00
Jakub Kołodziejczak
020488efee
docs: example how to include multiple Python files into the binary and at runtime ( #2095 )
2022-01-17 10:57:39 +01:00
messense
ce80b7e0f3
Switch from tox to nox
2022-01-17 00:24:33 +08:00
David Hewitt
2cee7feaaf
Merge pull request #2083 from aviramha/magic_methods
...
verify py method args count
2022-01-07 00:13:05 +00:00
Aviram Hassan
50659b6b02
`__ipow__` now supports modulo argument on Python 3.8+.
...
`pyo3-macros-backend` is now compiled with PyO3 cfgs to enable different magic method definitions based on version.
Add check for correct number of arguments on magic methods.
2022-01-03 09:53:56 +02:00
David Hewitt
cf965155f4
pymethods: support buffer protocol
2021-12-30 15:48:55 +00:00
David Hewitt
e33b3e6a5b
opt: don't emit T::dict_offset and T::weakref_offset without attributes
2021-12-30 14:57:27 +00:00
Bruno Kolenbrander
4d1d859a64
Merge branch 'main' into aliases
2021-12-24 22:28:22 +01:00
James Hilton-Balfe
a5511b8f8a
Fix markdown link ( #2071 )
2021-12-22 16:51:03 +00:00
mejrs
9512ce4e87
Fix call example
2021-12-22 12:12:16 +01:00
Bruno Kolenbrander
39cac9075b
Organize examples + add __call__ example ( #2043 )
...
* Add decorator example crate and split off chapter
* Move not-examples to their own folder
* Add some readme's
* Make black happy
* Make clippy happy
* Add decorator example crate and split off chapter
* Fix ci
* Add empty workspace key
* Try fix ci
* fix ci
* reuse target dir for examples CI
* add pytests folder to makefile recipes
* fix ci, try 2
* add missing pyproject.toml
* remove TOX_TESTENV_PASSENV from Makefile
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-12-15 00:45:26 +00:00
Georg Brandl
a5b76bc365
pyo3_path, part 4: rename to `crate` to keep consistent with serde
2021-12-09 07:36:48 +01:00
Georg Brandl
e4f608f605
pyo3_path, part 2: add pyo3_path options and use them.
2021-12-09 07:24:18 +01:00
David Hewitt
2ac30ec411
err: tweak names, inlining and docs
2021-11-27 08:26:04 +00:00
David Hewitt
e9b46f76da
Merge pull request #1985 from PyO3/is_instance_of
...
add PyType::is_subclass_of and PyAny::is_instance_of
2021-11-20 14:56:36 +00:00
David Hewitt
ded44eebfb
Merge pull request #2006 from davidhewitt/drop-py36
...
python: drop support for 3.6
2021-11-20 14:04:31 +00:00
Georg Brandl
43893158b1
switch is_instance/is_instance_of, is_subclass/is_subclass_of
2021-11-20 13:18:43 +00:00
David Hewitt
cc91a7c574
Merge pull request #2007 from davidhewitt/remove-0.14-deprecations
...
deprecations: remove items deprecated in PyO3 0.14
2021-11-20 13:09:04 +00:00
David Hewitt
70030f130d
python: drop support for 3.6
2021-11-20 13:02:42 +00:00
David Hewitt
c9a4cd1f87
deprecations: remove items deprecated in PyO3 0.14
2021-11-19 16:33:29 +00:00
David Hewitt
b9cc10f3fb
pyo3-build-config: don't enable resolve-config by default
2021-11-19 14:19:24 +00:00
Dan Svoboda
d9a3f67287
Fix broken relative markdown link in guide
...
This link needs to point up one dir to the location of class.md
2021-11-15 14:04:53 -05:00
Gertjan van Zwieten
0e40277112
add missing annotation to PyCounter.__call__
...
This patch annotates the `__call__` method of `PyCounter` in example: callable
objects with `#[args(args="*", kwargs="**")]`. Without it (at least in PyO3
0.15.0) the example fails with `TypeError: counter.__call__() missing 1
required positional argument: 'args'`.
2021-11-15 09:01:05 +01:00
David Hewitt
a978b0875a
Merge pull request #1968 from KRunchPL/guide-python-typing-hints
...
#1959 - Add Python Typing Hints to the Guide
2021-11-11 23:00:53 +00:00
David Hewitt
20091826a5
Merge pull request #1976 from davidhewitt/pyo3-build-config-docs
...
docs: pyo3 config files
2021-11-11 08:53:36 +00:00
David Hewitt
2784b31bea
Merge pull request #1971 from davidhewitt/disable-unwanted-protos
...
pymethods: test and document opt-out of protos
2021-11-11 08:52:58 +00:00
David Hewitt
23778f5386
pymethods: test and document opt-out of protos
2021-11-10 23:28:01 +00:00
David Hewitt
b0af3ec25f
docs: pyo3 config files
2021-11-10 08:34:54 +00:00
David Hewitt
3d1bcae3aa
guide: document `#[pyo3(from_py_with)]`
2021-11-07 12:57:40 +00:00
KRunchPL
a0716ce519
Description of simple solution implemented in Maturin guide
2021-11-06 17:29:02 +01:00
KRunchPL
1531ac8d7e
#1959 - Add Python Typing Hints to the Guide
2021-11-06 15:34:30 +01:00
Georg Brandl
9ce363a125
guide: add hints for the signature of pymethods protos
2021-11-03 08:00:09 +01:00
David Hewitt
3ab32ff01f
guide: magic methods in pymethods
2021-10-24 15:59:22 +01:00
David Hewitt
dc0e29af1c
Merge pull request #1929 from davidhewitt/call-proto
...
pymethods: support __call__ proto
2021-10-23 22:55:30 +01:00
David Hewitt
4b2345fe80
pymethods: support __call__ proto
2021-10-23 00:06:46 +01:00
Nikita Sobolev
5ae9178781
Fixes typo in docs
2021-10-23 00:03:41 +01:00
Ashley Anderson
bf26daec2d
Positional-only args ( #1925 )
...
* Add support for positional-only args
* Update changelog. Add a few more tests. Run rust-fmt.
* Fix test.
* Fix tests again.
* Update CHANGELOG.md to link PR instead of issue
* Update guide to mention positional-only params
* Add unreachable!() per code review
* Update and expand tests for pos args.
* Fix tests, lint, add UI tests.
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-10-19 23:13:27 +01:00
Chris Laplante
3b94f4b70c
Add `anyhow-integration` feature which implements From<anyhow::Error> for PyErr ( #1822 )
...
* Add 'anyhow' feature which provides simple From<anyhow::Error> for PyErr impl
This makes it possible to use anyhow::Result<T> as the return type for
methods and functions exposed to Python.
The current implementation just stringifies the anyhow::Error before
shoving it into a PyRuntimeError. Conversion back to the anyhow::Error
is not possible, but it is better than nothing.
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
* Document `anyhow` feature in the guide
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
* update changelog to document anyhow feature
* WIP adding tests
* Finish up anyhow feature
* Fix formatting
* Fix tests
* Fix tests
* Apply review suggestions
Co-authored-by: Bruno Kolenbrander <59372212+mejrs@users.noreply.github.com>
Co-authored-by: mejrs <brunokolenbrander@hotmail.com>
2021-10-17 07:54:29 +01:00
Bruno Kolenbrander
8a57fe2d20
Clean up doctests, deny some lints ( #1900 )
...
* Clean up doctests, deny some lints
* Apply suggestions from review.
* replace \" with '
* Fix some more doc examples
* Fix formatting
* Fix some more things
* Remove unused parentheses
* Only test class sig on supported abi/platforms
* Only test class signature on correct versions
* Fix tests to compile on msrv
* msrv strikes yet again
* Add feedback
* Pin `half` to 1.7.1 on msrv
2021-10-14 22:15:25 +01:00
Bruno Kolenbrander
ae873698d4
Implement `eyre` feature ( #1893 )
...
* Implement `eyre` feature
* Punctuation
* Add `eyre` entry in changelog
* Add `eyre` feature entry to guide
* Set eyre upper bound and move comment back
* Add eyre feature to docs.rs metadata
* Finish up review suggestions
* Update CHANGELOG.md
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-10-13 22:36:06 +00:00
David Hewitt
c986b5d4ae
Merge pull request #1889 from davidhewitt/py310
...
packaging: formal support for Python 3.10
2021-09-29 19:36:52 +01:00
David Hewitt
a5d0aa777c
py310: add abi3-py310 feature
2021-09-26 16:21:35 +01:00
David Hewitt
16ac7d481d
Merge pull request #1844 from davidhewitt/mapping-type
...
types: add PyMapping
2021-09-26 14:55:59 +01:00
David Hewitt
d929916071
types: add PyMapping
2021-09-26 13:57:33 +01:00
David Hewitt
9e80f3dfdd
pep 604: use `T | U` instead of `Union[T, U]` in messaging
2021-09-24 22:46:25 +01:00
David Hewitt
a551b005b4
pymethods: finish support for number protocol
2021-09-18 12:59:25 +01:00
Gregory Szorc
1e951d5d8b
pyo3-build-config: add a crate feature to control build script
...
I have a use case in PyOxidizer where I want to use the
pyo3-build-config crate as a library crate so I can access the
`InterpreterConfig` struct so I can read/write config files without
reinventing the wheel.
This is doable before this commit. But it requires that the
build environment have a Python interpreter. This is undesirable
for library usage.
This commit introduces a cargo feature flag to control whether the
build script does anything. The feature flag must be present for
the build script to resolve a config. The feature flag is enabled
by default for backwards compatibility. The pyo3 and pyo3-macros-backend
crates use this feature by default, for backwards compatibility and
because it is the reasonable default.
This is probably room to conditionalize some APIs and other behavior
based on this feature flag. But we stop short of doing that for
the time being.
2021-09-01 19:44:54 -07:00
David Hewitt
4a50a26c87
changelog: remove function parentheses
2021-08-26 18:59:07 +01:00
David Hewitt
a2375f336f
Merge pull request #1832 from mejrs/decorator
...
guide: add decorator example
2021-08-26 18:55:59 +01:00
mejrs
76179967f3
use &mut self receiver and py args.
2021-08-26 15:28:52 +02:00
David Hewitt
f20079bf78
Merge pull request #1829 from davidhewitt/slice-index
...
list,tuple,sequence: add slice indexing
2021-08-26 08:30:30 +01:00
David Hewitt
3a90ff77f4
list,tuple,sequence: add slice indexing
2021-08-26 07:57:12 +01:00
David Hewitt
f2ff6cad37
guide: add "Optional Dependencies" section
...
Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
2021-08-26 07:22:54 +01:00
mejrs
eaf5e6de9c
add decorator example
2021-08-26 04:18:49 +02:00
Georg Brandl
54e7da515a
migration: add guide entry for sequence indexing
2021-08-24 08:32:19 +02:00
Benjamin Kay
ac4613eb9f
Improve documentation about when we free memory, resolves #311 ( #1807 )
...
* Improve API docs regarding when we free memory, resolves #311
* Add chapter to guide about when we free memory, resolves #311
* Fix typos in documentation
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* Add links from guide to docs.rs
* Update guide/src/memory.md
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-08-21 09:23:10 +01:00
David Hewitt
37d39aa83a
Merge pull request #1751 from davidhewitt/pyany-py
...
pyany: add PyAny::py()
2021-08-17 14:10:16 +01:00
Gregory Szorc
410c9f13c9
macros: raise AttributeError on property deletion requests
...
The setter function will receive a NULL value on deletion requests.
This wasn't properly handled before, leading to a panic.
The new code raises AttributeError in this scenario instead.
A test for the behavior has been added. Documentation has also
been updated to reflect the behavior.
2021-08-13 21:01:00 -07:00
David Hewitt
ebada76ae3
pyany: add PyAny::py()
2021-08-13 08:00:13 +01:00
Sanskar Jethi
aac3d1da6e
Add documentation to call async python from rust
2021-08-12 00:22:10 +01:00
David Hewitt
290ded4d4e
guide: don't bother doctesting async guide
2021-08-10 07:56:36 +01:00
Andrew J Westlake
f4975c6e1d
Fixed broken link in async-await.md
2021-08-09 09:07:57 -05:00
Andrew J Westlake
bf23f8bda7
Shortened the async/await guide
2021-08-08 14:58:46 -05:00
Andrew J Westlake
9037697bed
Update guide/src/ecosystem/async-await.md
...
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-08-08 10:15:01 -05:00
Andrew J Westlake
d578f37f70
Removed "auto-initialize" feature from uvloop example
...
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-08-08 10:13:47 -05:00
Andrew J Westlake
92c3af5088
Forgot to bump another pyo3 version
...
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-08-08 09:59:17 -05:00
Andrew J Westlake
dbb956fd4c
Forgot to bump pyo3 version
...
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-08-08 09:59:01 -05:00
Andrew J Westlake
5c5a406ce4
Updated async-await guide for pyo3-asyncio 0.14
2021-08-07 22:53:26 -05:00
David Hewitt
2cf2c2fef9
pyo3-build-config: improve test coverage
...
[review] birkenfeld
Co-authored-by: Georg Brandl <georg@python.org>
2021-08-06 12:55:03 +01:00
David Hewitt
49387e9a70
pyo3-build-config: many tidy ups
2021-08-05 23:19:43 +01:00
David Hewitt
c2d6a50b35
build: revert usage of cargo:rustc-cdylib-link-arg
2021-08-03 20:04:56 +01:00
David Hewitt
582d9c530f
build: move print-config into environment variable
2021-08-01 17:26:27 +01:00
David Hewitt
3d3dacf2ac
guide: rewrite "Building and Distribution" chapter
2021-08-01 16:59:47 +01:00
David Hewitt
13f8953d1a
readme: slightly improve getting started notes
2021-07-31 16:18:49 +01:00
Ivan Carvalho
bd0e0d808f
Add optional support for conversion from `indexmap::IndexMap` ( #1728 )
...
* Add support to IndexMap
* Fix indexmap version to 1.6.2
* Remove code duplication by mistake
* Fix ambiguity in test
* Minor change for doc.rs
* Add to lib.rs docstring
* Add indexmap to conversion table
* Add indexmap flag in docs.rs action
* Add indexmap feature to CI
* Add note in changelog
* Use with_gil in tests
* Move code to src/conversions/indexmap.rs
* Add PR number to CHANGELOG
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* Add round trip test
* Fix issue in MSRV Ubuntu build
* Fix Github workflow syntax
* Yet Another Attempt to Fix MSRV Ubuntu build
* Specify hashbrown to avoid ambiguity in CI
* Add suggestions
* More flexible version for indexmap
* Add documentation
* Address PR comments
* Export indexmap for docs
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-07-22 08:15:26 +01:00
Eric Arellano
9ab7b1fad1
Rewrite `module.md` for clarity and add tip on code organization ( #1693 )
...
* Rewrite `module.md` for clarity and add tip on code organization
* Add section on how to build the guide + add workaround proposed by David
* Make more clear references to #1709
2021-07-22 08:10:32 +01:00
David Hewitt
6e0fb9e3a1
guide: bump mdbook to 0.4.10
2021-07-20 08:54:21 +01:00
messense
b5b9a480cd
Add `wrap_pyfunction` macro to prelude
2021-06-24 22:34:55 +08:00
Aviram Hassan
13cd092c4e
Update class.md - add example of `new` returning a `PyResult` ( #1688 )
...
* Update class.md - add example of `new` returning a `PyResult`
* Update class.md
2021-06-23 17:40:01 +08:00
David Hewitt
f916867375
pyclass: refactor initialization, call native type dealloc
2021-06-23 07:45:51 +01:00
mejrs
d5d2cf9fda
document + refactor numcomplex/bigint dependencies
2021-06-07 22:16:23 +02: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
cec4c2d2e9
text_signature: move to `#[pyo3(text_signature = "...")]`
2021-06-05 16:33:03 +01:00
Georg Brandl
3e8d003faf
Implement METH_FASTCALL for pyfunctions and pymethods.
2021-06-05 12:57:22 +02:00
David Hewitt
d011467e63
pyclass: allow `#[pyo3(get, set, name = "foo")]`
2021-06-04 11:30:40 +01:00
mejrs
dbf9a91a8b
mark toml field as toml
2021-05-31 21:05:52 +02:00
mejrs
e2cb176f6c
mark non-rust code as text fields
2021-05-31 20:58:38 +02:00
mejrs
161f1bd678
faq: add section about pyo3(get) cloning fields
2021-05-31 17:16:25 +02:00
Georg Brandl
d680fbee0a
Merge pull request #1643 from mejrs/main
2021-05-31 15:14:31 +02:00
mejrs
d86559b163
move manual builds to its own header
2021-05-31 12:39:00 +02:00
mejrs
ce3b0d1dc0
add renaming method to guide
2021-05-30 14:13:24 +02:00
Tim Robinson
1ba32178dd
Method and slot visitors accept slices instead of individual items
2021-05-29 09:38:15 +01:00
David Hewitt
9a4e7b5877
Merge pull request #1622 from davidhewitt/pyo3-build-config
...
pyo3-build-config: new crate to re-use build.rs across crates
2021-05-25 07:11:24 +01:00
David Hewitt
1e1605f0db
pyo3-build-config: finish docs
2021-05-24 08:44:20 +01:00
David Hewitt
825ec08681
pyo3-build-config: docs wip
2021-05-21 08:34:51 +01:00
David Hewitt
a109640850
pyfn: deprecate name argument
2021-05-20 08:54:29 +01:00
Tim Robinson
735a9a1156
Update for_each_proto_slot for consistency
2021-05-13 17:32:59 +01:00
Tim Robinson
c3b935f06c
Reduce size of compiled code for class initialization
2021-05-13 13:08:58 +01:00
David Hewitt
4d46abde73
macros: support `#[pyo3(name = "...")]`
2021-05-07 22:35:52 +01:00
David Hewitt
7536554ceb
type_object: remove layout and base type from PyTypeInfo
2021-05-04 21:39:42 +01:00
David Hewitt
48823e22d6
pyproto: deprecate py_methods
2021-04-20 00:21:19 +01:00
David Hewitt
2b9085abdb
build: avoid rebuilds when using clippy in a virtualenv
2021-04-19 09:45:01 +01:00
David Hewitt
355df5a37f
auto-initialize: better error messages and embedding docs
2021-04-12 01:29:03 +01:00
Sergey Kvachonok
e8a277e1ff
Apply suggestions from code review
...
- Style
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-04-07 08:23:43 +03:00
Sergey Kvachonok
88849bd96b
Add `PyMappingProtocol` description to the guide
...
References:
[1]: https://docs.python.org/3/reference/datamodel.html#emulating-container-types
[2]: https://docs.python.org/3/c-api/mapping.html
[3]: https://docs.python.org/3/c-api/typeobj.html#c.PyMappingMethods
2021-04-05 14:19:18 +03:00
Sergey Kvachonok
b1aae93645
Add `PySequenceProtocol` description to the guide
...
References:
[1]: https://docs.python.org/3/reference/datamodel.html#emulating-container-types
[2]: https://docs.python.org/3/c-api/sequence.html
[3]: https://docs.python.org/3/c-api/typeobj.html#c.PySequenceMethods
2021-04-05 14:18:48 +03:00
Sergey Kvachonok
4b675cc364
Insert missing `impl` keywords
...
Updates the class customization guide.
2021-04-05 12:02:46 +03:00
Sergey Kvachonok
0c0214690f
Remove issue #844 mention from the guide
...
Supposedly resolved by https://github.com/PyO3/pyo3/pull/1107
Fix a typo in the subsection header.
2021-04-05 08:35:02 +03:00
David Hewitt
f953059880
guide: fixups to build
2021-04-03 10:50:57 +01:00
David Hewitt
31eeb86e98
guide: automatically set pyo3 version in links and cargo toml
2021-04-03 07:05:10 +01:00
Sergey Kvachonok
80c747d2c0
Remove `pyconfig.h` header parsing
...
The config header parsing code was supposed to be only invoked when
cross-compiling for Windows, but in reality it fails to correctly parse
the config header files shipped with the upstream Python for Windows.
Given that there are now better options for reliable cross-compiling
for Windows such as `PYO3_CROSS_PYTHON_VERSION` or the `abi3-py3*` features,
it should be OK to remove this config for v0.14.
Update the cross-compilation instructions section of the user guide.
Fixes https://github.com/PyO3/pyo3/issues/1337
2021-03-26 09:57:18 +03:00
kngwyu
aedd6352e3
Use with_gil instead of acquire_gil in examples
2021-03-20 19:02:50 +09:00
David Hewitt
f22fb423cb
Merge pull request #1503 from davidhewitt/main-tweaks
...
main: tweaks from rename
2021-03-17 21:07:58 +00:00
David Hewitt
971b48f091
Update guide/src/parallelism.md
...
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2021-03-17 07:02:29 +00:00
Yuji Kanagawa
6137e3a726
Merge pull request #1456 from davidhewitt/pyclass-impl-flags
...
pyclass: move flags to PyClassImpl
2021-03-17 12:50:49 +09:00
David Hewitt
4d2913dc06
main: tweaks from rename
2021-03-16 22:14:57 +00:00
David Hewitt
b10cefdca2
pymodule: remove call_function etc.
2021-03-14 11:19:55 +00:00
David Hewitt
d9fe404d69
[review] kngwyu
2021-03-14 00:50:59 +00:00
Matthew Scheffel
e24f29dbf5
Add context manager example to user guide ( #1476 )
...
* Add context manager example
A simple illustrative example on how to use context managers. I required this to use pymc3, which relies heavily on the context stack for modelling.
* Clippy changes to context example
* Extend context manager example with exit exceptions
* Context manager, s/call1/call_method1/ and comments for clarity
* Add newline to context manager section to avoid horizontal scrolling
* Change generic, potentially confusing label.
s/objects.py/house.py/
* Use call_function1 rather than call_method1.
* Missed a call_method0, change to call_function0
* Update guide/src/python_from_rust.md
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
* Update guide/src/python_from_rust.md
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-03-13 22:54:13 +00:00
David Hewitt
31c7af2ac7
pyclass: move flags to PyClassImpl
2021-03-13 22:44:53 +00:00
David Hewitt
a45f520ec1
Merge pull request #1457 from davidhewitt/multiple-pymethods
...
pymethods: make inventory optional
2021-03-06 23:09:02 +00:00
David Hewitt
bb6d4df497
multiple-pymethods: documentation updates
2021-03-04 23:03:26 +00:00
David Hewitt
977735db20
pymethods: make inventory optional
2021-03-04 19:52:58 +00:00
David Hewitt
1dcda8809d
docs: deny warnings in ci
2021-03-04 19:41:11 +00:00