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

fix: disable reverse uv syncing #3704

Merged
merged 2 commits into from
Dec 19, 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
2 changes: 1 addition & 1 deletion docs/cli/sync/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Get tool versions from pyenv

### `--uv`

Sync tool versions with uv (2-way sync)
Sync tool versions from uv

Examples:

Expand Down
2 changes: 1 addition & 1 deletion mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ This won't overwrite any existing installs but will overwrite any existing symli
$ uv run -p 3.10.0 -- python -V - uses mise-provided python
"
flag "--pyenv" help="Get tool versions from pyenv"
flag "--uv" help="Sync tool versions with uv (2-way sync)"
flag "--uv" help="Sync tool versions from uv"
}
cmd "ruby" help="Symlinks all ruby tool versions from an external tool into mise" {
after_long_help r"Examples:
Expand Down
58 changes: 31 additions & 27 deletions src/cli/sync/python.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use eyre::Result;
use itertools::sorted;
use std::env::consts::{ARCH, OS};

use crate::env::PYENV_ROOT;
use crate::{backend, config, dirs, env, file};
Expand All @@ -17,7 +16,7 @@ pub struct SyncPython {
#[clap(long)]
pyenv: bool,

/// Sync tool versions with uv (2-way sync)
/// Sync tool versions from uv
#[clap(long)]
uv: bool,
}
Expand Down Expand Up @@ -80,31 +79,36 @@ impl SyncPython {
}
}

let subdirs = file::dir_subdirs(&installed_python_versions_path)?;
for v in sorted(subdirs) {
if v.starts_with(".") {
continue;
}
let src = installed_python_versions_path.join(&v);
if src.is_symlink() {
continue;
}
// ~/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none
// ~/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu
let os = OS;
let arch = if cfg!(target_arch = "x86_64") {
"x86_64-gnu"
} else if cfg!(target_arch = "aarch64") {
"aarch64-none"
} else {
ARCH
};
let dst = uv_versions_path.join(format!("cpython-{v}-{os}-{arch}"));
if !dst.exists() {
file::make_symlink(&src, &dst)?;
miseprintln!("Synced python@{v} from mise to uv");
}
}
// TODO: disable reverse syncing until there is a way to deal with these 2 files that uv needs:
// ❯ diff -rq uv mise
// Only in uv/lib/python3.11: EXTERNALLY-MANAGED
// Files uv/lib/python3.11/_sysconfigdata__darwin_darwin.py and mise/lib/python3.11/_sysconfigdata__darwin_darwin.py differ
// See https://github.com/jdx/mise/issues/3654
//let subdirs = file::dir_subdirs(&installed_python_versions_path)?;
//for v in sorted(subdirs) {
// if v.starts_with(".") {
// continue;
// }
// let src = installed_python_versions_path.join(&v);
// if src.is_symlink() {
// continue;
// }
// // ~/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none
// // ~/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu
// let os = OS;
// let arch = if cfg!(target_arch = "x86_64") {
// "x86_64-gnu"
// } else if cfg!(target_arch = "aarch64") {
// "aarch64-none"
// } else {
// ARCH
// };
// let dst = uv_versions_path.join(format!("cpython-{v}-{os}-{arch}"));
// if !dst.exists() {
// file::make_symlink(&src, &dst)?;
// miseprintln!("Synced python@{v} from mise to uv");
// }
//}
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion xtasks/fig/src/mise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2398,7 +2398,7 @@ const completionSpec: Fig.Spec = {
"name": [
"--uv"
],
"description": "Sync tool versions with uv (2-way sync)",
"description": "Sync tool versions from uv",
"isRepeatable": false
}
]
Expand Down
Loading