Skip to content

Commit 2e46f55

Browse files
authored
Merge pull request #7 from tdejager/feat/use-input-globs
feat: notify of input globs
2 parents 35d4cdb + 95f91a9 commit 2e46f55

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

crates/pixi-build/src/bin/pixi-build-python/python.rs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,48 @@ impl PythonBuildBackend {
328328
}
329329
}
330330

331+
/// Determines the build input globs for given python package
332+
/// even this will be probably backend specific, e.g setuptools
333+
/// has a different way of determining the input globs than hatch etc.
334+
///
335+
/// However, lets take everything in the directory as input for now
336+
fn input_globs() -> Vec<String> {
337+
vec![
338+
// Source files
339+
"**/*.py",
340+
"**/*.pyx",
341+
"**/*.c",
342+
"**/*.cpp",
343+
"**/*.sh",
344+
// Common data files
345+
"**/*.json",
346+
"**/*.yaml",
347+
"**/*.yml",
348+
"**/*.txt",
349+
// Project configuration
350+
"setup.py",
351+
"setup.cfg",
352+
"pyproject.toml",
353+
"requirements*.txt",
354+
"Pipfile",
355+
"Pipfile.lock",
356+
"poetry.lock",
357+
"tox.ini",
358+
// Build configuration
359+
"Makefile",
360+
"MANIFEST.in",
361+
"tests/**/*.py",
362+
"docs/**/*.rst",
363+
"docs/**/*.md",
364+
// Versioning
365+
"VERSION",
366+
"version.py",
367+
]
368+
.iter()
369+
.map(|s| s.to_string())
370+
.collect()
371+
}
372+
331373
#[async_trait::async_trait]
332374
impl Protocol for PythonBuildBackend {
333375
async fn get_conda_metadata(
@@ -431,7 +473,10 @@ impl Protocol for PythonBuildBackend {
431473
.within_context_async(move || async move { run_build(output, &tool_config).await })
432474
.await?;
433475

434-
Ok(CondaBuildResult { path: package })
476+
Ok(CondaBuildResult {
477+
output_file: package,
478+
input_globs: input_globs(),
479+
})
435480
}
436481
}
437482

crates/pixi-build/src/cli.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ async fn build(factory: impl ProtocolFactory, manifest_path: &Path) -> miette::R
138138
})
139139
.await?;
140140

141-
eprintln!("Successfully build '{}'", result.path.display());
141+
eprintln!("Successfully build '{}'", result.output_file.display());
142+
eprintln!("Use following globs to revalidate: ");
143+
for glob in result.input_globs {
144+
eprintln!(" - {}", glob);
145+
}
142146

143147
Ok(())
144148
}

0 commit comments

Comments
 (0)