Commit graph

5188 commits

Author SHA1 Message Date
Sunyeop Lee 8026f3521e Improve derive(FromPyObject) to apply intern! when applicable 2023-01-15 13:39:06 +00:00
David Hewitt 20ca3be659 inspect: gate behind experimental-inspect feature 2023-01-15 12:41:23 +00:00
bors[bot] 556b3cf48a
Merge #2703
2703: deprecate required argument after `Option<T>` without signature r=davidhewitt a=davidhewitt

This PR is a follow-up to #2702 to make required arguments after `Option<T>` arguments require a `#[pyo3(signature)]` annotation to remove the possible ambiguity on whether the developer actually wanted to have a required option (which is what PyO3 is currently forced to assume).

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-15 10:19:13 +00:00
David Hewitt 8f48d157d6 deprecate required arguments after option arguments without signature 2023-01-15 10:17:20 +00:00
bors[bot] ed0f3384d2
Merge #2875
2875: Update `memoffset`, `send_wrapper` and `hashbrown` r=adamreichold a=messense



Co-authored-by: messense <messense@icloud.com>
2023-01-12 06:02:24 +00:00
messense a7a9daed24
Add a changelog entry for #2875 2023-01-12 14:00:53 +08:00
messense 40a51985b3
Set minimal package versions by parsing Cargo.lock 2023-01-12 14:00:53 +08:00
messense 15b1ff6c9a
Relax hashbrown version constraint to allow 0.13.x 2023-01-11 23:13:24 +08:00
messense cb969b7ea0
Update send_wrapper to 0.6 2023-01-11 23:10:11 +08:00
messense d6b15af0ff
Update memoffset to 0.8 2023-01-11 23:09:51 +08:00
bors[bot] 3fc0634ee6
Merge #2874
2874: netlify: fix root redirect r=messense a=davidhewitt

See https://github.com/PyO3/pyo3/pull/2871#issuecomment-1378074972

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-11 03:58:50 +00:00
David Hewitt 71f02ff0bb netlify: fix root redirect 2023-01-11 00:44:14 +00:00
bors[bot] 61e0a09cb7
Merge #2871
2871: netlify: generate all redirects automatically r=messense a=davidhewitt

Uses the versions from the pulled `gh-pages` tarball to generate the `docs.rs` redirects. Simplifies the release process.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-10 22:24:24 +00:00
David Hewitt 68e2054fc4 netlify: generate all redirects automatically 2023-01-10 08:26:02 +00:00
bors[bot] 02fa6b85ba
Merge #2864
2864: Add a section on memory management for `extension` r=davidhewitt a=haixuanTao

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


Co-authored-by: Haixuan Xavier Tao <tao.xavier@outlook.com>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-10 07:44:27 +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
bors[bot] 34b9445faf
Merge #2869
2869: change latest URL from netlify proxy to redirect r=davidhewitt a=davidhewitt

Now that we serve all gh-pages content in netlify, it's nicer to have this as a proper redirect rather than a rewrite. Then the user can see what version of the docs they have landed on.

Closes #2867 

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-08 20:54:43 +00:00
bors[bot] bbf972f144
Merge #2868
2868: remove fallback rewrite for netlify -> gh-pages r=davidhewitt a=davidhewitt

Instead of having a rewrite to serve all content in gh-pages but not in netlify, instead I've added a webhook so that netlify will pull and rebuild when there is a push to gh-pages.

Fixes #2850

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-08 20:04:21 +00:00
David Hewitt 70c3260262 remove fallback redirect for netlify -> gh-pages 2023-01-08 19:58:56 +00:00
David Hewitt b6c71a8525 change latest URL from netlify proxy to redirect 2023-01-08 19:55:24 +00:00
bors[bot] 94c568d746
Merge #2678
2678: github pages example for sys.dict modules r=davidhewitt a=flickpp

Add an example into `python_from_rust.md` for creating a module and inserting it into the `sys.modules` dictionary.

As discussed here:
GH-2649 example for inserting moulde in sys.dict

