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: notify of input globs #7

Merged
merged 3 commits into from
Sep 20, 2024
Merged
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
47 changes: 46 additions & 1 deletion crates/pixi-build/src/bin/pixi-build-python/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,48 @@ 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<String> {
vec![
// Source files
"**/*.py",
"**/*.pyx",
"**/*.c",
"**/*.cpp",
"**/*.sh",
// 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",
]
.iter()
.map(|s| s.to_string())
.collect()
}

#[async_trait::async_trait]
impl Protocol for PythonBuildBackend {
async fn get_conda_metadata(
Expand Down Expand Up @@ -431,7 +473,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(),
})
}
}

Expand Down
6 changes: 5 additions & 1 deletion crates/pixi-build/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}