Skip to content

Commit

Permalink
Hook up all the pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Dec 10, 2024
1 parent 4c89a9a commit 85ce0f6
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 38 deletions.
72 changes: 40 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ tokio = { workspace = true, features = ["rt"] }
#rattler_solve = { git = "https://github.com/conda/rattler", branch = "main" }
#rattler_virtual_packages = { git = "https://github.com/conda/rattler", branch = "main" }

file_url = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/file_url" }
rattler = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler" }
rattler_conda_types = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_conda_types" }
rattler_digest = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_digest" }
rattler_lock = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_lock" }
rattler_networking = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_networking" }
rattler_package_streaming = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_package_streaming" }
rattler_repodata_gateway = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_repodata_gateway" }
rattler_shell = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_shell" }
rattler_solve = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_solve" }
rattler_virtual_packages = { path = "/var/home/julian/Projekte/github.com/prefix-dev/rattler/crates/rattler_virtual_packages" }

# Config for 'dist'
[workspace.metadata.dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
Expand Down
11 changes: 10 additions & 1 deletion crates/pixi_record/src/pinned_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ impl PinnedSourceSpec {
}
}

pub fn editable(&self) -> bool {
self.as_path().map(|p| p.editable).unwrap_or(false)
}

/// Converts this instance into a [`MutablePinnedSourceSpec`], or if this
/// instance does not refer to mutable source the original
/// [`PinnedSourceSpec`].
Expand Down Expand Up @@ -147,6 +151,7 @@ impl From<PinnedGitSpec> for PinnedSourceSpec {
#[derive(Debug, Clone)]
pub struct PinnedPathSpec {
pub path: Utf8TypedPathBuf,
pub editable: bool,
}

impl PinnedPathSpec {
Expand Down Expand Up @@ -204,7 +209,11 @@ impl TryFrom<UrlOrPath> for PinnedSourceSpec {
fn try_from(value: UrlOrPath) -> Result<Self, Self::Error> {
match value {
UrlOrPath::Url(_) => unimplemented!(),
UrlOrPath::Path(path) => Ok(PinnedPathSpec { path }.into()),
UrlOrPath::Path(path) => Ok(PinnedPathSpec {
path,
editable: false,
}
.into()),
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions crates/pixi_record/src/source_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ pub struct SourceRecord {
/// If this is `None`, the input hash was not computed or is not relevant
/// for this record. The record can always be considered up to date.
pub input_hash: Option<InputHash>,

/// Whether the package is installed as editable
pub editable: bool,
}

/// Defines the hash of the input files that were used to build the metadata of
Expand All @@ -45,6 +48,7 @@ impl From<SourceRecord> for CondaPackageData {
hash: i.hash,
globs: i.globs,
}),
editable: value.editable,
})
}
}
Expand All @@ -60,6 +64,7 @@ impl TryFrom<CondaSourceData> for SourceRecord {
hash: hash.hash,
globs: hash.globs,
}),
editable: value.editable,
})
}
}
Expand Down
10 changes: 10 additions & 0 deletions crates/pixi_spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@ pub enum SourceSpec {
Path(PathSourceSpec),
}

impl SourceSpec {
/// Whether the spec is editable
pub fn editable(&self) -> bool {
match self {
Self::Path(path) => path.editable,
_ => false,
}
}
}

impl From<SourceSpec> for PixiSpec {
fn from(value: SourceSpec) -> Self {
match value {
Expand Down
2 changes: 1 addition & 1 deletion crates/pixi_spec/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use typed_path::{Utf8NativePathBuf, Utf8TypedPathBuf};

use crate::{BinarySpec, SpecConversionError};

/// A specification of a package from a git repository.
/// A specification of a package from a path.
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
pub struct PathSpec {
/// The path to the package
Expand Down
6 changes: 4 additions & 2 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ impl BuildContext {
channel_configuration: ChannelConfiguration {
base_url: self.channel_config.channel_alias.clone(),
},
// FIXME
editable: Some(PathBuf::from_str("/var/home/julian/Projekte/github.com/prefix-dev/pixi-1/pytest-temp/test_editable_pyproject0/editable-pyproject").unwrap()),
// FIXME: don't hardcode path, also figure out why source_spec.editable is false
editable: source_spec.editable.then(|| PathBuf::from_str("/var/home/julian/Projekte/github.com/prefix-dev/pixi-1/pytest-temp/test_editable_pyproject0/editable-pyproject").unwrap()),
outputs: Some(vec![CondaOutputIdentifier {
name: Some(source_spec.package_record.name.as_normalized().to_string()),
version: Some(source_spec.package_record.version.version().to_string()),
Expand Down Expand Up @@ -371,6 +371,7 @@ impl BuildContext {
path: source_path,
pinned: PinnedPathSpec {
path: path.path.clone(),
editable: source_spec.editable(),
}
.into(),
})
Expand Down Expand Up @@ -625,6 +626,7 @@ fn source_metadata_to_records(
SourceRecord {
input_hash: input_hash.clone(),
source: source.pinned.clone(),
editable: source.pinned.editable(),
package_record: PackageRecord {
// We cannot now these values from the metadata because no actual package
// was built yet.
Expand Down
12 changes: 12 additions & 0 deletions src/cli/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ pub async fn execute(args: Args) -> miette::Result<()> {
let project = Project::load_or_else_discover(args.project_config.manifest_path.as_deref())?
.with_cli_config(args.config);

dbg!(&project.clone().manifest.package.unwrap());
dbg!(
&project
.clone()
.manifest
.workspace
.default_feature()
.targets
.default()
.dependencies
);

// Install either:
//
// 1. specific environments
Expand Down
1 change: 1 addition & 0 deletions src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ pub async fn update_prefix_conda(

let mut progress_reporter = None;
let source_records_length = source_records.len();
dbg!(&source_records);
// Build conda packages out of the source records
let mut processed_source_packages = stream::iter(source_records)
.map(Ok)
Expand Down
2 changes: 1 addition & 1 deletion src/lock_file/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Project {
&self,
options: UpdateLockFileOptions,
) -> miette::Result<LockFileDerivedData<'_>> {
self::update_lock_file(self, options).await
update_lock_file(self, options).await
}

/// Get lockfile without checking
Expand Down
1 change: 0 additions & 1 deletion tests/integration_python/pixi_build/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def test_editable_pyproject(pixi: Path, build_data: Path, tmp_pixi_workspace: Pa
env=env,
)

# TODO: Is it always re-installing? If yes, how can we avoid that?
# Verify that package is installed as editable
verify_cli_command(
[
Expand Down

0 comments on commit 85ce0f6

Please sign in to comment.