Commit Graph

239 Commits

Author SHA1 Message Date
messense 5472fa6917
Add Windows non-abi3 cross compile test 2022-05-12 14:32:20 +08:00
messense c477718fe7
Add support for generating non-abi3 python import libraries for Windows
targets
2022-05-12 14:32:20 +08:00
Adam Reichold d2caa056e9 release: 0.16.4 2022-04-14 07:56:42 +01:00
messense eb6b6457e2
Enable `generate-abi3-import-lib` feature for maturin-starter when abi3
feature is enabled
2022-04-10 22:11:04 +08:00
messense c5ca6d040b
Add Windows abi3 wheel cross comiplation test 2022-04-10 22:05:30 +08:00
David Hewitt 1ae0971a09 release: 0.16.3 2022-04-05 04:05:57 +01:00
mejrs 6f1cf1b662 Add more lints 2022-03-23 08:07:28 +01:00
Adam Reichold 922bbfc92d release: 0.16.2 2022-03-15 19:20:00 +01:00
David Hewitt 7056bae21f release: 0.16.1 2022-03-05 16:21:44 +00:00
David Hewitt 4c434a21bd release: 0.16.0 2022-02-27 20:28:51 +00:00
David Hewitt 000a903676 ci: build all examples in debug 2022-01-23 08:41:39 +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
mejrs 9512ce4e87 Fix call example 2021-12-22 12:12:16 +01:00
David Hewitt bd3c3adf46 examples: make Cargo.toml files more uniform 2021-12-15 08:28:25 +00:00
David Hewitt 888b10c373 examples: add links to cargo-generate
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
2021-12-15 08:12:43 +00:00
David Hewitt ce7e17c0e6 examples: add cargo-generate configuration 2021-12-15 08:11:46 +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
David Hewitt 415e12cb3c
Merge pull request #2047 from davidhewitt/clippy-workspace
ci: clippy whole workspace
2021-12-14 07:22:19 +00:00
Juniper Parsons 47cf13239f
Disallow positional args after optional args 2021-12-09 10:01:59 -05:00
David Hewitt a5ef9ff64a ci: clippy whole workspace 2021-12-09 08:11:28 +00:00
David Hewitt 8495d77722 examples: use setuptools-rust 1.0.0 2021-11-21 20:39:52 +00:00
David Hewitt da885f696d examples: use pip 21.3 2021-10-13 00:05:33 +01:00
David Hewitt 00ea4bccce examples: export __doc__ in example projects 2021-10-01 09:05:58 +01:00
David Hewitt 06ff76fec2
examples: make `word-count` example comparison fairer 2021-08-13 14:19:46 +01:00
David Hewitt b66f539473 docs: sync README and lib.rs examples 2021-08-02 23:03:25 +01:00
David Hewitt ba0ba14fb8 pyo3-pytests: don't set profile in Cargo.toml 2021-07-31 16:52:30 +01:00
David Hewitt d46d3265cb pypy: fix FFI definition of Py_Buffer 2021-07-24 08:37:22 +01:00
David Hewitt bac1345f4d
Merge pull request #1730 from davidhewitt/pypy-pytests
pyo3-pytests: cover more tests on PyPy
2021-07-19 18:16:06 +01:00
David Hewitt ab4348c30b pyo3-pytests: remove memory leak test 2021-07-18 20:04:46 +01:00
David Hewitt 95cb5c6ef1 pyo3-pytests: cover more tests on PyPy 2021-07-18 19:30:30 +01:00
messense b5b9a480cd Add `wrap_pyfunction` macro to prelude 2021-06-24 22:34:55 +08:00
David Hewitt ab8925572b pyo3-benchmarks: add benchmark for class init 2021-06-22 07:33:46 +01:00
Georg Brandl 6c3f688a60 Add more argument parsing benchmarks.
Change output so that benchmarks belonging together are shown together.
2021-06-06 16:20:09 +02:00
messense bd1045e289 Add support for extracting PathBuf from pathlib.Path 2021-06-05 14:59:26 +08:00
David Hewitt 79c7149d52 pyo3-build-config: new crate to re-use build.rs across crates 2021-05-20 09:03:33 +01:00
Georg Brandl 473474cae7 pyo3_benchmarks: add a benchmark for the "only simple args" case
This is the case that will be helped by fastcall support,
so add it first as a baseline.
2021-05-19 08:17:33 +02:00
David Hewitt f1dd1380a5 examples: use pip 21.1 2021-04-29 08:52:01 +01:00
David Hewitt 0ae7b69295
examples: add links to packaging tools
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2021-04-03 12:50:42 +01:00
David Hewitt 370652eba8 examples: maturin and setuptools_rust examples 2021-04-03 11:59:41 +01:00
David Hewitt fe74160a7d pyo3_benchmarks: benchmarks as separate Python example 2021-03-01 19:12:39 +00:00
David Hewitt 29a525b327 pyfunction: refactor argument extraction 2021-03-01 17:49:46 +00:00
winxton 5498b7ee3c Fix wordcount example docs 2021-02-24 13:41:45 -05:00
David Hewitt b2675b11fe rust 1.50: clippy and lint fixes 2021-02-11 22:03:34 +00:00
David Hewitt 0da12bd0dc ci: deny clippy warnings for examples 2020-12-31 22:11:48 +00:00
David Hewitt 126a74842f rustapi_module: move issue_219 regression test 2020-11-10 14:23:08 +00:00
David Hewitt 33b8aba3bb examples: simplify tox instructions 2020-11-10 12:50:41 +00:00
Yuji Kanagawa 3b3ba4e3ab
Merge pull request #1152 from PyO3/abi3
Complete abi3 support
2020-10-27 23:30:36 +09:00
Arnav Jindal 042337b423
Update lib.rs 2020-10-21 19:37:23 +05:30
Arnav Jindal a3d0c86c1c
Docs: Fixed example word_count 2020-10-21 12:36:36 +05:30
Alex Gaynor 90a825d0c2 Merge branch 'master' into abi3-merge-master 2020-10-19 14:32:49 -04:00
David Hewitt afd9b823d2 Drop support for Python 3.5 2020-10-18 19:02:27 +01:00
Alex Gaynor aabad7cf7f Assorted updates to the abi3 branch from review 2020-10-11 19:51:27 -04:00
Alex Gaynor 140790b15f Merge branch 'master' into abi3-merge-master 2020-10-10 10:11:49 -04:00
kngwyu 2e22066feb Do not test PyPy on Windows 2020-10-08 16:29:50 +09:00
Alex Gaynor 5bfb4674b1 Merge branch 'master' into abi3-merge-master 2020-09-10 17:01:13 -04:00
kngwyu 7a4c5e2960 Merge branch 'master' into abi3 2020-09-10 00:48:20 +09:00
Sebastian Pütz 22881a3c2f Change add_function, ensure static docstrings.
Change add_function to take `&PyCFunction` instead of a wrapper
fn and ensure that dostrings of functions are `&'static str`.
2020-09-09 12:37:37 +02:00
Sebastian Pütz 3214249010 Make python function wrapper creation fallible.
Wrapping a function can fail if we can't get the module name.

