Skip to content

Commit b6434f1

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 0956830 commit b6434f1

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 { evaluateMarker } from './marker_evaluator.js'
@@ -185,23 +185,6 @@ const DEFAULT_UV_DISCOVERY_IGNORE = [
185185
'**/.venv/**',
186186
]
187187

188-
/**
189-
* Convert workspace glob patterns to manifest-file glob patterns,
190-
* correctly handling negation prefixes.
191-
*
192-
* @param {string[]} patterns - Workspace glob patterns (may include negations)
193-
* @param {string} manifestFileName - e.g. 'pyproject.toml'
194-
* @returns {string[]}
195-
*/
196-
function toManifestGlobPatterns(patterns, manifestFileName) {
197-
return patterns.map(p => {
198-
if (p.startsWith('!')) {
199-
return `!${p.slice(1)}/${manifestFileName}`
200-
}
201-
return `${p}/${manifestFileName}`
202-
})
203-
}
204-
205188
/**
206189
* Discover all pyproject.toml manifest paths in a uv workspace.
207190
* 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)