Commit Graph

578 Commits

Author SHA1 Message Date
Andrew J Westlake bc87c57f7c Updated guide to address some issues brought up in the PR 2021-02-08 22:43:21 +00:00
Andrew J Westlake 3b82cf475a Changed instance of Asyncio to `asyncio`
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-02-08 22:43:21 +00:00
Andrew J Westlake b4f338c68d Update guide/src/async-await.md
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2021-02-08 22:43:21 +00:00
Andrew J Westlake 8140dc99ec Fixed typo in README, flattened sections in Cargo Test portion of guide 2021-02-08 22:43:01 +00:00
Andrew J Westlake 946460caeb Added async/await example to the guide, added pyo3-asyncio to list of tools and libraries 2021-02-08 22:41:42 +00:00
David Hewitt 0a7aee14fe guide: organise more chapters into sublevels 2021-01-26 22:09:02 +00:00
David Hewitt dc7bcdaf9b gil: move finalization from prepare_freethreaded_python to
with_embedded_python_interpreter
2021-01-12 07:44:37 +00:00
David Hewitt 7c61c9b7f9 gil: tidy ups to finalization 2021-01-12 07:42:47 +00:00
Daniil Konovalenko abb5829e9c implement Serialize, Deserialize for Py<T> 2021-01-11 22:19:10 +00:00
David Hewitt a8d8003b31 guide: document PYO3_NO_PYTHON on Windows 2021-01-10 10:16:37 +00:00
Auke Willem Oosterhoff c1c4a5ffa5 readme/faq: document `rlib` crate type better 2021-01-06 06:54:44 +00:00
David Hewitt 8e37d378b5
Merge pull request #1347 from davidhewitt/embedding
auto-initialize: new feature to control initializing Python
2021-01-04 21:31:22 +00:00
David Hewitt e0c35d17dd auto-initialize: add CHANGELOG and docs 2021-01-04 21:08:08 +00:00
Daniil Konovalenko 74a8b3257d
Fix #[pyclass] arguments description 2021-01-02 19:03:29 +03:00
David Hewitt a350dd2c20 build: make include dir optional when targeting Windows 2020-12-31 22:02:29 +00:00
David Hewitt 7572962828 abi3: add support for dict and weakref from Python 3.9 2020-12-28 10:22:46 +00:00
David Hewitt 26ca1f5bca Release 0.13 2020-12-22 15:42:04 +00:00
David Hewitt 9e7fa408d4 pyproto: use buffer slots on Python 3.9 and up 2020-12-22 13:33:42 +00:00
David Hewitt 4e650d939d pyproto: remove inventory from implementation 2020-12-20 10:01:30 +00:00
David Hewitt a689ab42c6 macros: rename crates for consistency 2020-12-20 06:39:28 +00:00
David Hewitt 3d6356223e docs: fix warnings 2020-12-18 23:11:10 +00:00
Alex Gaynor 3edd961fa3 Clearly document the limitations of abi3
closes #1288
2020-12-13 10:26:37 -05:00
Yuji Kanagawa 9aa70f7c89
Merge pull request #1263 from PyO3/abi3-min-python
Add abi3-py* features
2020-12-08 12:52:00 +09:00
kngwyu 49143724d5 Rename PYO3_NO_INTERPRETER by PYO3_NO_PYTHON 2020-12-07 17:30:04 +09:00
Yuji Kanagawa 6da6bc9461
Apply suggestions from @davidhewitt
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-12-06 16:06:10 +09:00
kngwyu 1b838504b7 Introduce PYO3_NO_INTERPRETER variable for build script 2020-12-01 23:40:49 +09:00
Patrick Chieppe bba1cf19b3 Add section about Python::check_signals to the FAQ 2020-11-30 11:38:40 +11:00
David Hewitt fc34e41163 pyany: add is_instance 2020-11-22 19:24:59 +00:00
kngwyu 93282e9a70 Note abi3-py* features in the guide and Add CHANGELOG 2020-11-16 00:47:24 +09:00
David Hewitt 9617edfca9 msrv: bump to 1.45 2020-11-12 11:33:08 +00:00
Yuji Kanagawa 3b3ba4e3ab
Merge pull request #1152 from PyO3/abi3
Complete abi3 support
2020-10-27 23:30:36 +09:00
kngwyu eb0e6f6b55 Note the minimum required version of maturin supporting abi3 2020-10-27 13:19:01 +09:00
kngwyu 6627658127 Renew proc-macros for new `#[pyproto]` backend 2020-10-21 01:29:28 +09:00
Alex Gaynor ba6f0ecdfa Merge branch 'master' into abi3-merge-master 2020-10-18 10:47:06 -04:00
David Hewitt 84b893b261 guide: improve "calling Python from Rust" section 2020-10-18 10:08:11 +01:00
David Hewitt 27f2d0ee3b
Merge pull request #1212 from Askaholic/issue/#1055-add-arg-name-to-conversion-error
Enhance error messages of conversion errors
2020-10-18 09:15:42 +01:00
David Hewitt 4a916eb3ed
guide: fix broken link 2020-10-16 09:00:46 +01:00
Askaholic 6724783395
Change wording of PyDowncastError display implementation
Displays type(obj) instead of repr(obj) and uses `cannot` instead of
`can't`
to be more consistent with existing python error messages.