Based on suggestion by @kngwyu
2020-09-03 15:48:32 +02:00
Sebastian Pütz 5bbca1a052 Set the module of `#[pyfunction]`s.
Previously neither the module nor the name of the module of
pyfunctions were registered. This commit passes the module and
its name when creating a new pyfunction.

PyModule::add_function and PyModule::add_module have been added and are
set to replace `add_wrapped` in a future release. `add_wrapped` is kept
for compatibility reasons during the transition.

Depending on whether a `PyModule` or `Python` is the argument for the
Python function-wrapper, the module will be registered with the function.
2020-09-03 14:49:28 +02:00
Alex Gaynor 400462063d Proof of concept of using PEP384s PyType_Spec 2020-09-02 16:54:39 -04:00
David Hewitt 4ed9748b45 Rename exceptions to PyException etc; reintroduce deprecated ones 2020-07-18 06:02:57 +01:00
kngwyu 016800ba4d Use travis's pypy binary instead of anaconda 2020-06-27 19:45:31 +09:00
David Hewitt 9f9137c6e4 Add ability to return from `__next__` / `__anext__` 2020-06-23 15:26:28 +01:00
kngwyu f053bc3881 Fix dealloc implementation to collectly use subtype's tp_free 2020-06-22 10:58:00 +09:00
kngwyu b70ee9a5ad Use subclass correctly in tp_new 2020-06-22 01:38:13 +09:00
Alexander Niederbühl d2c7645bad Add benchmark for Python threaded word count
Add benchmark where the sequential Rust version of the word count is
executed twice to demonstrate parallelism with Python threads.  Also
slightly simplify the benchmark functions.
2020-06-05 20:22:20 +02:00
Alexander Niederbühl bafe269dde Set debug to `False` in word-count example 2020-06-05 16:40:29 +02:00
Alexander Niederbühl de9aae1e82 Use string slices as function arguments
Also use the same names as parameters.
2020-06-05 16:40:29 +02:00
Alexander Niederbühl 4c55fa6b38 Remove unnecessary wrapping of test function 2020-06-05 16:40:29 +02:00
Alexander Niederbühl eb73105625 Make benchmarks more comparable 2020-06-05 16:40:29 +02:00
Alexander Niederbühl bcf48c0bd2 Fix clippy lints 2020-06-05 13:53:01 +02:00
Yuji Kanagawa b3566bc7d9
Merge pull request #830 from oconnor663/maxsize
use struct.calcsize("P") rather than platform.machine()
2020-03-29 16:07:57 +09:00
Jack O'Connor d2c07a87d2 xfail a couple of datetime tests on Python 3.5 + macOS 2020-03-29 15:38:42 +09:00
Jack O'Connor 9e23476221 avoid using platform.architecture() to detect 32-bit-ness in datetime tests
Same reasoning as the previous commit.
2020-03-26 14:01:18 -04:00
kngwyu 5280a281c9 Remove GILPool::new_no_pointer 2020-03-26 19:45:32 +09:00
Alexander Niederbühl 0a84c201f7 Revert "Disable segfaulty subclassing by default"
This reverts commit 5096f936dc.
2020-01-12 01:22:32 +01:00
Alexander Niederbühl 3dc5b86f22 Add subclassing testcase which previously caused a segfault
Add a testcase from #407. Both test cases don't segfault after the
change to the #[pyclass] system in #683.

