From a689ab42c6db85b361dd52310b8f727c4bc0911d Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sun, 13 Dec 2020 11:29:39 +0000 Subject: [PATCH] macros: rename crates for consistency --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 1 + Cargo.toml | 8 ++++---- Makefile | 4 ++-- guide/src/class.md | 2 +- {pyo3-derive-backend => pyo3-macros-backend}/Cargo.toml | 2 +- {pyo3-derive-backend => pyo3-macros-backend}/LICENSE | 0 {pyo3-derive-backend => pyo3-macros-backend}/src/defs.rs | 0 .../src/from_pyobject.rs | 0 {pyo3-derive-backend => pyo3-macros-backend}/src/konst.rs | 0 {pyo3-derive-backend => pyo3-macros-backend}/src/lib.rs | 0 .../src/method.rs | 0 .../src/module.rs | 0 .../src/proto_method.rs | 0 .../src/pyclass.rs | 0 .../src/pyfunction.rs | 0 .../src/pyimpl.rs | 0 .../src/pymethod.rs | 0 .../src/pyproto.rs | 0 {pyo3-derive-backend => pyo3-macros-backend}/src/utils.rs | 0 {pyo3cls => pyo3-macros}/Cargo.toml | 4 ++-- {pyo3cls => pyo3-macros}/LICENSE | 0 {pyo3cls => pyo3-macros}/src/lib.rs | 2 +- src/lib.rs | 4 ++-- src/prelude.rs | 2 +- 25 files changed, 16 insertions(+), 15 deletions(-) rename {pyo3-derive-backend => pyo3-macros-backend}/Cargo.toml (96%) rename {pyo3-derive-backend => pyo3-macros-backend}/LICENSE (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/defs.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/from_pyobject.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/konst.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/lib.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/method.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/module.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/proto_method.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/pyclass.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/pyfunction.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/pyimpl.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/pymethod.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/pyproto.rs (100%) rename {pyo3-derive-backend => pyo3-macros-backend}/src/utils.rs (100%) rename {pyo3cls => pyo3-macros}/Cargo.toml (85%) rename {pyo3cls => pyo3-macros}/LICENSE (100%) rename {pyo3cls => pyo3-macros}/src/lib.rs (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26ff6615..f065e642 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: run: cargo test --no-default-features --features "abi3,macros" --target ${{ matrix.platform.rust-target }} - name: Test proc-macro code - run: cargo test --manifest-path=pyo3-derive-backend/Cargo.toml --target ${{ matrix.platform.rust-target }} + run: cargo test --manifest-path=pyo3-macros-backend/Cargo.toml --target ${{ matrix.platform.rust-target }} - name: Install python test dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index a57f1a2d..be519b75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Bump minimum supported Rust version to 1.45. [#1272](https://github.com/PyO3/pyo3/pull/1272) - Bump indoc dependency to 1.0. [#1272](https://github.com/PyO3/pyo3/pull/1272) - Bump paste dependency to 1.0. [#1272](https://github.com/PyO3/pyo3/pull/1272) +- Rename internal crates `pyo3cls` and `pyo3-derive-backend` to `pyo3-macros` and `pyo3-macros-backend` respectively. [#1317](https://github.com/PyO3/pyo3/pull/1317) ### Added - Add support for building for CPython limited API. This required a few minor changes to runtime behaviour of of pyo3 `#[pyclass]` types. See the migration guide for full details. [#1152](https://github.com/PyO3/pyo3/pull/1152) diff --git a/Cargo.toml b/Cargo.toml index bc71b3a5..41369cc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ parking_lot = "0.11.0" num-bigint = { version = "0.3", optional = true } num-complex = { version = "0.3", optional = true } paste = { version = "1.0.3", optional = true } -pyo3cls = { path = "pyo3cls", version = "=0.12.4", optional = true } +pyo3-macros = { path = "pyo3-macros", version = "=0.12.4", optional = true } unindent = { version = "0.1.4", optional = true } hashbrown = { version = "0.9", optional = true } @@ -36,7 +36,7 @@ proptest = { version = "0.10.1", default-features = false, features = ["std"] } [features] default = ["macros"] -macros = ["ctor", "indoc", "inventory", "paste", "pyo3cls", "unindent"] +macros = ["ctor", "indoc", "inventory", "paste", "pyo3-macros", "unindent"] # Use the Python limited API. See https://www.python.org/dev/peps/pep-0384/ for more. abi3 = [] # With abi3, we can manually set the minimum Python version. @@ -55,7 +55,7 @@ extension-module = [] [workspace] members = [ - "pyo3cls", - "pyo3-derive-backend", + "pyo3-macros", + "pyo3-macros-backend", "examples/*" ] diff --git a/Makefile b/Makefile index a78e622d..27d7d69f 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ lint: fmt clippy @true publish: test - cargo publish --manifest-path pyo3-derive-backend/Cargo.toml + cargo publish --manifest-path pyo3-macros-backend/Cargo.toml sleep 10 # wait for crates.io to update - cargo publish --manifest-path pyo3cls/Cargo.toml + cargo publish --manifest-path pyo3-macros/Cargo.toml sleep 10 # wait for crates.io to update cargo publish diff --git a/guide/src/class.md b/guide/src/class.md index 6e723ad2..62052772 100644 --- a/guide/src/class.md +++ b/guide/src/class.md @@ -706,7 +706,7 @@ pyclass dependent on whether there is an impl block, we'd need to implement the `#[pyclass]` and override the implementation in `#[pymethods]`. To enable this, we use a static registry type provided by [inventory](https://github.com/dtolnay/inventory), which allows us to collect `impl`s from arbitrary source code by exploiting some binary trick. -See [inventory: how it works](https://github.com/dtolnay/inventory#how-it-works) and `pyo3_derive_backend::py_class` for more details. +See [inventory: how it works](https://github.com/dtolnay/inventory#how-it-works) and `pyo3_macros_backend::py_class` for more details. Also for `#[pyproto]`, we use a similar, but more task-specific registry and initialize it using the [ctor](https://github.com/mmastrac/rust-ctor) crate. diff --git a/pyo3-derive-backend/Cargo.toml b/pyo3-macros-backend/Cargo.toml similarity index 96% rename from pyo3-derive-backend/Cargo.toml rename to pyo3-macros-backend/Cargo.toml index e387137f..da65800e 100644 --- a/pyo3-derive-backend/Cargo.toml +++ b/pyo3-macros-backend/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pyo3-derive-backend" +name = "pyo3-macros-backend" version = "0.12.4" description = "Code generation for PyO3 package" authors = ["PyO3 Project and Contributors "] diff --git a/pyo3-derive-backend/LICENSE b/pyo3-macros-backend/LICENSE similarity index 100% rename from pyo3-derive-backend/LICENSE rename to pyo3-macros-backend/LICENSE diff --git a/pyo3-derive-backend/src/defs.rs b/pyo3-macros-backend/src/defs.rs similarity index 100% rename from pyo3-derive-backend/src/defs.rs rename to pyo3-macros-backend/src/defs.rs diff --git a/pyo3-derive-backend/src/from_pyobject.rs b/pyo3-macros-backend/src/from_pyobject.rs similarity index 100% rename from pyo3-derive-backend/src/from_pyobject.rs rename to pyo3-macros-backend/src/from_pyobject.rs diff --git a/pyo3-derive-backend/src/konst.rs b/pyo3-macros-backend/src/konst.rs similarity index 100% rename from pyo3-derive-backend/src/konst.rs rename to pyo3-macros-backend/src/konst.rs diff --git a/pyo3-derive-backend/src/lib.rs b/pyo3-macros-backend/src/lib.rs similarity index 100% rename from pyo3-derive-backend/src/lib.rs rename to pyo3-macros-backend/src/lib.rs diff --git a/pyo3-derive-backend/src/method.rs b/pyo3-macros-backend/src/method.rs similarity index 100% rename from pyo3-derive-backend/src/method.rs rename to pyo3-macros-backend/src/method.rs diff --git a/pyo3-derive-backend/src/module.rs b/pyo3-macros-backend/src/module.rs similarity index 100% rename from pyo3-derive-backend/src/module.rs rename to pyo3-macros-backend/src/module.rs diff --git a/pyo3-derive-backend/src/proto_method.rs b/pyo3-macros-backend/src/proto_method.rs similarity index 100% rename from pyo3-derive-backend/src/proto_method.rs rename to pyo3-macros-backend/src/proto_method.rs diff --git a/pyo3-derive-backend/src/pyclass.rs b/pyo3-macros-backend/src/pyclass.rs similarity index 100% rename from pyo3-derive-backend/src/pyclass.rs rename to pyo3-macros-backend/src/pyclass.rs diff --git a/pyo3-derive-backend/src/pyfunction.rs b/pyo3-macros-backend/src/pyfunction.rs similarity index 100% rename from pyo3-derive-backend/src/pyfunction.rs rename to pyo3-macros-backend/src/pyfunction.rs diff --git a/pyo3-derive-backend/src/pyimpl.rs b/pyo3-macros-backend/src/pyimpl.rs similarity index 100% rename from pyo3-derive-backend/src/pyimpl.rs rename to pyo3-macros-backend/src/pyimpl.rs diff --git a/pyo3-derive-backend/src/pymethod.rs b/pyo3-macros-backend/src/pymethod.rs similarity index 100% rename from pyo3-derive-backend/src/pymethod.rs rename to pyo3-macros-backend/src/pymethod.rs diff --git a/pyo3-derive-backend/src/pyproto.rs b/pyo3-macros-backend/src/pyproto.rs similarity index 100% rename from pyo3-derive-backend/src/pyproto.rs rename to pyo3-macros-backend/src/pyproto.rs diff --git a/pyo3-derive-backend/src/utils.rs b/pyo3-macros-backend/src/utils.rs similarity index 100% rename from pyo3-derive-backend/src/utils.rs rename to pyo3-macros-backend/src/utils.rs diff --git a/pyo3cls/Cargo.toml b/pyo3-macros/Cargo.toml similarity index 85% rename from pyo3cls/Cargo.toml rename to pyo3-macros/Cargo.toml index d2128e76..e4f0c3ec 100644 --- a/pyo3cls/Cargo.toml +++ b/pyo3-macros/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pyo3cls" +name = "pyo3-macros" version = "0.12.4" description = "Proc macros for PyO3 package" authors = ["PyO3 Project and Contributors "] @@ -16,4 +16,4 @@ proc-macro = true [dependencies] quote = "1" syn = { version = "1", features = ["full", "extra-traits"] } -pyo3-derive-backend = { path = "../pyo3-derive-backend", version = "=0.12.4" } +pyo3-macros-backend = { path = "../pyo3-macros-backend", version = "=0.12.4" } diff --git a/pyo3cls/LICENSE b/pyo3-macros/LICENSE similarity index 100% rename from pyo3cls/LICENSE rename to pyo3-macros/LICENSE diff --git a/pyo3cls/src/lib.rs b/pyo3-macros/src/lib.rs similarity index 99% rename from pyo3cls/src/lib.rs rename to pyo3-macros/src/lib.rs index 42606f68..d783592b 100644 --- a/pyo3cls/src/lib.rs +++ b/pyo3-macros/src/lib.rs @@ -3,7 +3,7 @@ //! must not contain any other public items. use proc_macro::TokenStream; -use pyo3_derive_backend::{ +use pyo3_macros_backend::{ build_derive_from_pyobject, build_py_class, build_py_function, build_py_methods, build_py_proto, get_doc, process_functions_in_module, py_init, PyClassArgs, PyFunctionAttr, }; diff --git a/src/lib.rs b/src/lib.rs index 32d145fa..09222c05 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -201,9 +201,9 @@ pub mod types; /// The proc macros, which are also part of the prelude. #[cfg(feature = "macros")] pub mod proc_macro { - pub use pyo3cls::pymodule; + pub use pyo3_macros::pymodule; /// The proc macro attributes - pub use pyo3cls::{pyclass, pyfunction, pymethods, pyproto}; + pub use pyo3_macros::{pyclass, pyfunction, pymethods, pyproto}; } /// Returns a function that takes a [Python] instance and returns a Python function. diff --git a/src/prelude.rs b/src/prelude.rs index 8046096f..071eb901 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -20,4 +20,4 @@ pub use crate::{FromPyObject, IntoPy, IntoPyPointer, PyTryFrom, PyTryInto, ToPyO // PyModule is only part of the prelude because we need it for the pymodule function pub use crate::types::{PyAny, PyModule}; #[cfg(feature = "macros")] -pub use pyo3cls::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject}; +pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, pyproto, FromPyObject};