Commit Graph

104 Commits

Author SHA1 Message Date
messense 5b94241bd7
Add `PyMemoryView` type 2023-10-15 17:32:09 +08:00
David Hewitt e1d4173827 Fix bug in default implementation of `__ne__` 2023-10-11 09:48:06 +01:00
David Hewitt 2daddb4734 unify 3.12 and pre-3.12 exception handling pathways 2023-09-30 23:27:27 +01:00
David Hewitt f335f42197
Merge pull request #3446 from davidhewitt/relax-import-check
relax multiple-import check to only prevent subinterpreters
2023-09-29 16:35:31 +00:00
David Hewitt 1a349c2eb7 adjust cfgs for windows 3.9 2023-09-29 14:23:18 +01:00
David Hewitt 1e8833e15e always normalize exceptions before raising 2023-09-24 13:38:23 +01:00
David Hewitt f17e703167 return existing module on Python 3.9 and up 2023-09-23 11:13:39 +01:00
David Hewitt 1338020511 relax multiple-import check to only prevent subinterpreters 2023-09-23 11:13:39 +01:00
Tpt 1e5a49557d Makes PathBuf FromPyObject implementation work on all os.PathLike
PyOS_FSPath is in abi3-py36
2023-08-08 22:15:56 +02:00
David Hewitt d395fe8653 ci: avoid failure to build numpy on 3.12 2023-07-22 21:38:57 +01:00
David Hewitt b65cbb958b ci: updates for rust 1.71 2023-07-14 12:10:37 +01:00
Adam Reichold a0c85bb649
Merge pull request #3240 from davidhewitt/maturin-versions
bump maturin version in example files
2023-06-14 08:24:31 +00:00
David Hewitt 5fd5dcba44 bump maturin version in example files 2023-06-14 08:45:32 +01:00
David Hewitt 4f3fcdbf0f remove all functionality deprecated in PyO3 0.18 2023-06-13 22:27:43 +01:00
Adam Reichold 0d30bb7d3d Bump Rust edition to 2021 and make current Clippy happy. 2023-06-07 21:15:38 +02:00
bors[bot] dbf7b233aa
Merge #3203
3203: support ordering magic methods for `#[pyclass]` r=adamreichold a=davidhewitt

Closes #2089 

This adds `__lt__`, `__le__`, `__eq__`, `__ne__`, `__gt__`, and `__ge__` as per the Python implementations of what we call `__richcmp__`.

There's a UI test confirming that the user cannot implement split forms and `__richcmp__` simultaneously.

There's also a benchmark comparing implementing these split methods against using `__richcmp__`. I couldn't see a meaningful performance difference, so I'm tempted to deprecate `__richcmp__`, given that's not a magic method which exists in Python. Potentially we can provide options such as the opt-in `#[pyclass(eq, ord)]` to avoid boilerplate for people who don't want to implement six different methods.



Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-06-05 07:13:23 +00:00
David Hewitt 5bc3e6f15e fix clippy warnings uncovered by msrv bump 2023-06-05 07:08:27 +01:00
David Hewitt 8850d5d384 support ordering magic methods for `#[pyclass]` 2023-06-04 13:58:18 +01:00
Stu Hood 20c5618160
Add support for combining the `#[new]` and `#[classmethod]` method types. 2023-05-16 15:51:14 -07:00
David Hewitt dd24c9ea71 remove `Python::acquire_gil` 2023-05-09 09:39:23 +02:00
David Hewitt 0362855773 make rust benchmarks more similar to the Python ones 2023-01-20 07:24:05 +00:00
David Hewitt 16d347d96a remove benchmarks from deprecated_pyfunctions 2023-01-20 07:19:13 +00:00
David Hewitt 8f48d157d6 deprecate required arguments after option arguments without signature 2023-01-15 10:17:20 +00:00
messense 272df32277
Add `publish = false` to pyo3-ffi-check and pytests crate 2022-12-03 21:12:54 +08:00
Alex Gaynor f7a487b809
Use a TypeError, rather than a ValueError, when refusing to treat a str as a Vec
This is far more consistent with how these exceptions are usually used
2022-11-07 07:48:13 -05:00
David Hewitt 8e8b484169
add `#[pyo3(signature = (...))]` attribute (#2702) 2022-10-25 07:23:21 +01:00
Adam Reichold f456ed7586 Also relax the PySequence check when extracting fixed-sized arrays. 2022-10-13 09:43:45 +02:00
Adam Reichold b2da5b20b1 Add a Python test exploring from which types a Vec can be extracted. 2022-09-21 09:47:05 +02:00
David Hewitt 5ca3001957 examples: update maturin to 0.13 2022-08-18 08:17:53 +01:00
mejrs fc6121eafe Deprecate acquire_gil 2022-08-15 03:34:47 +02:00
David Hewitt 78ba70d2b4 pymodule: only allow initializing once per process 2022-08-09 19:52:25 +01:00
David Hewitt 7babd13830 datetime: support timezone bindings 2022-07-13 22:05:17 +01:00
David Hewitt cdf86482d8 ffi: many fixes to pypy definitions 2022-06-04 12:47:40 +01:00
Adam Reichold 0d0089ea29 Remove redundant use statements and add missing calls to add_function in datetime test. 2022-04-13 09:40:16 +02:00
Ivan Tham a1f97f164d Add PyTzInfoAccess 2022-04-13 00:00:08 +08:00
mejrs 2eb51ceba9 Make clippy happy 2022-04-07 23:14:45 +02:00
mejrs 6f1cf1b662 Add more lints 2022-03-23 08:07:28 +01:00
Bruno Kolenbrander 16ad15e04f
Expand on xtask (#2176)
* Fix Windows OSError

* Ignore .pyd files

* Put things in modules

* Rename functions to `run`

* Expand on cargo xtask

* Try to work around missing installs

* Run all things by default, but not llvm-cov

* Test msrv

* Fix more OSErrors

* Various refinements and docs

* Various refinements

* Various refinements
2022-03-18 22:13:23 +00:00
David Hewitt ddf13ea98f clippy: enable some more lints 2022-03-03 07:23:28 +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 3ed0df1169 update black to 22.1.0 2022-02-14 07:42:06 +00:00
David Hewitt 558549e1c2 pyproto: split into new feature 2022-02-05 16:51:31 +00:00
David Hewitt 8b47f4f120 pytests: merge benchmark and test crates 2022-02-05 10:16:46 +00:00
David Hewitt 1beb2bbb2d opt: optimize argument extraction 2022-02-04 20:53:49 +00:00
David Hewitt 000a903676 ci: build all examples in debug 2022-01-23 08:41:39 +00:00
David Hewitt 0991aa9f37 ci: add coverage for pytests 2022-01-22 20:06:57 +00:00
David Hewitt ea6a44a58f add maturin to requirements-dev files 2022-01-17 08:19:54 +00:00
messense 081c8082cb Use `--no-build-isolation` 2022-01-17 10:02:03 +08:00
messense ce80b7e0f3 Switch from tox to nox 2022-01-17 00:24:33 +08:00
David Hewitt dc8032a5ff pyfunction: allow required positional after option 2022-01-11 00:44:41 +00:00
David Hewitt ff37f24625 macros: accept paths in wrap_x macros 2021-12-30 12:46:57 +00:00
David Hewitt 90479ddae4 opt: make argument extraction code smaller 2021-12-24 01:52:15 +00: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