Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: seperate bindings and lib into seperate crate #547

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ netrc-rs = "0.1.2"
nom = "7.1.3"
num_cpus = "1.16.0"
once_cell = "1.19.0"
openssl = "0.10"
ouroboros = "0.18.3"
pathdiff = "0.2.1"
pep440_rs = { version = "0.5.0" }
pep508_rs = { version = "0.4.2" }
pin-project-lite = "0.2.13"
plist = "1"
purl = { version = "0.1.2", features = ["serde"] }
pyo3 = { version = "0.19.0", default-features = false }
pyo3-asyncio = { version = "0.19.0", default-features = false }
quote = "1.0.35"
rand = "0.8.5"
reflink-copy = "0.1.15"
Expand Down
55 changes: 55 additions & 0 deletions crates/pyo3-rattler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[package]
name = "pyo3-rattler"
version = "0.3.0"
edition.workspace = true

[lib]
name = "pyo3_rattler"
path = "src/lib.rs"
test = false
crate-type = ["rlib"]

[features]
default = ["native-tls"]
native-tls = [
"rattler_networking/native-tls",
"rattler_repodata_gateway/native-tls",
]
rustls-tls = [
"rattler_networking/rustls-tls",
"rattler_repodata_gateway/rustls-tls",
]
vendored-openssl = ["openssl", "openssl/vendored"]

[dependencies]
rattler = { path = "../rattler", default-features = false }
rattler_repodata_gateway = { path = "../rattler_repodata_gateway", default-features = false, features = [
"sparse",
] }
rattler_conda_types = { path = "../rattler_conda_types", default-features = false }
rattler_digest = { path = "../rattler_digest" }
rattler_networking = { path = "../rattler_networking", default-features = false }
rattler_shell = { path = "../rattler_shell", default-features = false }
rattler_virtual_packages = { path = "../rattler_virtual_packages", default-features = false }
rattler_solve = { path = "../rattler_solve", default-features = false, features = [
"resolvo",
] }
rattler_index = { path = "../rattler_index" }
rattler_lock = { path = "../rattler_lock", default-features = false }
rattler_package_streaming = { path = "../rattler_package_streaming", default-features = false }

anyhow = { workspace = true }
futures = { workspace = true }
openssl = { workspace = true, optional = true }
pep508_rs = { workspace = true }
pyo3 = { workspace = true, features = [
"abi3-py38",
"multiple-pymethods",
"generate-import-lib",
] }
pyo3-asyncio = { workspace = true, features = ["tokio-runtime"] }
reqwest = { workspace = true, default-features = false }
reqwest-middleware = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
url = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl PyAboutJson {
/// For example, if the file is in JSON format, this function parses the JSON string and returns
/// the resulting object. If the file is not in a parsable format, this function returns an
/// error.
#[allow(clippy::should_implement_trait)]
#[staticmethod]
pub fn from_str(str: &str) -> PyResult<Self> {
Ok(AboutJson::from_str(str)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl PyIndexJson {
/// For example, if the file is in JSON format, this function parses the JSON string and returns
/// the resulting object. If the file is not in a parsable format, this function returns an
/// error.
#[allow(clippy::should_implement_trait)]
#[staticmethod]
pub fn from_str(str: &str) -> PyResult<Self> {
Ok(IndexJson::from_str(str)
Expand Down
63 changes: 63 additions & 0 deletions crates/pyo3-rattler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
mod about_json;
mod channel;
mod error;
mod generic_virtual_package;
mod index;
mod index_json;
mod linker;
mod lock;
mod match_spec;
mod meta;
mod nameless_match_spec;
mod networking;
mod package_name;
mod paths_json;
mod platform;
mod prefix_paths;
mod record;
mod repo_data;
mod run_exports_json;
mod shell;
mod solver;
mod version;
mod virtual_package;

pub use about_json::PyAboutJson;
pub use channel::{PyChannel, PyChannelConfig};
pub use error::{
ActivationException, CacheDirException, ConversionException, ConvertSubdirException,
DetectVirtualPackageException, EnvironmentCreationException, ExtractException,
FetchRepoDataException, InvalidChannelException, InvalidMatchSpecException,
InvalidPackageNameException, InvalidUrlException, InvalidVersionException, IoException,
LinkException, ParseArchException, ParseCondaLockException, ParsePlatformException,
PyRattlerError, RequirementException, SolverException, TransactionException,
VersionBumpException,
};
pub use generic_virtual_package::PyGenericVirtualPackage;
pub use index_json::PyIndexJson;
pub use lock::{
PyEnvironment, PyLockChannel, PyLockFile, PyLockedPackage, PyPackageHashes, PyPypiPackageData,
PyPypiPackageEnvironmentData,
};
pub use match_spec::PyMatchSpec;
pub use nameless_match_spec::PyNamelessMatchSpec;
pub use networking::{authenticated_client::PyAuthenticatedClient, py_fetch_repo_data};
pub use package_name::PyPackageName;
pub use paths_json::{PyFileMode, PyPathType, PyPathsEntry, PyPathsJson, PyPrefixPlaceholder};
pub use prefix_paths::PyPrefixPaths;
pub use repo_data::{
patch_instructions::PyPatchInstructions, sparse::PySparseRepoData, PyRepoData,
};
pub use run_exports_json::PyRunExportsJson;
pub use version::PyVersion;

pub use pyo3::prelude::*;

pub use index::py_index;
pub use linker::py_link;
pub use meta::get_rattler_version;
pub use platform::{PyArch, PyPlatform};
pub use record::PyRecord;
pub use shell::{PyActivationResult, PyActivationVariables, PyActivator, PyShellEnum};
pub use solver::py_solve;
pub use virtual_package::PyVirtualPackage;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl PyLockFile {
self.inner.environment(name).map(Into::into)
}

/// Returns the environment with the default name as defined by [`DEFAULT_ENVIRONMENT_NAME`].
/// Returns the environment with the default name.
pub fn default_environment(&self) -> Option<PyEnvironment> {
self.inner.default_environment().map(Into::into)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl PyPathsJson {
/// For example, if the file is in JSON format, this function parses the JSON string and returns
/// the resulting object. If the file is not in a parsable format, this function returns an
/// error.
#[allow(clippy::should_implement_trait)]
#[staticmethod]
pub fn from_str(str: &str) -> PyResult<Self> {
Ok(PathsJson::from_str(str)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl PyRunExportsJson {
/// For example, if the file is in JSON format, this function parses the JSON string and returns
/// the resulting object. If the file is not in a parsable format, this function returns an
/// error.
#[allow(clippy::should_implement_trait)]
#[staticmethod]
pub fn from_str(str: &str) -> PyResult<Self> {
Ok(RunExportsJson::from_str(str)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading