Commit graph

5076 commits

Author SHA1 Message Date
bors[bot] 097af010e2
Merge #2813
2813: ci: run pyo3-ffi-check using nox r=davidhewitt a=davidhewitt

Makes it easier to run pyo3-ffi-check locally :)

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-26 10:02:54 +00:00
David Hewitt 87b6a9bd92 ci: run pyo3-ffi-check using nox 2022-12-26 08:50:33 +00:00
bors[bot] e5cf1cb971
Merge #2826
2826: ci: run checks for all platforms on PR r=adamreichold a=davidhewitt

I've been struggling a little to merge PRs with the new bors workflow; overall I think the lighter PR workflow is better but the number of combinations of older pythons / platforms not covered makes it easy for the bors step to fail.

This PR tries to improve the situation by merging the `clippy` and `check-target` job and running it for all supported platforms on PR. Hopefully if these are green, then there's high likelihood that tests will build and should pass unless there's logic errors.

While creating this I found a build error on PyPy which made me notice we can support `PyList::get_item_unchecked` for PyPy, so I added it.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-25 21:02:22 +00:00
David Hewitt 710c895d01 ci: run checks for all platforms on PR 2022-12-25 20:02:21 +00:00
bors[bot] e5ae4e266b
Merge #2784 #2827
2784: Automatically generate `__text_signature__` for all functions r=davidhewitt a=davidhewitt

This PR makes it so that PyO3 generates `__text_signature__` by default for all functions. It also introduces `#[pyo3(text_signature = false)]` to disable the built-in generation.

There are a few limitations which we can improve later:
 - All default values are currently set to `...`. I think this is ok because `.pyi` files often do the same. Maybe for numbers, strings, `None` and `True`/`False` we could render these in a future PR.
 - No support for `#[new]` yet.

Alternative design ideas:
- Only autogenerate for methods with `#[pyo3(signature = (...))]` annotation. I started with this, and then decided it made sense to do it for everything.
- Opt-out with `#[pyo3(text_signature = None)]`. This is slightly harder to parse in the macro, but matches the final result in Python better, so if this looks preferable to others, I can change from `text_signature = false` to `text_signature = None`.

There's some small tidying up / refactoring to do before this merges (happy to take suggestions on this), however the general logic, design and docs are ready for review.


2827: pypy: enable `PyList::get_item_unchecked` r=adamreichold a=davidhewitt

Split out from #2826. Approved previously as part of that review.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-25 19:45:50 +00:00
bors[bot] b2906cf678
Merge #2828
2828: move set-minimal-package-versions to nox r=adamreichold a=davidhewitt

Split from #2826 because #2827 couldn't merge due to `hermit-abi` MSRV break, which this PR also fixes (by pinning its dependent `num_cpus` back). 

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-25 19:05:36 +00:00
David Hewitt bd2dc0835b move set-minimal-package-versions to nox 2022-12-25 19:04:56 +00:00
David Hewitt 010dd509d7 pypy: enable PyList::get_item_unchecked 2022-12-25 08:45:36 +00:00
David Hewitt 5039fd746a add automatic text signature generation 2022-12-24 09:43:02 +00:00
bors[bot] 0f70fc6e0c
Merge #2820
2820: netlify: remove trailing slash rewrites r=davidhewitt a=davidhewitt

So adding rewrite rules in #2819 didn't work, created infinite redirect loops. Instead I've enabled the pretty URLs at https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash, let's see if that works.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-18 22:20:43 +00:00
bors[bot] 9082c5c7b4
Merge #2821
2821: ci: pin more to 3.11.0 r=davidhewitt a=davidhewitt

Still getting some windows failures due to #2817. Pin more stuff for now :(

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-18 21:06:45 +00:00
David Hewitt 3fc9c9ad95 ci: pin more to 3.11.0 2022-12-18 09:57:30 +00:00
David Hewitt 56f132599b netlify: remove trailing slash rewrites 2022-12-18 08:49:45 +00:00
bors[bot] 81db4cff0d
Merge #2818 #2819
2818: pin CI to 3.11.0 as workaround for 2817 r=davidhewitt a=davidhewitt

While we have issues with 3.11.1, let's run 3.11.0 for now in tests so that we can make progress.

2819: netlify: add additional redirects to gh-pages r=davidhewitt a=davidhewitt

Just noticed that https://pyo3.rs/dev/bench has probably been broken since the move to netlify, and that https://pyo3.rs/v0.17.3 doesn't render nicely.

Add some redirects to netlify configuration to handle these cases.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-18 07:57:56 +00:00
David Hewitt fe14d760a1 netlify: add some missing redirects 2022-12-18 07:54:55 +00:00
David Hewitt b6874b8280 pin CI to 3.11.0 as workaround for 2817 2022-12-18 07:36:19 +00:00
bors[bot] 203ac5d778
Merge #2811
2811: adjust vectorcall symbols for pypy r=davidhewitt a=davidhewitt

Closes #2738

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-17 11:08:00 +00:00
David Hewitt 4a6b24ea07 adjust vectorcall symbols for pypy 2022-12-17 11:07:30 +00:00
bors[bot] 239f8e67b8
Merge #2800
2800: allow `**kwargs` to take arguments which conflict with positional-only parameters r=davidhewitt a=davidhewitt

Closes #2799 

I did a little bit of refactoring at the same time, sorry! The bit which changes behaviour is that in the now-factored-out `handle_kwargs` method, if the keyword argument name is found in the positional-only range then the varkeywords handler is now given a chance to accept it. (Lines 387-390 in new `extract_argument.rs`.)

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-17 09:51:04 +00:00
bors[bot] 0c686c0db5
Merge #2805
2805: check changelog using nox r=messense a=davidhewitt

I wanted to get the green tick when the `CI-skip-changelog` label was applied 😝 

