Commit Graph

310 Commits

Author SHA1 Message Date
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
kngwyu 4c60af6934 More detailed explaination about PyRef 2019-02-12 19:13:55 +09:00
kngwyu 73c7f8a5c2 Write about Py<T> in the guide 2019-02-09 22:37:21 +09:00
kngwyu 8259cc5d89 Added a note about `PyRef` and `PyRefMut` in guide 2019-02-08 23:51:37 +09:00
Alexander Niederbühl 638354cc34 Fix some examples in class.md 2019-02-03 14:29:17 +01:00
Alexander Niederbühl 1a47aab36b Fix example in conversion.md 2019-02-03 14:13:47 +01:00
konstin 9e53418aad Less feature(specialization) 2019-02-01 18:09:51 +01:00
konstin 56f2257e90 rust 2018 fixes 2019-02-01 16:23:34 +01:00
konstin ae8a37cd0a Allow 0..n pymethod blocks without specialization 2019-02-01 16:23:34 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 423b5d1099
Merge pull request #327 from StarryInternet/fix-cross-compilation
Implement Basic Cross Compile Support
2019-02-01 13:50:39 +01:00
Matt Pelland d3bb75e4c0
move cross compiling doc to the guide 2019-01-30 18:08:04 -05:00
konstin bb4848f2c2
Merge pull request #329 from Alexander-N/get-started
Update Get Started section in user guide
2019-01-30 16:18:24 +01:00
Luke Hsiao 6fd41a16ae
docs(rust-cpython): fix minor typos 2019-01-28 15:44:17 -08:00
Alexander Niederbühl b132a0bfc5 Update Get Started section in user guide
Use content of README.md for an updated version of
guide/src/get_started.md
2019-01-27 17:28:08 +01:00
Alexander Niederbühl 9e2347b810 Don't require feature when PYTHON_SYS_EXECUTABLE is set
If neither the feature python2 or python3 is used, the version of
PYTHON_SYS_EXECUTABLE is used.

Issue #276
2019-01-07 22:46:01 +01:00
Joel Höner 22a89d07aa
Document function signature reporting 2018-12-07 15:35:02 +01:00
Joel Höner 17535534ea
Fix some minor documentation errors
Pyo3 → PyP3
py::function → pyfunction
paramter → parameter
2018-12-07 15:22:12 +01:00
konstin 790a103753
Merge pull request #291 from PyO3/exception_macros
Refactor the exception macros
2018-12-01 13:04:06 +01:00
Tiago Antao a5de9dcf00
Update building-and-distribution.md 2018-11-30 09:40:28 -05:00
Tiago Rodrigues Antao 08e61694b3 upgrade version reference 2018-11-30 08:50:15 -05:00
konstin 9102f2e364 Refactor the exception macros
* Renamed `py_exception` to `create_exception`
  * The split up of the macros makes it possible to create exception structs with bodies to mimic python exceptions' members
  * Used `Once` to fix a (theoretical) race condition with the is_null check