See discussion at #1212.
2020-10-14 17:32:00 -08:00
Alex Gaynor 9e34835b76 Merge branch 'master' into abi3-merge-master 2020-10-12 18:03:14 -04:00
Alex Gaynor aabad7cf7f Assorted updates to the abi3 branch from review 2020-10-11 19:51:27 -04:00
Alex Gaynor 877667a1c6 Improved documentation 2020-10-11 15:18:05 -04:00
Alex Gaynor 140790b15f Merge branch 'master' into abi3-merge-master 2020-10-10 10:11:49 -04:00
David Hewitt 23d9d259a7 migration guide: tiny typo fix 2020-10-10 06:24:57 +01:00
kngwyu 41c2f5a748 Use &'static CStr for representing method names and docs 2020-10-08 17:26:55 +09:00
Alex Gaynor e615ce8c05 Start documenting abi3 support 2020-09-23 18:42:49 -04:00
kngwyu 1985578bb7 Don't compile extends=PyDict test in class.md with abi3 2020-09-20 16:20:08 +09:00
Sebastian Pütz 0a346dfa7c Add documentation for raw_pycfuntion 2020-09-17 09:47:53 +02:00
Alex Gaynor ba1056006a Get all the tests building, everythign except doctests passes! 2020-09-16 08:42:22 -04:00
Alex Gaynor 5bfb4674b1 Merge branch 'master' into abi3-merge-master 2020-09-10 17:01:13 -04:00
David Hewitt 151af7a0b7
Merge pull request #1115 from davidhewitt/std-py-err
Implement std::error::Error for PyErr
2020-09-10 21:17:11 +01:00
David Hewitt 73507dbf5e
Merge pull request #1163 from sebpuetz/pyfunction
Add native Function types.
2020-09-10 19:05:57 +01:00
David Hewitt b9e95dc7c9 Implement std::error::Error for PyErr 2020-09-10 19:04:24 +01: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
Alex Gaynor 117f60bed0 Make PyType::name abi3 compatible
The implementation is more complex, because there's no equivalent to tp_name in the limited API
2020-09-08 12:22:59 -04:00
David Hewitt 16fe583b82
Merge pull request #1143 from sebpuetz/pyfunction-modules
PyModule in #[pyfunction]
2020-09-06 20:55:29 +01:00
David Hewitt a1d6c7a838
Merge pull request #1157 from davidhewitt/conversion-detail
docs: add detail to wrapper type conversions
2020-09-06 20:52:34 +01:00
David Hewitt 192c2c2b2c docs: add detail to wrapper type conversions 2020-09-06 10:21:08 +01:00
Sebastian Pütz 64b06ea9ec Change `add_submodule()` to take `&PyModule`.
The C-exported wrapper generated through `#[pymodule]` is only
required for the top-level module.
2020-09-05 15:54:57 +02:00
David Hewitt 2b0b853912 Add CHANGELOG to the guide 2020-09-05 14:44:39 +01:00
Sebastian Pütz 06cd7c7d5a Fix some more docs. 2020-09-05 11:24:12 +02:00
Sebastian Pütz e65b849ab6 Doc fixes, changelog and rename. 2020-09-05 10:20:22 +02:00
Sebastian Pütz 9137855e81 Add documentation for accessing PyModule in #[pyfunction]s. 2020-09-04 10:02:40 +02:00
Sebastian Pütz 4aae523e54 Rename add_module to add_submodule, documentation fixes. 2020-09-04 09:02:49 +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 81afdaf6cd Start splitting long guide pages into subchapters 2020-09-01 22:44:27 +01:00
David Hewitt f0650ebd94 Add doc for extracting Union via FromPyObject 2020-09-01 22:04:57 +01:00
Yuji Kanagawa 729f2f42e7
Merge pull request #1065 from sebpuetz/union
FromPyObject derivation for structs and enums
2020-08-31 21:28:49 +09:00
Sebastian Pütz 0f32f886b8 More FromPyObject derive suggestions by @davidhewitt 2020-08-30 19:16:59 +02:00
David Hewitt 21cdb8ab7e Add introduction to guide 2020-08-30 13:03:28 +01:00
Sebastian Pütz 53a858c5c1 Add documentation for FromPyObject derivation. 2020-08-30 13:35:06 +02:00
Mario 608aea726c
Allow other Result types in `#[pyfunction]` (#1118)
* Added a couple basic tests

* Implemented suggested change

* Fixed type inference

* cargo fmt

* Finished tests and removed warnings

* Include in CHANGELOG.md

* Moved test into separate file

* &'static str and function rename

* Mention in the book
2020-08-29 08:25:20 +01:00
David Hewitt 16ef96904a
Merge pull request #1114 from mtreinish/hashbrown
Add optional support for conversion from Hashbrown types
2020-08-26 12:48:21 +01:00
Matthew Treinish 659d24e1a9
Add CHANGELOG entry and update conversions guide 2020-08-26 06:37:02 -04:00
David Hewitt 37d23da7d5 Add link to Bazel rules 2020-08-25 23:02:20 +01:00
Rene Leveille 441d7f52b1 apply symlink use case, change variable name 2020-08-19 12:11:14 -04:00
Rene Leveille 7beb272075 find within general lib dir, with new optional env variable 2020-08-18 22:05:29 -04:00
Rene Leveille 5dc907bc5d apply suggestions from review 2020-08-17 18:14:05 -04:00
Rene Leveille 0cd1e5bf19 change documentation 2020-08-17 15:17:34 -04:00
Rene Leveille aef159d4ee appy suggestions from PR 2020-08-17 11:26:30 -04:00
David Hewitt 565e36d989
Merge pull request #1098 from davidhewitt/py-as-into-ref
Py::as_ref and Py::into_ref (remove AsPyRef)
2020-08-11 20:44:53 +01:00
Yuji Kanagawa b17d4fffe2
Merge pull request #1093 from kngwyu/iterator-example
Improve lifetime insertions for #[pyproto]
2020-08-11 18:16:53 +09:00
David Hewitt 6b3c6fdeee Improve docs for Py::as_ref() and Py::into_ref()
Co-authored-by: Georg Brandl <georg@python.org>
2020-08-11 08:36:31 +01:00
Georg Brandl 4467cf51db guide: show exporting create_exception! exceptions in a module 2020-08-10 17:08:52 +02:00
Yuji Kanagawa c4d9ab227e
Merge branch 'master' into iterator-example 2020-08-10 17:11:00 +09:00
kngwyu 093dda375f Improve lifetime insertions for #[pyproto] 2020-08-10 15:18:16 +09:00
David Hewitt 7d0b3b386a Add Py::into_ref 2020-08-09 23:00:34 +01:00
David Hewitt 77ed6d6d69 Remove AsPyRef for just Py::as_ref 2020-08-09 22:47:54 +01:00
David Hewitt 20959ecc92 Rewrite documentation for FromPy and PyObject changes 2020-08-09 12:29:25 +01:00
David Hewitt c44697cd31 Prefer docs.rs doc links 2020-08-08 23:54:11 +01:00
David Hewitt 1f37dbc1a7 Various fixes to edge cases with GILGuard 2020-08-06 14:32:59 +01:00
David Hewitt dc5c2a9b8f Rename PYTHON_SYS_EXECUTABLE to PYO3_PYTHON 2020-08-06 13:27:20 +01:00
Manuel Vázquez Acosta f2ba3e6da7
#1064: Comparisons with __eq__ should not raise TypeError (#1072)
* Add (failing) tests for issue #1064

* Return NotImplemented when richcmp doesn't match the expected type.

* Fix tests that expect TypeError when richcmp returns NotImplemented.

- The python code 'class Other: pass; c2 {} Other()' was raising a NameError:
  c2 not found

- eq and ne never raise a TypeError, so I split the those cases.

* Return NotImplemented for number-like binary operations.

* Add dummy impl PyNumberProtocol for the test struct.

* Rework tests of NotImplemented.

* Make py_ternary_num_func return NotImplemented when type mismatches.

* Return NotImplement for type mismatches in binary inplace operators.

* Reduce boilerplate with `extract_or_return_not_implemented!`

* Extract common definition 'Other' into a function.

* Test explicitly for NotImplemented in the __ipow__ test.

* Add entry in CHANGELOG for PR #1072.

* Add the section 'Emulating numeric types' to the guide.

* Ensure we're returning NotImplemented in tests.

* Simplify the tests: only test we return NotImplemented.

Our previous test were rather indirect: were relying that Python
behaves correctly when we return NotImplemented.

Now we only test that calling a pyclass dunder method returns NotImplemented
when the argument doesn't match the type signature.  This is the expected
behavior.

* Remove reverse operators in tests of NotImplemented

The won't be used because of #844.

* Apply suggestions from code review

Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>

* Add a note about #844 below the list of reflected operations.

Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2020-08-05 22:53:16 +09:00
Michal 'vorner' Vaner e6dd2d980f
docs: Link to pyo3-log in README and the guide
Show how one can log from Rust through the Python's logging facilities.

Related to #1016.
2020-07-19 22:01:22 +02:00
David Hewitt 4ed9748b45 Rename exceptions to PyException etc; reintroduce deprecated ones 2020-07-18 06:02:57 +01:00
David Hewitt a7e0c6bfa7 Make exceptions proper native types. 2020-07-18 01:57:39 +01:00
David Hewitt 4020e4d0c8 Add `Python::with_gil` 2020-07-13 22:37:40 +01:00
David Hewitt 85f1d009ec Add introduction to class.md 2020-07-01 07:44:37 +01:00
konstin 9251748280 Update maturin/setuptools-rust section 2020-06-30 14:20:50 +02:00
kngwyu 6cbe9ff30d Bump version to 0.11.1 2020-06-30 14:53:55 +09:00
kngwyu d76fe7835a Introduce #[pyclass(unsendable)] 2020-06-30 12:30:17 +09:00
David Hewitt f89e9e0eb1 Write migration guide for 0.11 2020-06-27 23:59:44 +09:00
kngwyu fd94a0d55c Bump version to 0.11.0 2020-06-27 23:59:44 +09:00
Yuji Kanagawa e35622b941
Merge pull request #997 from davidhewitt/pyproto-next-return
Add __next__ return
2020-06-24 23:16:35 +09:00
scalexm f5e1dff7eb Update docs now that recursive `#[classattr]` are allowed again 2020-06-23 22:41:23 +02:00
David Hewitt 9f9137c6e4 Add ability to return from `__next__` / `__anext__` 2020-06-23 15:26:28 +01:00
David Hewitt a9c7e12be0 Allow skipping the return type completely for `#[pyproto]` methods returning `()`. 2020-06-23 11:51:02 +01:00
David Hewitt 0c59b05e1f
Merge pull request #996 from davidhewitt/pyproto-simplifications
Refactor `#[pyproto]` Result types
2020-06-23 11:49:39 +01:00
David Hewitt c7a4b4770f Refactor `#[pyproto]` Result types 2020-06-23 11:08:36 +01:00
scalexm 863c0001e1 `LazyStaticType::get_or_init` returns an `*mut` instead of a `&` ref 2020-06-22 22:37:11 +02:00
David Hewitt 646dd19a49 Move cargo test guidelines to faq 2020-06-21 09:18:27 +01:00
Yuji Kanagawa 7075827a03
Merge pull request #969 from PyO3/poc-stable-rust
Stable Rust
2020-06-21 16:54:59 +09:00
kngwyu 404f3981e5 Improve docs and Remove all-stable feature 2020-06-21 16:10:19 +09:00
kngwyu a63e426f6f Some doc and test cleanups mainly around specialization 2020-06-20 12:59:56 +09:00
kngwyu e27c4d75c9 Add a document about nightly feature 2020-06-19 14:50:48 +09:00
David Hewitt a1dbfa8c8c Add pyo3::once_cell::GILOnceCell 2020-06-18 18:53:32 +01:00
konstin 3180e5cc06 POC stable rust (2 tests failing) 2020-06-18 17:21:09 +09:00
Yuji Kanagawa a044f3c322
Merge branch 'master' into slot-provider 2020-06-18 15:49:56 +09:00
Nateckert 4f8c2e767b
Doc trait exposition (#964)
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-06-15 09:58:37 +01:00
David Hewitt f58398d6e3
Rewrite sentence one last time 2020-06-13 08:15:30 +01:00
David Hewitt e73d696f8c
Clarify wording in guide 2020-06-13 08:12:21 +01:00
kngwyu ac2c51c774 Fix typo and revert unintended changes 2020-06-13 15:25:04 +09:00
kngwyu d678093509 Remove specialization from async/sequence methods 2020-06-13 15:25:04 +09:00
David 33617bfffc Require Send for #[pyclass] 2020-06-08 02:06:15 +01:00
Alexander Niederbühl 75d44ca296 Remove getting started chapter from user guide
Since it's exactly the same content as in the README.
2020-06-07 00:26:17 +02:00
Alexander Niederbühl bbf1c39cea Address review comments 2020-06-05 21:24:03 +02:00
Alexander Niederbühl eca93c3ff8 Ignore doctests 2020-06-05 21:02:52 +02:00
Alexander Niederbühl e38a077c29 Fix typos 2020-06-05 20:54:38 +02:00
Alexander Niederbühl cbe3e574b7 Rewrite parallelism chapter in guide 2020-06-05 20:25:07 +02:00
Alexander Niederbühl eadd7b1081 Remove word-count from examples 2020-06-05 16:40:29 +02:00
David Hewitt 29c93c87c7 Remove GetPropertyValue 2020-05-21 18:06:24 +01:00
Yuji Kanagawa 7fd35b2fb6
Merge pull request #937 from davidhewitt/doc-conversion-table
Add conversion table to guide
2020-05-21 16:18:46 +09:00
David Hewitt 2813d2e6c9 Add conversion table to guide 2020-05-19 22:22:38 +01:00
David Hewitt 1e3a7f6f25 Add documentation for `PyModule::import` 2020-05-15 22:05:46 +01:00
kngwyu 837261c860 Bump version to 0.10.1 2020-05-14 20:57:51 +09:00
Yuji Kanagawa 7e4d1c41e3
Bump version to 0.10.0 (#919)
* Bump version to 0.10.0

* Apply suggestions from code review

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* Improve CHANGELOG completeness and messaging

* ObjectProtocol was in prelude

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-05-13 13:24:36 +09:00
kngwyu 9f8b7cd9bf Revert #889 2020-05-12 00:10:49 +09:00
kngwyu 69dba08b01 Use PyMethodsImpl instead of *ProtocolImpl::methods 2020-05-11 20:08:21 +09:00
Yuji Kanagawa 8e84721438
Merge pull request #893 from davidhewitt/safe_acquire_gil
Close soundness hole with acquire_gil
2020-05-09 19:03:15 +09:00
David Hewitt 8ffe8c58b3 Close soundness hole with acquire_gil 2020-05-09 10:41:41 +01:00
scalexm f6ac9a0212 Allow `#[classattr]` on associated constants 2020-05-08 22:30:49 +02:00
Yuji Kanagawa d5eb8f0544
Merge pull request #911 from davidhewitt/remove-objectprotocol
Remove ObjectProtocol
2020-05-08 18:56:52 +09:00
David Hewitt a5ebef4b2e Remove ObjectProtocol; Add methods to PyAny and use Deref 2020-05-08 10:05:19 +01:00
scalexm e3d9544ae0 Add a paragraph to the guide about `#[classattr]` 2020-05-07 21:25:32 +02:00
Alexander Niederbühl 618de30606 Fix broken links in guide 2020-05-04 23:22:42 +02:00
Yuji Kanagawa e9bec070e1
Merge pull request #887 from kngwyu/new-nativetypes
New Native Types and Lighter GILPool
2020-05-03 12:10:43 +09:00
kngwyu 816c50a649 Unify PyMethodsInventoryDispatch and PyMethodsProtocol 2020-05-02 17:48:25 +09:00
kngwyu 8c6cbb605a Better docs for new unchecked_downcast and borrowed objects 2020-05-02 14:58:12 +09:00
Austin Bingham 746c352ca8
Clarified documentation for implementing iteration. (#882)
* Clarified documentation for implementing iteration.

* Updated example so that it compiles.

* Updated PyIterProtocol docs per discussion.

* Added link to Python docs on iterators.

* Improved language regarding iterables and PyIterProtocol.

* Fixed assertion calls.
2020-04-28 17:46:20 +09:00
Martin Larralde f36f19cea4 Update guide to show using `PyRef` within `__iter__` method 2020-04-18 03:57:17 +02:00
Yuji Kanagawa 5add8d1dee
Merge branch 'master' into merge-0.9.2 2020-04-09 17:17:52 +09:00
kngwyu c83d88ba8d Bump version to 0.9.2 2020-04-09 13:00:13 +09:00
kngwyu 8d1678e28e Separate examples and tooling section in README and the guide 2020-04-02 23:56:19 +09:00
konstin f10378f0cf
Fix #833 2020-03-26 12:56:26 +01:00
kngwyu 4759358acb Bump version to 0.9.1 2020-03-23 18:55:24 +09:00
kngwyu 89e5a654ad Bump version to 0.9.0 2020-03-19 13:48:00 +09:00
kngwyu fd739b5879 Refactor links in the guide 2020-03-19 13:47:37 +09:00
Georg Brandl 73b40b1451 guide: PyObject is also for returning stuff to Python 2020-03-18 07:00:13 +01:00
kngwyu 02ee7a5afc Expose PyAny to lib.rs and prelude 2020-03-18 13:38:18 +09:00
Georg Brandl fa2e22b9be
guide: add type overview (#801)
* book: add type overview

fixes #789

Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Co-Authored-By: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>

* Add concrete pointer types to the list.

* Add suggestions from @kngwyu

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2020-03-16 22:57:27 +09:00
Georg Brandl 3f030d46fd
guide: fixes and some minor additions (#802)
* guide: fixes and some minor additions

I went through the guide and fixed some grammar/consistency issues,
and added some wording where I thought it appropriate.

I also reordered the chapters to what I feel is a more natural
flow of concepts.

* Apply suggestions from code review and fix tests

Co-Authored-By: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-03-13 22:53:49 +09:00
kngwyu 433b812a68 Remove ^ from Cargo.toml + small improvements for migration.md 2020-03-13 18:40:43 +09:00
kngwyu 107c0cf1ba Unify AsPyRef for Py<T> to make rust-numpy work 2020-03-09 18:31:43 +09:00
kngwyu a6765e3888 Mention `let obj: T = obj.extract()?;` in migration.md 2020-03-09 16:02:42 +09:00
Yuji Kanagawa 3a0cd8e405 Apply suggestions from georg's review to migration.md
Co-Authored-By: Georg Brandl <georg@python.org>
2020-03-09 14:32:35 +09:00
Yuji Kanagawa 8eb0065e38 Apply suggestions from code review
Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-03-09 14:11:14 +09:00
kngwyu ded83027fa Write migration guide for 0.9 2020-03-09 14:11:14 +09:00
kngwyu 68cfd5e17a Remove redundant empty lines from class.md 2020-03-02 20:54:35 +09:00
kngwyu a12667be25 Add a document about inherting native types 2020-03-02 20:07:23 +09:00
kngwyu ee0c178fed Remove ObjectProtocol::get_base and fix class.md 2020-03-02 13:08:37 +09:00
Yuji Kanagawa 399e4bf9b1
Apply suggestions from code review
Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-03-01 12:43:04 +09:00
kngwyu ff1ae98326 Fix class.md 2020-02-25 21:56:23 +09:00
kngwyu 043b13046a Write docs for PyCell, PyRef, PyRefMut 2020-02-22 16:21:09 +09:00
kngwyu 3d0ee2a28d Use AsRef/AsMut instead of as_super/as_super_mut 2020-02-21 20:37:35 +09:00
Yuji Kanagawa 98d810e662 Apply suggestions from davidhewitt's review
Co-Authored-By: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-02-18 12:51:02 +09:00
kngwyu daca04e5f3 Update class.md and Change super API 2020-02-18 00:19:55 +09:00
kngwyu 2fd2185052 Merge branch 'master' into pycell 2020-02-17 00:07:15 +09:00
Giles Cope 6b4a4e881a Focusing on FromPy rather than IntoPy
(as you get IntoPy for free)

Also try and point out that intoPy doesn't mean it's going to convert
something into a python object.
2020-02-14 06:35:41 +00:00
kngwyu a6fed34e23 Fix clippy warnings in build.rs and tests 2020-02-10 14:53:13 +09:00
kngwyu 3176097a25 Update minumum nightly in travis.yml and get_started 2020-02-10 10:51:37 +09:00
kngwyu a2408cacbb Rename PyClassShell with PyCell 2020-02-08 15:05:13 +09:00
kngwyu 50de21abb7 Use AtomicBool for lazy types 2020-02-08 14:03:57 +09:00
kngwyu 58a0841ff7 Rewrite LazyTypeObjects without once_cell 2020-02-07 00:10:27 +09:00
kngwyu f8de335b00 Make PyTypeInfo::type_object return &'static instead of NonNull 2020-02-06 19:11:59 +09:00
David Hewitt 04f30c5971 Revisions from PR#751 2020-02-03 07:34:42 +00:00
David Hewitt 7531b9fb07 Remove even more uses of `static mut` 2020-01-30 13:24:55 +00:00
David Hewitt 5cbdef6471 Remove static mut from PyTypeInfo implementation 2020-01-30 00:14:27 +00:00
kngwyu 56f68a55cd Bump version to 0.9.0-alpha.1 2020-01-16 20:05:44 +09:00
Alexander Niederbühl cede793ceb Fix some typos in guide 2020-01-12 14:47:54 +01:00
Alexander Niederbühl 0a84c201f7 Revert "Disable segfaulty subclassing by default"
This reverts commit 5096f936dc.
2020-01-12 01:22:32 +01:00
kngwyu 451de182cb Merge branch 'master' into pyclass-new-layout 2020-01-08 17:16:33 +09:00
paddywwoof 894e99998f fix code validation test 2020-01-07 22:06:52 +00:00
paddywwoof 9e599af381 improvements suggested by kngwyu 2020-01-07 21:45:18 +00:00
paddywwoof 3e62c3414a use general sounding module name mymodule 2020-01-07 17:17:40 +00:00
paddywwoof a43824e6f3 added PyModule.add_class to guide and better explanation of arguments 2020-01-07 17:09:37 +00:00
kngwyu f26e07cfd6 Replace IntoInitializer<T> with Into<PyClassInitializer<T>> 2020-01-07 13:08:41 +09:00
kngwyu b602b4bf6c Enhance documentation and tests around #[new] 2020-01-07 12:49:36 +09:00
David Hewitt 60edeb889e Simplify IntoInitializer 2020-01-06 13:19:58 +00:00
kngwyu d22b03edde Bump version to 0.8.5 2020-01-05 16:39:18 +09:00
kngwyu 18e565fab5 New PyClassInitializer 2020-01-05 16:01:05 +09:00
kngwyu 766a520a10 Documentation enhancement 2019-12-29 00:02:48 +09:00
kngwyu 2e3ece8022 Try to enhance class section in the guide 2019-12-24 00:30:46 +09:00
kngwyu d5cff058ef Fix documents and a clippy warning 2019-12-23 02:09:36 +09:00
kngwyu efa16a6dc7 Fix documents accompanied by PyClassShell 2019-12-22 19:41:25 +09:00
kngwyu d8a4ecb476 Bump version to 0.8.4 2019-12-14 15:20:55 +09:00
Yuji Kanagawa 352707c29f
Merge pull request #675 from programmerjake/add-text-signature
add #[text_signature = "..."] attribute
2019-12-07 13:56:33 +09:00
Jacob Lifshay 9a3c47e3cd add text_signature to documentation 2019-11-29 13:22:31 -08:00
Alexander Niederbühl c64848bd20 Fix broken links in guide 2019-11-25 20:34:29 +01:00
kngwyu 935adaa5d5 Bump version to 0.8.3 2019-11-23 17:09:10 +09:00
kngwyu c7016f8e4c Refer guide for nightly install 2019-11-23 15:36:30 +09:00
kngwyu b7b17edc1d Update the link to rust-numpy and tooling section in guide 2019-11-16 15:40:25 +09:00
kngwyu 14d2196ba0 Bump version to 0.8.2 2019-10-26 22:47:19 +09:00
kngwyu d019fe814c Bump version to 0.8.1 2019-10-08 01:52:06 +09:00
Riccardo Magliocchetti fd3d47e037
guide: fixup links to examples/word-count
Relative paths don't work when built in pyo3.rs
2019-10-06 21:25:29 +02:00
Riccardo Magliocchetti 27105c9414
guide: add link to pypy chapter
Instead of referring to the guide.
2019-10-06 21:22:53 +02:00
kngwyu a344999526 [DOC] Add Python from Rust section in the guide 2019-09-23 21:44:42 +09:00
kngwyu 35851b7ff9 Fix documents following the review comment 2019-09-15 22:17:36 +09:00
konstin a3cde076f4 Replace pyo3-pack with maturin 2019-09-06 01:12:37 +02:00
konstin a3e41cc819 Release 0.8.0 2019-09-05 13:18:50 +02:00
kngwyu 96b71bfb76 Merge branch 'master' into parse_args_msg 2019-08-31 17:03:15 +09:00
konstin 30e82a3018 Replace IntoPyObject with IntoPy<PyObject> 2019-08-24 19:23:28 +02:00
Yuji Kanagawa 1f85593d0a
Merge pull request #564 from kngwyu/paste
Replace mashup with paste
2019-08-11 18:42:21 +09:00
kngwyu 21a040b8b4 Change Minimum nightly to 2019-07-19 2019-08-11 16:40:21 +09: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
kngwyu 6dabaf08b3 Update minimum nightly to 1.37 07-12 2019-08-05 16:55:25 +09:00
Alexander Niederbühl 4586702fb7 Fix example in guide
The example was failing with:
`error[E0117]: only traits defined in the current crate can be implemented for arbitrary types`
2019-08-03 22:09:12 +02:00
Joel Höner eb34ce588b
Remove mention of Python 2 2019-07-27 04:45:53 +02:00
Paul Ganssle ca07c48931
Add documentation for new PyGCProtocol behavior 2019-07-14 17:56:36 +02:00
kngwyu c12836edcf Add arg=string example in the method arguments section in the guide 2019-06-21 17:07:51 +09:00
Georg Brandl ab802cd829 Document and test argument parsing annotations for pyfunctions 2019-06-16 22:13:50 +09: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
konstin 0279b3d69f Release 0.7.0 2019-05-26 17:27:14 +09:00
Alexander Niederbühl d64ba9fa3a Bring README.md and get_started.md back in sync 2019-05-07 21:04:37 +02:00
Georg Brandl b289a75c16 Make tons of small fixes in the guide
- spelling/grammar
- update docs.rs links and Cargo.toml examples to 0.6.0
- fix a few factual mistakes I found in the process
2019-05-06 09:46:47 +02:00
Alexander Niederbühl faa3feda3f Merge branch 'master' into doctest 2019-04-23 21:58:09 +02:00
konstin 7149a1fecb
Bump to 0.7.0-alpha.1 (#457) 2019-04-23 18:55:35 +02:00
Omer BenAmram f8bf258602 Support rust extensions for PyPy via cpyext (#393)
* wip

* removed stuff

* removed another change

* implemented minimum amouth of ifdefs to make pypy3 hello world to compile

* implemented minimum amount of ifdefs to make pypy3 hello world to compile

* hacking on build.rs

* compiler is happy!

* few todos remain

* extracted build logic to seperate module

* added pypy test

* finally fixed pypy structs

* removed some todos

* test should now be machine independent

* fixed all pypy3 symbols

* added pypy feature

* removed `is_pypy`

* added pypy2 declerations also

* fix for cpython2

* improved libpypy detection

* added all pypy2 macros

* fixed errneous type

* more fixes

* fix python2 string macros

* modsupport symbol

* fix

* fixed and added many symbols

* fixes

* remove dup

* remove mac-specific config

* fix all name mangling macros

* unite imports

* missing symbol

* fix pybool

* implemented another missing symbol

* it works

* fix merge conflict

* uncomment non default features

* cargo.toml

* Cargo fmt

* small merge fixes

* use newer build version

* whoops

* fix build script

* more build hacks

* some random hiccups

* small fixes

* it builds!

* it builds and runs

* revert everything in FFI2

* revert changes to ffi2

* check python3 for pypy

* tiny fix

* revert ffi2 for real

* revert weird formatting changes

* bring back missing feature

* tiny error

* fix py3.7 issue

* add pypy3.5 6.0 to travis

* remove dbg!

* another tiny fix

* removed some useless annotations, and fixed inlines annotations

* removed `pretty_assertions`

* removed pypy feature from cargo.toml

* fix for Py_CompileStringFlags

* tox runs word_count!

* __dict__ changes are not supported for PyPy

* fix 3.7 and copy comment

* fix test script 😳

* transfer ownership of strings to cpython when possible

* remove cstr! macro

* added missing nuls

* as_bytes() -> b’’ string

* symbol removed by mistake

* properly shim pypy date time API, some tests are passing!

* extension_module tests now not crashing! (some still skipped)

* maybe travis has new pypy version?

* small error on windows (build script)

* fix conditional compilation

* try to make tests run on travis..

* invert condition

* added pytest-faulthandler to facilitate debugging

* correctly name dir

* use full paths

* say —yes to conda

* fix

* syntax error

* change PATH

* fixed a terrible bug with PyTypeObjects in PyPy

* fix PyTypeObject defs

* re-enabled tests!

* all tests are passing!

* make the fix ad-hoc for now

* removed build module

* revert changes that cause an additional GC bug

* prevented buggy test from failing pypy

* removed unused comment

* don’t run coverage on pypy

* removed some erroneous symbols from function calls which are actually macros

* restore py37 pyunicode missing def

* use only `link_name` in PyPy specific declarations

* only setup PyPy when testing against PyPy

* annotation that was eaten during merge

* remove change to  comment by mistake + unnecessary changes to cargo.toml

* xfail dates test only on pypy

* changed comment to be a little more helpful

* cleaned up some warnings

* Update src/ffi3/ceval.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* @konstin PR notes

* rustfmt

* some documentation

* if configured via env var only, default to cpython

* remove extra unsafe

* refer users to guide for pypy

* Update guide/src/pypy.md

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* Update guide/src/pypy.md

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* @konstin applied patch

* check that pypy at least build

* search explicitly for libpypy

* added note about some known unsupported features

* use ld_version

* export PYTHON_SYS_EXECUTABLE to `cargo build` test

* inverted if

* always link pypy dynamically

* remove unused imports

* Apply @kngwyu’s suggestion

* fix tox configuration

* try conda virtualenv

* try to simply not install python at all inside pypy environment

* setup pypy before using “python"

* use system_site_packages

* revert change to .travis

* moved cpyext datetime documentation to module level, and revised it.

* Update src/ffi/datetime.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* rustfmt

* Update src/ffi/datetime.rs

Co-Authored-By: omerbenamram <omerbenamram@gmail.com>

* kept only notes that are relevant to users.

* invert if

* use bash and not sh
2019-04-23 13:18:42 +02:00
Alexander Niederbühl f1b0288d3c Remove docmatic and several workarounds for the doctests 2019-04-19 22:47:21 +02:00
Alexander Niederbühl 5858823e83 Test readme and user guide with doc-comment
Also rename some files for consistency.
2019-04-19 22:38:11 +02:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
konstin 7086141f85 Fix version in docs 2019-03-28 12:58:19 +01:00
konstin 3f27647b1b Bump to 0.6.0 2019-03-28 12:49:59 +01:00
Miles Granger 711155d7ad Update tests & docs with IntoPyDict::into_py_dict(py) 2019-03-20 20:04:00 +01:00
Alexander Niederbühl dc581fa746 Update guide 2019-03-17 20:39:38 +01:00
Alexander Niederbühl 438bd7f616 Refer to PyO3 in a consistent way 2019-03-13 17:26:48 +01:00
Alexander Niederbühl 310e597693 Fix some typos in user guide 2019-03-13 17:14:17 +01:00
konstin ba5bc0f1e6
Merge pull request #387 from Alexander-N/test-examples
Test examples in user guide with travis
2019-03-10 21:37:01 +01:00
konstin 21f2804c3b
Merge pull request #389 from PyO3/c_api_and_stacktrace
Add notes about the c api and stacktraces to the guide
2019-03-10 21:32:21 +01:00