... and I didn't think it hurt to use the same tech we use for the rest of the pipeline.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-17 07:24:45 +00:00
David Hewitt 9e04398a5e check changelog using nox 2022-12-17 07:23:22 +00:00
David Hewitt 33871b7aea allow **kwargs to take arguments which conflict with positional-only parameters 2022-12-17 07:22:28 +00:00
bors[bot] 7180a0b77c
Merge #2810
2810: CI updates for Rust 1.66 r=davidhewitt a=davidhewitt



Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-17 06:16:43 +00:00
David Hewitt 7294e25d17 update clippy allows for new Rust 1.66 lints 2022-12-16 20:59:15 +00:00
David Hewitt f01b245d85 update ui tests for Rust 1.66 2022-12-16 20:56:15 +00:00
bors[bot] 882b9c7aa7
Merge #2806
2806: add .python-version file r=messense a=davidhewitt

This looks like it's recommended for `actions/setup-python` if we don't specify a version in the CI.yml 

It may also be helpful for contributors testing using pyenv?

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-15 05:04:58 +00:00
David Hewitt f837ec0fc1 add .python-version file 2022-12-14 21:33:27 +00:00
bors[bot] 389a662506
Merge #2795
2795: accept any iterator for `PySet::new` and `PyFrozenSet::new` r=birkenfeld a=davidhewitt

Closes #2789 

Looks like it's about 20% faster in the case I benchmarked to use `PySet_Add` directly without the intermediate list.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-09 14:54:51 +00:00
mejrs 44310ec7e0 Forward cfgs on pyclass fields to the method defs 2022-12-06 22:38:32 +01:00
David Hewitt 3295e35a4b accept any iterator for PySet::new and PyFrozenSet::new 2022-12-04 09:54:34 +00:00
David Hewitt 65ead640ee benchmark PySet::new 2022-12-04 08:57:27 +00:00
bors[bot] 55592afdb9
Merge #2771
2771: ci: run pyo3-ffi-check r=davidhewitt a=messense



Co-authored-by: messense <messense@icloud.com>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-12-03 13:35:05 +00:00
messense 272df32277
Add publish = false to pyo3-ffi-check and pytests crate 2022-12-03 21:12:54 +08:00
messense c776792f9d
Allow pyo3-ffi-check failure on PyPy for now 2022-12-03 21:11:40 +08:00
messense 272f7dd07f
Tweak pyo3-ffi-check 2022-12-03 21:11:40 +08:00
David Hewitt a63a782eec
Import pyo3-ffi-check
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2022-12-03 21:11:40 +08:00
messense 9a164bac54
ci: run pyo3-ffi-check 2022-12-03 21:11:36 +08:00
bors[bot] 84d68d44ae
Merge #2788
2788: Define _PyErr_ChainExceptions() FFI for CPython r=davidhewitt a=ijl

This appears to be the only way to chain exceptions via the FFI. It was introduced prior to CPython 3.7. It has some description of usage in PEP 490. There was a discussion of whether it should be made stable in BPO 44938.

Co-authored-by: ijl <ijl@mailbox.org>
2022-12-01 18:57:08 +00:00
ijl d5a31706c6 Define _PyErr_ChainExceptions() FFI for CPython
This appears to be the only way to chain exceptions via the FFI. It
was introduced prior to CPython 3.7. It has some description of usage
in PEP 490. There was a discussion of whether it should be made stable
in BPO 44938.
2022-12-01 15:25:56 +00:00
bors[bot] a67c5782e8
Merge #2791
2791: netlify: fix mdbook update r=messense a=davidhewitt

Fixes the following error on netlify builds:

```text
6:34:54 PM: + '[' 'mdbook v0.4.21' '!=' 'mdbook v0.4.22' ']'
6:34:54 PM: + cargo install mdbook@0.4.22
6:34:54 PM:     Updating crates.io index
6:35:00 PM:  Downloading crates ...
6:35:00 PM:   Downloaded mdbook v0.4.22
6:35:00 PM: error: binary `mdbook` already exists in destination
6:35:00 PM: Add --force to overwrite
```

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-11-30 08:47:43 +00:00
David Hewitt 13db7348a6 netlify: fix mdbook update 2022-11-30 08:31:00 +00:00
bors[bot] a71905052e
Merge #2777
2777: ci: remove `github.sha` from concurrency group r=davidhewitt a=messense

Otherwise duplicate workflow runs on staging/trying branches won't be cancelled automatically.

Co-authored-by: messense <messense@icloud.com>
2022-11-24 08:52:10 +00:00
messense 1f6e2c4ee6
ci: remove github.sha from concurrency group
Otherwise workflow runs on staging/trying branches won't be cancelled
automatically.
2022-11-24 16:19:58 +08:00
bors[bot] 56f11c252d
Merge #2779
2779: Mention `into_py` in docs for PyTuple::new r=davidhewitt a=hauntsaninja

I'm new to Rust / PyO3, and it took me a little bit to figure this out :-)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-11-24 08:14:41 +00:00
Shantanu 95f041281f
Mention into_py in docs for PyTuple::new
I'm new to Rust / PyO3, and it took me a little bit to figure this out :-)
2022-11-23 16:34:59 -08:00
bors[bot] 79f8cbd612
Merge #2776
2776: add abi3-py311 feature r=messense a=davidhewitt

Just noticed this was missing.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2022-11-23 08:31:57 +00:00
David Hewitt 97487ffbb5 add abi3-py311 feature 2022-11-23 08:08:12 +00:00
bors[bot] 101ac1b78d
Merge #2763
2763: Typos, grammar, code style, etc. r=adamreichold a=birkenfeld



Co-authored-by: Georg Brandl <georg@python.org>
2022-11-23 06:43:54 +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