Commit Graph

787 Commits

Author SHA1 Message Date
konstin 0880ac166c Merge master 2018-05-01 20:41:35 +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
konstin 7f68835877 Add unit test for module 2018-04-30 22:38:48 +02:00
konstin 1c276105e5 Generate better code
This reduces the size of the generated code and elinates at least two of the Err => Err antipatterns
2018-04-12 23:20:35 +02:00
konstin 1c0eac2690 Minor changes 2018-04-09 00:00:20 +02:00
konstin ccbc73a385 Fix compilation on older nightlies 2018-04-08 00:43:49 +02:00
konstin 45bb09b3e8 Relax return type requirements
Allows returning essentially arbitrary types by wrapping them into a PyResult. This is done with a conversion trait that specializes for PyResult.
2018-04-06 17:22:09 +02:00
konstin ced4eb532c Expect the pyo3 crate to be in scope for the codegen
This allows using generated code from crates that do not directly depend on pyo3.

E.g.:

```rust
extern crate my_pyo3_wrapper;

use my_pyo3_wrapper::pyo3;

#[py::modinit(rust2py)]
fn init_mod(py: Python, m: &PyModule) -> PyResult<()> {
    // ...
    Ok(())
}
2018-04-05 13:39:07 +02:00
konstin e570c6b9b9 Move the codegen into its own crate
This makes the code generatioin reusable from third party crates.
2018-04-05 13:39:07 +02:00
Nikolay Kim 14ab12b89f move doc generation to asfter script section 2018-04-03 10:32:10 -07:00
Nikolay Kim cab682d855 use rust bin dir instead 2018-04-03 10:15:57 -07:00
Nikolay Kim 6b665e9a82 create cargo dir 2018-04-03 10:15:04 -07:00
Nikolay Kim a5d0b30227 use precompiled mdbook 2018-03-30 14:51:13 -07:00
Nikolay Kim 0982cba184 use precompiled mdbook 2018-03-30 14:29:36 -07:00
Nikolay Kim 6719e152ba
Merge pull request #137 from PyO3/try_from_fixes
use PyTryFrom explicitly (fixes for 1.26.0-nightly)
2018-03-29 07:40:58 -07:00
Alexey Popravka e66c5ebb83 use PyTryFrom explicitly 2018-03-29 17:36:05 +03: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 5dc5c534df Enable backtrace on AppVeyor too
Alto to hopefully diagnose intermittent failures.
2018-03-15 13:51:12 +03:00
Vlad Shcherbina 5198fccaeb Enable backtrace
To simplify troubleshooting on the build server.
2018-03-14 01:05:47 +03:00
Nikolay Kim ffee21cb1f
Merge pull request #130 from ethanhs/pep523
Add PEP 523 frame eval API methods and definitions
2018-03-01 19:55:20 -08:00
Ethan Smith 5cc6dc74d4
conditionally include Python3.6 items 2018-03-01 14:46:27 -08:00
Ethan Smith 6c25a753b8
Add PEP 523 frame eval API things 2018-03-01 13:36:16 -08:00
Nikolay Kim 4585f990b7
Merge pull request #128 from Eijebong/log
Bump log to 0.4
2018-02-27 09:08:56 -08:00
Bastien Orivel 7278f4275d Bump log to 0.4 2018-02-27 18:05:29 +01:00
Nikolay Kim d3a762ea9f
Merge pull request #127 from d0c-s4vage/hotfix-fix_word_count_cls_example-126
Synchronizes word-count-cls example README and code
2018-02-26 13:18:38 -08:00
James Johnson 8844502775 Syntax error in README changes.
see #126
2018-02-26 15:05:31 -06:00
James Johnson a923f8b5d3 Synchronizes word-count-cls example README and code.
see #126
2018-02-26 15:03:29 -06:00
Nikolay Kim 2c0a866029
Merge pull request #121 from thanatos/token-typo
Fix minor typos in example code
2018-02-23 01:48:41 -08:00
Roy Wellington Ⅳ 11e2163bb4 Fix minor typos in example code 2018-02-22 22:22:37 -08:00
Nikolay Kim 25514f69da
Merge pull request #118 from althonos/patch-1
Fix wrong macro being tagged with `macro_export`
2018-02-21 14:25:37 -08:00
Martin Larralde e58cd1c585 Fix wrong macro being tagged with `macro_export` 2018-02-21 22:44:56 +01:00
Nikolay Kim d00abc1fa7 use pyo3cls 2018-02-21 10:43:52 -08:00
Nikolay Kim 524fdeeea5 update changes 2018-02-21 10:35:49 -08:00
Nikolay Kim 995ec109c3
Merge pull request #116 from althonos/master
Allow importing exceptions from nested modules
2018-02-21 10:35:11 -08:00
Nikolay Kim e585f5881d update num-traits 2018-02-21 10:33:38 -08:00
Nikolay Kim 057660e546 fix python3.7 support 2018-02-21 10:29:14 -08:00
Martin Larralde cce9d0de56 Allow importing exceptions from nested modules 2018-02-21 19:16:17 +01:00
Nikolay Kim d50d1fb7ea enable python3.7 builds 2018-02-21 10:06:48 -08:00
Nikolay Kim 5b9696945f wrong log version 2018-02-21 09:42:52 -08:00
Nikolay Kim 0b9557a245 call_method*() crashes when the method does not exist #113 2018-02-21 09:39:06 -08:00
Nikolay Kim b7a8d25338 const fns that we use are stable now 2018-02-21 09:23:58 -08:00
Nikolay Kim 438f4bf091 ignore some python code in doc strings 2018-02-21 09:23:52 -08:00
Vlad Shcherbina 4eb22a3c20 Travis: move doc build step to `script` #115
To ensure that doc build failures aren't silently ignored.
2018-02-14 20:45:08 +03:00
Vlad Shcherbina c4939ab9d7 Fix documentation build (hopefully) #115 2018-02-14 19:23:09 +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
Vlad Shcherbina a59e1dc8ad Fix unused_parens warnings
I left the parentheses in place to keep the resemblance
to the original C macros.
2018-02-12 14:36:05 +03:00
Nikolay Kim 30baa990f8
Update CHANGES.txt 2018-02-11 09:38:50 -08:00