Skip to content

Commit

Permalink
Pin .python-version in uv init (#6869)
Browse files Browse the repository at this point in the history
## Summary

I'm not convinced that the behavior is correct as-implemented. When the
user passes a `--python >=3.8` or we discover a `requires-python` from
the workspace, we're currently writing that request out to
`.python-version`. I would probably rather that we write the resolved
patch version?

Closes #6821.
  • Loading branch information
charliermarsh authored Sep 3, 2024
1 parent 3e8d53c commit 50d7b9c
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 111 deletions.
8 changes: 8 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,14 @@ pub struct InitArgs {
#[arg(long)]
pub no_readme: bool,

/// Do not create a `.python-version` file for the project.
///
/// By default, uv will create a `.python-version` file containing the minor version of
/// the discovered Python interpreter, which will cause subsequent uv commands to use that
/// version.
#[arg(long)]
pub no_pin_python: bool,

/// Avoid discovering a workspace and create a standalone project.
///
/// By default, uv searches for workspaces in the current directory or any
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-python/src/version_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl PythonVersionFile {

/// Create a new representation of a version file at the given path.
///
/// The file will not any versions; see [`PythonVersionFile::with_versions`].
/// The file will not any include versions; see [`PythonVersionFile::with_versions`].
/// The file will not be created; see [`PythonVersionFile::write`].
pub fn new(path: PathBuf) -> Self {
Self {
Expand Down
Loading

0 comments on commit 50d7b9c

Please sign in to comment.