Co-authored-by: James Welchman <jamesw@plantpot.ai>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-01-06 08:53:36 +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
bors[bot] c09d24e64d
Merge #2859
2859: Remove `libpython.so` from cross compile error message r=davidhewitt a=messense

See https://github.com/PyO3/pyo3/discussions/2858.

Same as https://github.com/PyO3/maturin/pull/1389

Co-authored-by: messense <messense@icloud.com>
2023-01-05 10:17:09 +00:00
messense 7e89456c77
Remove libpython.so from cross compile error message 2023-01-05 17:07:21 +08:00
bors[bot] 09470eb42c
Merge #2852
2852: Fix links in `logging.md` r=adamreichold a=messense

It's broken: https://pyo3.rs/main/ecosystem/logging

After: https://deploy-preview-2852--pyo3.netlify.app/main/ecosystem/logging

Co-authored-by: messense <messense@icloud.com>
2023-01-03 12:23:09 +00:00
messense c722402e46
Fix links in logging.md 2023-01-03 20:03:51 +08:00
bors[bot] 6da1fc7191
Merge #2835
2835: Update logging.md for logging->rust r=davidhewitt a=dylanbstorey

Demonstrates how to register a rust log consumer with a pythong logging instance.

Thank you for contributing to pyo3!

Please consider adding the following to your pull request:
 - an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes]
 - docs to all new functions and / or detail in the guide
 - tests for all new or changed functions

PyO3's CI pipeline will check your pull request. To run its tests
locally, you can run ```cargo xtask ci```. See its documentation
 [here](https://github.com/PyO3/pyo3/tree/main/xtask#readme).


Co-authored-by: Dylan Storey <dylanbstorey@users.noreply.github.com>
2023-01-03 10:24:11 +00: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
bors[bot] b1104d9aab
Merge #2757
2757: Updated README.md to add installation instruction for Python shared l… r=davidhewitt a=santokalayil

…ibrary on Fedora

Thank you for contributing to pyo3!

Please consider adding the following to your pull request:
 - an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes]
 - docs to all new functions and / or detail in the guide
 - tests for all new or changed functions

