Commit Graph

266 Commits

Author SHA1 Message Date
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
Alexander Niederbühl e2e4733b82 Test examples in user guide with travis
Test could only be activated for Python 3.5 and some tests had to be
ignored, see #381 and #387.
2019-03-09 23:54:28 +01:00
Alexander Niederbühl ae93e71a30 Fix some typos and grammar in class.md 2019-03-07 22:21:16 +01:00
konstin 41ffe1ecdd Add notes about the c api and stacktraces to the guide 2019-03-04 23:18:54 +01:00
Alexander Niederbühl 1ea59296ae Fix PyRef example 2019-03-03 20:18:55 +01:00
Alexander Niederbühl 2327882dc5 Fix examples 2019-03-01 20:32:55 +01:00
konstin 6cd07c369c Simpler new and clippy fixes 2019-02-23 18:38:00 +01:00
konstin ad590bd158 Some api improvements 2019-02-23 18:01:22 +01:00
konstin 0cd72ac213 Bump to 0.6.0-alpha.4 2019-02-20 11:30:09 +01:00
konstin d02f7c3aa5 Big proc macro refactoring
* Removed a lot of clutter, unified some code
 * Started using syn::parse::Parse for pyfunction attributes 
 * No more newlines between imports
 * Renamed `#[prop(get, set)]` to `#[pyo3(get, set)]`
 * `#[pyfunction]` now supports the same arguments as `#[pyfn()]`
 * Some macros now emit proper spanned errors instead of panics.
2019-02-18 20:07:56 +01:00
konstin 1a489d2829 Make the init methods use a value instead of a function 2019-02-13 13:59:47 +01:00
konstin c13f0708a4 Replace IntoPyTuple with IntoPy<Py<PyTuple>> 2019-02-12 22:58:23 +01:00
konstin 1d17463532
Merge pull request #335 from kngwyu/rethink-pyclass
Remove ToPyPointer and so on from pyclass
2019-02-12 22:56:23 +01:00