Closes #407
2020-01-11 18:24:50 +01:00
kngwyu acb1120c55 Fix examples with the new #[new] API 2019-12-22 23:59:28 +09:00
kngwyu dadeb17c3a Fix Windows test 2019-11-17 16:34:55 +09:00
Alexander Niederbühl defa43015a Fix handling of invalid utf-8 sequences in PyString::to_string_lossy 2019-10-24 22:45:32 +02:00
Alexander Niederbühl 7aaef51ab0 Define limits for datetime tests as datetime literals 2019-10-21 16:50:43 +02:00
Alexander Niederbühl ffe4e2f20a Make datetime range for tests smaller 2019-10-19 18:28:53 +02:00
Alexander Niederbühl 8cdc0b42dd Fix minimum and maximum for datetime tests
Depending on the local timezone one could get

  ValueError: year 0 is out of range
2019-10-19 17:56:39 +02:00
Samuele Maci 25564e115a Trigger garbage collection before and after calling the rust binding 2019-10-11 18:46:21 +02:00
Samuele Maci 9ff41fcd3b Rename BytesExtractor method names to reflect their actions 2019-10-11 17:59:48 +02:00
Samuele Maci 681996da38 Add assertions around memory_diff in test_pybuffer_doesnot_leak_memory 2019-10-11 16:10:19 +02:00
kngwyu f1bb043b70 Temporaly skip test_buf_and_str for PyPY 2019-09-23 19:25:27 +09:00
kngwyu 05a1a097a9 Remove mem::forget from PyBuffer::release 2019-09-14 16:56:11 +09:00
kngwyu e911828b79 Add a test to detect memory leak of bytes->vec conversion 2019-09-07 17:59:19 +09:00
Yuji Kanagawa 5eb7656a5e
Merge branch 'master' into examples-debug 2019-09-07 11:53:00 +09:00
konstin 73947d84b4
Format examples with black (#590) 2019-09-06 01:16:09 +02:00
konstin 94f6248d87 Compile examples in debug mode 2019-09-05 13:13:06 +02:00
konstin 5096f936dc Disable segfaulty subclassing by default
See https://github.com/PyO3/pyo3/issues/220 and https://github.com/PyO3/pyo3/issues/407 for details on those segfaults
2019-08-05 11:52:47 +02:00
Alexander Niederbühl f22708f140 datetime tests: Remove Python 2 compatibility 2019-07-15 08:13:03 +02:00
Alexander Niederbühl ad0a068a38 Add minimal datetime as testcase which should pass on all platforms 2019-07-15 08:08:51 +02:00
Alexander Niederbühl f642f19167 Increase MIN_DATETIME_FROM_TIMESTAMP for windows
Otherwise test_datetime_from_timestamp will give an OSError. This seems
to be a similar problem as https://bugs.python.org/issue29097
2019-07-15 08:07:14 +02:00
Martin Larralde 99fdafbb88 Allow setting the module name for a pyclass (#499)
* Add `MODULE` const value to `PyTypeInfo` trait

* Allow setting module name in `pyclass` macro arguments

* Add `$module` argument to `pyobject_native_type` macro in `pyo3::types`

* Set the right module for builtin types in `pyo3::types`

* Add `module` argument to example `word_count.WordCounter` class

* Add `module` argument of `pyclass` macro to guide

* Reformat code using `rustfmt`

* Add tests and entry in CHANGELOG.md for `module` argument in `pyclass`

* Make `$module` parameter in `pyobject_native_type` optional

* Make `pyobject_native_type` declare module as `Some("builtins")` by default
2019-06-03 12:18:44 +09:00
kngwyu e4287e4e47 Fix datetime example 2019-05-26 00:39:06 +09:00