Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Keep any Python environment beside its project, whatever its name
Țugui Dragoșfafb3b14bbac
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swiftindex 37a589c7..d15a469a 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift@@ -551,6 +551,11 @@ public enum ProjectArtifacts {name: "*", markers: [], tool: "Python", isGeneric: false, isEnvironment: true,source: "https://peps.python.org/pep-0405/", proof: .holds("pyvenv.cfg"), isFoundOnlyByItsTag: true),+ // And beside a Python project's own file, any folder holding `pyvenv.cfg` is one, whatever it is called.+ Definition(+ name: "*", markers: pythonProjectFiles, tool: "Python", isGeneric: false, isEnvironment: true,+ source: "https://peps.python.org/pep-0405/", proof: .holds("pyvenv.cfg")+ ),Definition(name: "__pycache__", markers: [], tool: "Python", isGeneric: false,source: "https://docs.python.org/3/tutorial/modules.html", proof: .holdsOnlyFilesEnding(".pyc")diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swiftindex 82c4601b..3bc61cc3 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift@@ -1163,6 +1163,28 @@ struct ProjectArtifactsTests {#expect(ProjectArtifacts.BackupMarks(found, excluded: [], excludedFromAbove: []).markable.isEmpty)}+ /// Beside a Python project's own file, a folder holding `pyvenv.cfg` is an environment whatever it is called, as+ /// `.venv` and `venv` are: listed with the installed packages and never selected.+ @Test func aPythonEnvironmentBesideItsProjectIsOneWhateverItIsCalled() async throws {+ let directory = try TemporaryDirectory()+ try directory.file("Projects/api/requirements.txt", bytes: 16)+ for environment in ["venv311", ".venv-3.12", "py312"] {+ try directory.file("Projects/api/\(environment)/pyvenv.cfg", bytes: 16)+ try directory.file("Projects/api/\(environment)/lib/python3.12/site-packages/x/__init__.py", bytes: 16)+ }+ try directory.file("Projects/api/data/notes.txt", bytes: 16)+ try directory.file("Projects/notes/py312/pyvenv.cfg", bytes: 16)+ try age(directory.url, days: 60)++ let found = await ProjectArtifacts.scan(roots: [directory.url.appending(path: "Projects")]).artifacts++ let rows = Dictionary(uniqueKeysWithValues: found.map { ("\($0.project.lastPathComponent)/\($0.name)", $0) })+ #expect(Set(rows.keys) == ["api/venv311", "api/.venv-3.12", "api/py312"])+ for row in rows.values {+ #expect(row.isEnvironment && row.tool == "Python" && !row.isRecommended, "\(row.name)")+ }+ }+@Test func aFolderGitTracksIsListedAndNeverSelected() async throws {let directory = try TemporaryDirectory()let git = try await GitFixture(home: directory.url.appending(path: "home"))diff --git a/SAFETY.md b/SAFETY.mdindex d779426a..0bd2326a 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -438,8 +438,9 @@ includes `node_modules` and `Pods`, which `npm install` and `pod install` put bais part of the project, so it is listed and never selected, and so is one in a repository whose list of tracked filesPeel can't read. Peel reads that list from Git's own index, as Git documents it, and never runs Git in a project.Installed packages are listed and never selected, since packages are often installed into them by hand: a Python-environment (`.venv`, `venv`, `env`, PDM's `__pypackages__`, tox's `.tox`, Nox's `.nox`, and any folder tagged as a-cache that holds the `pyvenv.cfg` every environment has), Composer's `vendor`, Mix's `deps`, Shards' `lib`, and Elm's+environment (`.venv`, `venv`, `env`, PDM's `__pypackages__`, tox's `.tox`, Nox's `.nox`, and any folder that holds the+`pyvenv.cfg` every environment has, beside a Python project's own file or tagged as a cache), Composer's `vendor`, Mix's+`deps`, Shards' `lib`, and Elm's`elm-stuff`. So is Terraform's `.terraform`, which keeps the workspace you chose, and xwin's `.xwin-cache`, the WindowsSDK a Rust project builds against, which only `xwin splat` with your own options puts back. Pixi's `.pixi/envs` can besuggested: Pixi makes it again from `pixi.lock` and never lets it be edited by hand. A Meson build folder, whatever its