Commit Graph

3443 Commits

Author SHA1 Message Date
konstin cb6c287f1f 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-05-01 20:24:34 +02:00
konstin 29fdc05b60 Move the codegen into its own crate
This makes the code generatioin reusable from third party crates.
2018-05-01 20:24:32 +02:00
konstin 5a8f5034d6 Fix make test
This is a follow-up to #147
2018-05-01 20:15:43 +02:00
konstin e3b74498c8
Merge pull request #146 from konstin/modules_and_functions
Add test for module
2018-05-01 19:26:47 +02:00
konstin 4735c2c516
Merge pull request #147 from konstin/proc_macro_path_invoc
Fix compilation on nightly
2018-05-01 18:59:43 +02:00
konstin d0c42dfcc1 Fix compilation on nightly 2018-05-01 15:44:38 +02:00
konstin 2ee1102ef2 Add test for module 2018-04-30 23:32:25 +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