From be116cc4309fdb5ce19313410631a65c407175ba Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 20 Sep 2024 16:09:56 +0200 Subject: [PATCH 1/2] feat: notify of input globs --- .../src/bin/pixi-build-python/python.rs | 42 ++++++++++++++++++- crates/pixi-build/src/cli.rs | 6 ++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/crates/pixi-build/src/bin/pixi-build-python/python.rs b/crates/pixi-build/src/bin/pixi-build-python/python.rs index 39a2837..b1a2fa3 100644 --- a/crates/pixi-build/src/bin/pixi-build-python/python.rs +++ b/crates/pixi-build/src/bin/pixi-build-python/python.rs @@ -328,6 +328,43 @@ impl PythonBuildBackend { } } +/// Determines the build input globs for given python package +/// even this will be probably backend specific, e.g setuptools +/// has a different way of determining the input globs than hatch etc. +/// +/// However, lets take everything in the directory as input for now +fn input_globs() -> Vec { + vec![ + "**/*.py", + "**/*.pyx", + "setup.py", + "setup.cfg", + "pyproject.toml", + "tox.ini", + "**/*.c", + "**/*.cpp", + "Makefile", + "**/*.sh", + "MANIFEST.in", + "requirements*.txt", + "Pipfile", + "Pipfile.lock", + "poetry.lock", + "**/*.json", + "**/*.yaml", + "**/*.yml", + "**/*.txt", + "tests/**/*.py", + "docs/**/*.rst", + "docs/**/*.md", + "VERSION", + "version.py", + ] + .iter() + .map(|s| s.to_string()) + .collect() +} + #[async_trait::async_trait] impl Protocol for PythonBuildBackend { async fn get_conda_metadata( @@ -431,7 +468,10 @@ impl Protocol for PythonBuildBackend { .within_context_async(move || async move { run_build(output, &tool_config).await }) .await?; - Ok(CondaBuildResult { path: package }) + Ok(CondaBuildResult { + output_file: package, + input_globs: input_globs(), + }) } } diff --git a/crates/pixi-build/src/cli.rs b/crates/pixi-build/src/cli.rs index b9c5766..09e7a13 100644 --- a/crates/pixi-build/src/cli.rs +++ b/crates/pixi-build/src/cli.rs @@ -138,7 +138,11 @@ async fn build(factory: impl ProtocolFactory, manifest_path: &Path) -> miette::R }) .await?; - eprintln!("Successfully build '{}'", result.path.display()); + eprintln!("Successfully build '{}'", result.output_file.display()); + eprintln!("Use following globs to revalidate: "); + for glob in result.input_globs { + eprintln!(" - {}", glob); + } Ok(()) } From d9690527811b146928392126fffd0cffbce583f9 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 20 Sep 2024 16:20:30 +0200 Subject: [PATCH 2/2] fix: add some comments --- .../src/bin/pixi-build-python/python.rs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/crates/pixi-build/src/bin/pixi-build-python/python.rs b/crates/pixi-build/src/bin/pixi-build-python/python.rs index b1a2fa3..5b86664 100644 --- a/crates/pixi-build/src/bin/pixi-build-python/python.rs +++ b/crates/pixi-build/src/bin/pixi-build-python/python.rs @@ -335,28 +335,33 @@ impl PythonBuildBackend { /// However, lets take everything in the directory as input for now fn input_globs() -> Vec { vec![ + // Source files "**/*.py", "**/*.pyx", - "setup.py", - "setup.cfg", - "pyproject.toml", - "tox.ini", "**/*.c", "**/*.cpp", - "Makefile", "**/*.sh", - "MANIFEST.in", - "requirements*.txt", - "Pipfile", - "Pipfile.lock", - "poetry.lock", + // Common data files "**/*.json", "**/*.yaml", "**/*.yml", "**/*.txt", + // Project configuration + "setup.py", + "setup.cfg", + "pyproject.toml", + "requirements*.txt", + "Pipfile", + "Pipfile.lock", + "poetry.lock", + "tox.ini", + // Build configuration + "Makefile", + "MANIFEST.in", "tests/**/*.py", "docs/**/*.rst", "docs/**/*.md", + // Versioning "VERSION", "version.py", ]