Skip to content

Commit 4bb3fa6

Browse files
Strum355claude
andcommitted
refactor: reuse toManifestGlobPatterns from workspace.js in python_uv.js
Export the existing toManifestGlobPatterns function from workspace.js instead of duplicating it in python_uv.js. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d4a23d1 commit 4bb3fa6

2 files changed

Lines changed: 2 additions & 19 deletions

File tree

src/providers/python_uv.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import fg from 'fast-glob'
55
import { parse as parseToml } from 'smol-toml'
66

77
import { environmentVariableIsPopulated, getCustomPath, invokeCommand } from '../tools.js'
8-
import { filterManifestPathsByDiscoveryIgnore, resolveWorkspaceDiscoveryIgnore } from '../workspace.js'
8+
import { filterManifestPathsByDiscoveryIgnore, resolveWorkspaceDiscoveryIgnore, toManifestGlobPatterns } from '../workspace.js'
99

1010
import Base_pyproject from './base_pyproject.js'
1111
import { getParser, getPinnedVersionQuery } from './requirements_parser.js'
@@ -173,23 +173,6 @@ const DEFAULT_UV_DISCOVERY_IGNORE = [
173173
'**/.venv/**',
174174
]
175175

176-
/**
177-
* Convert workspace glob patterns to manifest-file glob patterns,
178-
* correctly handling negation prefixes.
179-
*
180-
* @param {string[]} patterns - Workspace glob patterns (may include negations)
181-
* @param {string} manifestFileName - e.g. 'pyproject.toml'
182-
* @returns {string[]}
183-
*/
184-
function toManifestGlobPatterns(patterns, manifestFileName) {
185-
return patterns.map(p => {
186-
if (p.startsWith('!')) {
187-
return `!${p.slice(1)}/${manifestFileName}`
188-
}
189-
return `${p}/${manifestFileName}`
190-
})
191-
}
192-
193176
/**
194177
* Discover all pyproject.toml manifest paths in a uv workspace.
195178
* Parses `[tool.uv.workspace]` from root pyproject.toml and glob-expands member patterns.

src/workspace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function parsePnpmPackages(content) {
184184
* @param {string} manifestFileName - e.g. 'package.json' or 'Cargo.toml'
185185
* @returns {string[]}
186186
*/
187-
function toManifestGlobPatterns(patterns, manifestFileName) {
187+
export function toManifestGlobPatterns(patterns, manifestFileName) {
188188
return patterns.map(p => {
189189
if (p.startsWith('!')) {
190190
return `!${p.slice(1)}/${manifestFileName}`

0 commit comments

Comments
 (0)