PyO3's CI pipeline will check your pull request. To run its tests
locally, you can run ```cargo xtask ci```. See its documentation
 [here](https://github.com/PyO3/pyo3/tree/main/xtask#readme).


Co-authored-by: Santo K Thomas <santokalayil@gmail.com>
2023-01-02 21:08:08 +00:00
Santo K Thomas 2400d11b24 Updated README.md to add installation instruction for Python shared library on Fedora 2023-01-02 21:06:44 +00:00
bors[bot] 57d188bd56
Merge #2849
2849: Relax indexmap dependency r=adamreichold a=gnaaman-dn

Halloo,

Noticed some version resolve errors when trying to use the `indexmap` features.
```bash
❯ cargo add pyo3 --features indexmap
❯ cargo add serde_yaml
    Updating crates.io index
      Adding serde_yaml v0.9.16 to dependencies.
error: failed to select a version for `indexmap`.
    ... required by package `pyo3 v0.17.3`
    ... which satisfies dependency `pyo3 = "^0.17.3"` of package `pyo3-indexmap v0.1.0 (/home/dn/repos/pyo3-indexmap)`
versions that meet the requirements `>=1.6, <1.8` are: 1.7.0, 1.6.2, 1.6.1, 1.6.0

all possible versions conflict with previously selected packages.

  previously selected package `indexmap v1.9.0`
    ... which satisfies dependency `indexmap = "^1.9"` of package `serde_yaml v0.9.16`
    ... which satisfies dependency `serde_yaml = "^0.9.16"` of package `pyo3-indexmap v0.1.0 (/home/dn/repos/pyo3-indexmap)`

failed to select a version for `indexmap` which could resolve this conflict
```

Couldn't find a specific reason for this limitation so I tried upgrading the dependency and running the tests.
Ran the tests locally with `indexmap==v1.9.2`:
```
❯ cargo test --features indexmap conversions::indexmap
...
running 4 tests
test conversions::indexmap::test_indexmap::test_indexmap_indexmap_insertion_order_round_trip ... ok
test conversions::indexmap::test_indexmap::test_indexmap_indexmap_to_python ... ok
test conversions::indexmap::test_indexmap::test_indexmap_indexmap_into_python ... ok
test conversions::indexmap::test_indexmap::test_indexmap_indexmap_into_dict ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 536 filtered out; finished in 0.03s
```

(Tried running `cargo xtask ci` but it failed on some warnings in the generated FFI code)

This relaxes the restrictions on `indexmap` so that the latest version is also supported,
hope that's okay.

Cheers,
Gilad

Co-authored-by: Gilad Naaman <gnaaman@drivenets.com>
2023-01-02 11:53:15 +00:00
Gilad Naaman 3e4cf7843a Relax indexmap dependency 2023-01-02 09:28:27 +02:00
bors[bot] 8af48bbb53
Merge #2796
2796: Forward cfgs on pyclass fields to the method defs r=davidhewitt a=mejrs

With this and the cfg_attr PR, I don't need cfg_eval at all anymore :)


- [x] needs some more tests

Co-authored-by: mejrs <>
2022-12-29 16:28:26 +00:00
mejrs 530c5b3193 Fix changelog 2022-12-29 15:13:38 +01:00
mejrs 8f51142013 Add changelog 2022-12-28 23:13:55 +01:00
mejrs 5198722dd9 Add test 2022-12-28 23:11:39 +01:00
bors[bot] 688c7dcebd
Merge #2844
2844: update URL in comment to point at correct place r=adamreichold a=alex



Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2022-12-28 19:49:00 +00:00
Alex Gaynor 4875e4b6bf update URL in comment to point at correct place
The branch has drifted and those line ranges are no longer accurate.
2022-12-28 20:48:11 +01:00
bors[bot] cedb5aecb2
Merge #2843
2843: remove functionality deprecated in 0.16 r=davidhewitt a=davidhewitt

Simple cleanup to remove all functionality marked deprecated in the 0.16 releases.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-28 12:24:59 +00:00
David Hewitt f2608a923c remove functionality deprecated in 0.16 2022-12-28 12:23:53 +00:00
bors[bot] c2adf14f69
Merge #2842
2842: Stop leaking in `new_closure` r=adamreichold a=davidhewitt

This is a rebase of #2690 which simplifies the `MaybeLeaked` abstraction from that PR with just `Cow<'static, CStr>`.

This enabled me to annotate with `FIXME` all the places where we still leak; I wonder if we could potentially use `GILOnceCell` in future and statics to avoid those. As those callsities are in `#[pyclass]` and `#[pyfunction]` these are effectively in statics anyway, but it would be nice to tidy up.


Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-28 08:13:58 +00:00
David Hewitt 1e8206c0b8 Stop leaking in new_closure 2022-12-28 07:51:50 +00:00
bors[bot] 31c42cc2c8
Merge #2838
2838: pypy: re-enable PyFunction on 3.8+ r=davidhewitt a=davidhewitt

PyPy [fixed the crashes associated with `PyFunction](https://foss.heptapod.net/pypy/pypy/-/issues/3776#note_191626)  in PyPy 7.3.10 (for 3.8+) - which I think is to be released shortly. So I think we should re-enable this API and treat it as a PyPy bug which users can mitigate by updating their PyPy.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-27 21:40:57 +00:00
bors[bot] 8c8a576b2d
Merge #2841
2841: correct changelog for 2772 r=mejrs a=davidhewitt

`@mejrs` how's this?

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-27 20:21:52 +00:00
David Hewitt f24b1370b6
correct changelog for 2772 2022-12-27 20:14:21 +00:00
bors[bot] 1598991a05
Merge #2772
2772: fix PyUnicodeDecodeError_Create r=davidhewitt a=mejrs

Fixes https://github.com/PyO3/pyo3/issues/2770

Co-authored-by: mejrs <>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-27 16:22:58 +00:00
David Hewitt 5fcc8741e0 add changelog for 2772 2022-12-27 16:19:18 +00:00
mejrs faa578a7c5 fix PyUnicodeDecodeError_Create 2022-12-27 16:13:32 +00:00