Commit Graph

727 Commits

Author SHA1 Message Date
bors[bot] 410bb15d71
Merge #2982
2982: explain STATUS_DLL_NOT_FOUND r=adamreichold a=mejrs

I had someone ask me this today, and googling for it I found various other places where this was asked, with no (good) answers. 

Co-authored-by: mejrs <59372212+mejrs@users.noreply.github.com>
2023-02-24 17:13:38 +00:00
mejrs db16580b63 Make changes 2023-02-23 12:36:54 +01:00
Adam Reichold 9534749d8b Add GILProtected synchronization primitive replacement and use it for LazyTypeObjectInner. 2023-02-23 09:38:02 +01:00
mejrs 90ce52175f explain STATUS_DLL_NOT_FOUND 2023-02-22 23:30:19 +01:00
Adam Reichold a16f2e45c8 Include conversions for bytes, bytearrays and Cow<[u8]> in the guide. 2023-02-22 22:07:59 +01:00
Azat Ibrakov 9f7368922f docs: fix typo in method name 2023-02-18 22:02:05 +01:00
David Hewitt c7cc48f8e4 use PyO3 types within LazyTypeObject 2023-02-18 09:06:36 +00:00
David Hewitt 00ddd21535 change PyModule::add_class to return an error if class creation fails 2023-02-14 22:08:35 +00:00
David Hewitt dbeb3b4453 move some private internals out of public implementation 2023-02-11 21:28:27 +00:00
bors[bot] 9e5c845dee
Merge #2934
2934: guide: add documentation for trailing option arguments r=davidhewitt a=davidhewitt

Following the increased clarity around PyO3's handling of function signatures of 0.18.0, I wanted to add a section to the guide documenting the default-to-none behaviour for trailing `Option<T>` arguments.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-02-07 08:15:57 +00:00
Jeff Hodges bc1a33f9fe
bump maturin version in getting_started.md
Latest maturin is 0.14.x
2023-02-04 00:09:04 -08:00
Julien Jerphanion 9306d56b27 docs: Precise the abscense of `py: Python` for the #[pyo3(signature)] 2023-02-03 20:57:23 +00:00
David Hewitt c709f30638 guide: add documentation for trailing option arguments 2023-02-03 20:54:51 +00:00
David Hewitt e83803e813 add link on how to obtain GIL to guide 2023-01-20 08:21:57 +00:00
David Hewitt 586fed2c4b send errors in `__releasebuffer__` to `sys.unraisablehook` 2023-01-19 19:10:06 +00:00
David Hewitt ca1bbe3d39 add migration notes for PyO3 0.18 2023-01-17 08:14:32 +00:00
David Hewitt 20ca3be659 inspect: gate behind `experimental-inspect` feature 2023-01-15 12:41:23 +00:00
David Hewitt eea2a31bd3 adjust location and wording for extension module memory management 2023-01-10 07:42:39 +00:00
Haixuan Xavier Tao 8af9d2a19a Add a section on memory management for `extension`
Adding a special case of memory management when writing an extension.

This is a documentation of: https://github.com/PyO3/pyo3/issues/1056 and https://github.com/PyO3/pyo3/issues/2853
2023-01-10 07:37:21 +00:00
David Hewitt 8651d3b0e8 address feedback in review #2678 2023-01-06 08:53:00 +00:00
James Welchman e52dbc907d GH-2649 example for inserting moulde in sys.dict 2023-01-05 21:26:47 +00:00
messense c722402e46
Fix links in `logging.md` 2023-01-03 20:03:51 +08:00
Dylan Storey fefd224e4a Update logging.md for logging->rust
Demonstrates how to register a rust log consumer with a pythong logging instance.
2023-01-03 10:22:54 +00:00
David Hewitt f2608a923c remove functionality deprecated in 0.16 2022-12-28 12:23:53 +00:00
David Hewitt 5039fd746a add automatic text signature generation 2022-12-24 09:43:02 +00:00
David Hewitt 97487ffbb5 add abi3-py311 feature 2022-11-23 08:08:12 +00:00
Georg Brandl f1f1ffcdc7 More typos and grammar. 2022-11-23 07:42:53 +01:00
Georg Brandl c91ed70bbc Fix various typos/omissions in guide. 2022-11-23 07:42:17 +01:00
Georg Brandl 5f7d67615c Use PYO3_DOCS_URL in guide-to-rustdoc links. 2022-11-23 07:42:17 +01:00
bors[bot] 08423557d4
Merge #2739
2739: error when `#[pyo3(signature = ())]` used on invalid methods r=davidhewitt a=davidhewitt

A follow-up to #2702 to reject some invalid applications of `#[pyo3(signature = (...))]` attribute, specifically on magic methods and getters / setters / class attributes.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-11-22 19:41:27 +00:00
bors[bot] b485199cfb
Merge #2762
2762: Add a nox task to rustfmt code in the guide r=birkenfeld a=birkenfeld

Also apply it. Two caveats:

1) needs nightly rustfmt to be available
2) not all reformat diffs have been applied; using best judgment for readability


Co-authored-by: Georg Brandl <georg@python.org>
2022-11-22 11:11:19 +00:00
Georg Brandl a7a53d6c0d Add a nox task to rustfmt code in the guide.
Also apply it. Two caveats:

1) needs nightly rustfmt to be available
2) not all reformat diffs have been applied; using best judgment for readability.
2022-11-22 09:19:40 +01:00
Saul Shanabrook 8a75352122
Add link to Python typing docs for type stubs
AFAIK there isn't currently a link to the article on ["Type Stubs"](https://typing.readthedocs.io/en/latest/source/stubs.html) in the official Python static typing documentation. This PR adds a link to this documentation, which is the most comprehensive I have seen around type stubs.
2022-11-21 16:48:43 -05:00
Matthew Lloyd b2014c30aa
guide: linkify "Method arguments" in class.md 2022-11-20 16:33:15 -05:00
David Hewitt 8ca41be87b
Merge pull request #2749 from PyO3/2748-fix
Fix being able to call arg-less `#[new]` with any args from Python
2022-11-20 11:39:42 +00:00
Georg Brandl 51eeb6db96 guide: explain how #[new] works w.r.t. native base types 2022-11-20 08:25:42 +01:00
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