2018-11-27 23:07:15 +01:00
konstin 9035d54035 Add Documentation on build and linker args 2018-11-19 23:14:21 +01:00
konstin 9c8c5a6063 Rename #[pymodinit] to #[pymodule] 2018-11-15 19:43:29 +01:00
konstin 863ffb161f Add wrap_module macro 2018-11-15 19:43:29 +01:00
konstin 57afb51604 Remove PyToken completely; Fixes #94 2018-11-12 14:42:21 +01:00
konstin fb2349b6ec Remove PyToken usages from tests 2018-11-12 14:41:29 +01:00
konstin 234e2c6998 Release 0.5.0-alpha.3 to fix #256 2018-11-02 16:34:40 +01:00
kngwyu 0859392d1c Fix url from guide to doc 2018-10-04 16:36:30 +09:00
kngwyu 3620aae503 Build rust doc on travis 2018-10-04 16:19:36 +09:00
konstin 5100676497 Splitted PyTypeCreate of PyTypeObject to remove specialization 2018-10-03 22:12:22 +02:00
konstin 302c099a76 Big refactoring to shrink the prelude 2018-09-21 23:34:28 +02:00
konstin 9405ffa3b9 Add section about linking in the guide 2018-09-09 18:49:03 +02:00
konstin f3c98ca7ba Move setuptools-rust documentation to setuptools-rust 2018-09-06 18:03:15 +02:00
konstin f58549f1d8 Get rid of a bunch of PyTokens 2018-09-02 23:33:45 +02:00
konstin 7c0379b13a Remove many specialization uses
From over a hundret "default fn" uses down to 17
2018-08-25 20:48:17 +02:00
konstin 771d59b913 Fix another bunch of clippy lints 2018-08-21 23:51:13 +02:00
konstin 9cadbd11de v0.4.1 2018-08-20 14:34:34 +02:00
konstin 991a8b94d2 More nightly fixes 2018-08-19 20:42:17 +02:00
konstin b12b65cfae Cleanup 2018-08-19 20:06:47 +02:00
konstin d0ed68414a Many small improvements 2018-08-04 19:56:59 +02:00
konstin 3adcac6e61 Replace concat_idents with mashup 2018-07-18 23:17:05 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin dbd74401eb Rename the `base` option in the `pyclass` macro to `extends`
"extends" is intuitive for people with java or ES6 experience, and it also aligns pyo3 with
wasm-bindgen (see https://github.com/rustwasm/rfcs/pull/2)
2018-07-15 12:08:20 +02:00
konstin fe931a594f #[pymodinit] now uses the function name as default module name 2018-07-10 00:13:02 +02:00
konstin 4013d40897 Add `py` prefix to the proc macros and move them into the root module
This is important because `proc_macro_path_invoc` isn't going to be stabilized soon.
2018-07-08 23:33:48 +02:00
konstin 6645708e4f Get rid of #[py*] methods 2018-07-03 20:42:02 +02:00
konstin f2be73c4f3 Fix tests 2018-06-14 16:20:55 +02:00
konstin 785d338700 Add a few notes on debugging 2018-06-14 16:17:49 +02:00
konstin 9cb5321317
Merge pull request #183 from peng1999/master
Fix broken links
2018-06-14 16:05:23 +02:00
Peng Guanwen ce4c217527 Fix broken links
This fixes #182
2018-06-14 08:10:39 +00:00
konstin 76510bdd0e Refactoring
This is actually a failed bugfix attempt, but still useful
2018-06-13 18:02:45 +02:00
konstin 314a4a2b3e Some more documentation work 2018-05-19 17:27:26 +02:00
konstin 319afe1f76 Small documentation improvements 2018-05-17 23:59:38 +02:00
Martin Larralde 0b75334b70 Update `book.toml` to new `mdbook` format [ci skip] 2018-05-17 11:57:09 +02:00
konstin 858a124374 Merge master 2018-05-05 15:50:04 +02:00
konstin 57048bc5fc Merge branch 'master' into capybara 2018-05-02 19:32:56 +02:00
konstin 15204bab56 Better way to add functions to modules 2018-05-02 19:26:54 +02:00
Martin Larralde b80b85539b Remove occurrences of `py::methods` and `py::class` 2018-05-01 23:17:42 +02:00
Martin Larralde 4dccd556b7 Fix `conversions.md` stubs to work with Py2 as well 2018-05-01 22:59:49 +02:00
Martin Larralde 0963a6052c Add stubs to `conversions.md` to allow more tests to run 2018-05-01 22:59:49 +02:00
Martin Larralde f12af1653d Fix guide documentation to pass doctests 2018-05-01 22:59:49 +02:00
Martin Larralde aed4af9a1e Add documentation tests for `guide/exception.md` 2018-05-01 22:59:49 +02:00
Martin Larralde 79491db60a Add documentation tests for `guide/overview.md` 2018-05-01 22:59:49 +02:00
konstin 0880ac166c Merge master 2018-05-01 20:41:35 +02:00
konstin d0c42dfcc1 Fix compilation on nightly 2018-05-01 15:44:38 +02:00
konstin 6113428746 Allow defining functions outside of the module declarations
This commit consists of
 * a proc macro to convert rust functions into python functions (`#[function]`),
 * a macro to register a function in a module (`add_function_to_module!`)
 * Documenting both the old and the new way in the book
2018-04-30 23:17:09 +02:00
Vlad Shcherbina 2aedbffcd0 Fix typos 2018-03-15 14:41:16 +03:00
Roy Wellington Ⅳ 80502bd307 Change type of kwargs in the example to Option<PyDict>
That's what the immediately preceding paragraph says the type is, and that
would make more sense.
2018-03-15 14:27:45 +03:00
Roy Wellington Ⅳ 24eee46128 Fix typos and other minor touchups to guide
* Fix some typos
* Capitalize Rust, acronyms
* Remove some trailing whitespace
2018-03-15 14:27:45 +03:00
Vlad Shcherbina f8d914cac8 Fix broken links
https://pyo3.github.io/PyO3 -> https://pyo3.github.io/pyo3
in the documentation.
2018-02-14 17:21:17 +03:00
Brian Anderson 473b1f8b30 Use version 0.2 in guide overview 2018-02-13 00:14:51 +03:00
Guanqun Lu 81f31153aa doc fixes 2017-12-27 23:10:19 +08:00
Nikolay Kim 050397b723 mark method that work with raw pointer unsafe 2017-12-26 13:41:27 -08:00
dkao1978 eb9050ab90 Add documentation for compiling on MacOS (#89)
* Update README.md

* Update overview.md

* Update lib.rs

* Update README.md

* Add links
2017-10-22 11:17:35 +08:00
messense 70c7b4a2a2
Use pyo3 0.2 in docs 2017-08-15 09:30:55 +08:00
Nikolay Kim ed8599cfd3 refactor __new__ method implementation 2017-08-08 00:27:33 -07:00
messense 59d9f9e453
Finish wheel build section in distribution guide 2017-08-07 11:43:49 +08:00
messense 1ad8ad102a
Finish parallelism user guide 2017-08-06 13:50:28 +08:00
messense 268d7fd3d2 Generate getters/setters (#76) 2017-08-05 10:53:23 +08:00
Nikolay Kim a61c5e56a0 add convenience method to PyErr and exception types 2017-08-04 11:47:35 -07:00
Nikolay Kim 85baa8bfce fix doc links 2017-08-03 16:58:13 -07:00
Nikolay Kim 06a0b0514b add IntoPyDictPointer impl for tuple 2017-08-03 15:42:32 -07:00
Nikolay Kim c44e23f4b9 add prelude mod 2017-07-31 10:42:55 -07:00
messense 0e2afb7b8b Add __dict__ support (#68) 2017-07-28 22:21:59 +08:00
Nikolay Kim afcfed492b only c classes only as base class 2017-07-27 19:47:01 -07:00
messense ebcd4f5a33 subclass support (#64) 2017-07-27 23:05:15 +08:00
Nikolay Kim 181e38b551 add guid entry for base class 2017-07-26 22:40:47 -07:00
Nikolay Kim d567817035 add base support for inheritance 2017-07-26 22:29:55 -07:00
Nikolay Kim fc3ab84bfa better constrain for PyNativeException::new 2017-07-26 14:56:08 -07:00
Nikolay Kim a4fd878cb7 pyerr cleanups 2017-07-26 14:28:04 -07:00
Nikolay Kim a20230e73f Create rust type for exceptions defined in python #45 2017-07-26 12:56:07 -07:00
Nikolay Kim e45eb6e878 rename ToPyErr to PyErrArguments 2017-07-26 10:47:17 -07:00
Nikolay Kim b250ad22ca update guide related to exception 2017-07-26 09:16:26 -07:00
Nikolay Kim 3ab5e4526c add weakref support #56 2017-07-24 13:03:18 -07:00
Nikolay Kim ce15dda5b6 Allow to add gc support without implementing PyGCProtocol #57 2017-07-24 12:19:05 -07:00
Nikolay Kim e31557dd33 some docs 2017-07-23 10:51:30 -07:00
Nikolay Kim 98bdf63a4d use const_fn for type size and offset calculation 2017-07-21 09:48:48 -07:00
Nikolay Kim c6067b90c1 more docs 2017-07-18 14:15:44 -07:00
Nikolay Kim fc1df289bd drop PyClone trait; doc cleanups 2017-07-18 10:13:50 -07:00
Nikolay Kim c5f5620f77 rename token() to py() 2017-07-13 19:04:00 -07:00
Nikolay Kim 8eb5dc0667 use associated consts 2017-07-13 16:45:50 -07:00
Nikolay Kim 52ade64bf7 update links 2017-07-13 13:14:47 -07:00
Nikolay Kim 6b093af3d9 update readme 2017-06-29 11:26:25 +06:00
Nikolay Kim f494f0c3df update class.md 2017-06-28 00:34:32 +06:00
messense 379f178dfb
Typo fix in class.md 2017-06-27 21:25:41 +08:00
messense b36e75e307
Some distribution guide doc 2017-06-27 21:09:16 +08:00
Nikolay Kim 800fa231ba fix class,md 2017-06-27 05:32:02 +06:00
Nikolay Kim 8bc1195f12 Merge branch 'master' of github.com:PyO3/PyO3 2017-06-27 05:06:09 +06:00
Nikolay Kim 51544b8642 add some docs 2017-06-27 05:05:54 +06:00
messense a00e23a594
Update conversions chapter 2017-06-25 19:31:32 +08:00
messense d4a5a46338
Write Python Exception chapter for user guide 2017-06-19 13:30:15 +08:00
messense 55ece55b3e
Add ownership and lifetime, error handling doc to overview 2017-06-19 11:40:13 +08:00
Nikolay Kim 005c36548b add specialization to docs 2017-06-18 09:28:21 -07:00
messense 75d6684d25
Clarify Python module doc string 2017-06-18 23:15:10 +08:00
messense 32e25c8bf2
Write Python Module chapter for user guide 2017-06-18 13:07:05 +08:00
messense 7466097780 User guide documentaion (#37)
User guide documentaion
2017-06-18 10:02:02 +08:00