Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

List PDM's __pypackages__ in Build Artifacts, never selected

Țugui Dragoș6ebd7b4bf127
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index b4c6f7e6..3dea0f2c 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -373,6 +373,11 @@ public enum ProjectArtifacts {
name: "venv", markers: pythonProjectFiles, tool: "Python", isGeneric: false, isEnvironment: true,
source: "https://docs.python.org/3/library/venv.html"
),
+ // PDM installs a project's packages here, and the folder alone switches PDM to this mode.
+ Definition(
+ name: "__pypackages__", markers: pythonProjectFiles, tool: "PDM", isGeneric: false, isEnvironment: true,
+ source: "https://github.com/pdm-project/pdm/blob/b5b69f414480b6974b8ab994b69b57bab91c0358/docs/usage/pep582.md#L7-L11"
+ ),
Definition(
name: "env", markers: pythonProjectFiles, tool: "Python", isGeneric: true, isEnvironment: true,
source: "https://docs.python.org/3/library/venv.html", proof: .holds("pyvenv.cfg")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 93f19bfa..097b2564 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -258,10 +258,23 @@ struct ProjectArtifactsTests {
Kind(artifact: "htmlcov", marker: ".coveragerc", tool: "Coverage.py", isGeneric: false),
Kind(artifact: ".tox", marker: "tox.ini", tool: "tox", isGeneric: false, isEnvironment: true),
Kind(artifact: ".nox", marker: "noxfile.py", tool: "Nox", isGeneric: false, isEnvironment: true),
+ Kind(artifact: "__pypackages__", marker: "pyproject.toml", tool: "PDM", isGeneric: false, isEnvironment: true),
Kind(artifact: "dist", marker: "pyproject.toml", tool: "Python", isGeneric: true),
])
}
+ @Test func listsPDMsPackagesAndNothingInsideThem() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("app/pyproject.toml", bytes: 16)
+ try directory.file("app/__pypackages__/3.13/lib/requests/__pycache__/api.cpython-313.pyc", bytes: 400_000)
+ try age(directory.url, days: 60)
+
+ let found = await ProjectArtifacts.scan(roots: [directory.url]).artifacts
+
+ #expect(found.map(\.name) == ["__pypackages__"])
+ #expect(found.allSatisfy { !$0.isRecommended })
+ }
+
@Test func findsWhatGameEnginesAndDotNetBuild() async throws {
let unity = "ProjectSettings/ProjectVersion.txt"
try await expectFound([
diff --git a/SAFETY.md b/SAFETY.md
index 8401eec9..68f0d9ba 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -330,17 +330,18 @@ includes `node_modules` and `Pods`, which `npm install` and `pod install` put ba
`Podfile`, unless Git tracks files in them: CocoaPods suggests keeping `Pods` in the repository, and a folder Git tracks
is part of the project, so it is listed and never selected, and so is one in a repository whose list of tracked files
Peel can't read. Peel reads that list from Git's own index, as Git documents it, and never runs Git in a project. A
-Python environment (`.venv`, `venv`) is listed and never selected, since packages are often installed into one by hand,
-and so is Terraform's `.terraform`, which keeps the workspace you chose, and xwin's `.xwin-cache`, the Windows SDK a
-Rust project builds against, which only `xwin splat` with your own options puts back. Pixi's `.pixi/envs` can be
-suggested: Pixi makes it again from `pixi.lock` and never lets it be edited by hand. A folder whose name says nothing on
-its own, such as `target` or `build`, is listed and never selected either. Of a Godot project's `.godot`, only the
-caches Godot makes again are offered, `imported` and `shader_cache`: the folder also holds the export passwords and keys
-(`export_credentials.cfg`), which exist nowhere else. Nx's `.nx` is offered only when it holds nothing but the cache and
-the database beside it, which `nx reset` removes together, since a team can keep its release plans there. Build
-Artifacts never searches a hidden folder, a Library, or a folder a tool fills, such as `node_modules`: apps and tools
-keep there what they install, as an editor keeps each extension's `package.json` beside the `node_modules` it runs with.
-A folder chosen to search that is one of those, or sits inside one, is refused with the reason.
+Python environment (`.venv`, `venv`, PDM's `__pypackages__`) is listed and never selected, since packages are often
+installed into one by hand, and so is Terraform's `.terraform`, which keeps the workspace you chose, and xwin's
+`.xwin-cache`, the Windows SDK a Rust project builds against, which only `xwin splat` with your own options puts back.
+Pixi's `.pixi/envs` can be suggested: Pixi makes it again from `pixi.lock` and never lets it be edited by hand. A folder
+whose name says nothing on its own, such as `target` or `build`, is listed and never selected either. Of a Godot
+project's `.godot`, only the caches Godot makes again are offered, `imported` and `shader_cache`: the folder also holds
+the export passwords and keys (`export_credentials.cfg`), which exist nowhere else. Nx's `.nx` is offered only when it
+holds nothing but the cache and the database beside it, which `nx reset` removes together, since a team can keep its
+release plans there. Build Artifacts never searches a hidden folder, a Library, or a folder a tool fills, such as
+`node_modules`: apps and tools keep there what they install, as an editor keeps each extension's `package.json` beside
+the `node_modules` it runs with. A folder chosen to search that is one of those, or sits inside one, is refused with the
+reason.
Developer, Build Artifacts, Space, and Installers and Backups select nothing for you: opening a page selects nothing,
and Select Recommended selects what Peel recommends there.