Commit graph

474 commits

Author SHA1 Message Date
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