Skip to content

Fixes workspace member detection to properly handle shared path prefixes#2187

Merged
cjames23 merged 5 commits intopypa:masterfrom
edgarrmondragon:fix/workspace-common-path
Feb 23, 2026
Merged

Fixes workspace member detection to properly handle shared path prefixes#2187
cjames23 merged 5 commits intopypa:masterfrom
edgarrmondragon:fix/workspace-common-path

Conversation

@edgarrmondragon
Copy link
Contributor

Workspace member resolution was mishandling cases where the main project and the member shared a partial directory name (e.g. 'path/to/local_app' and '/path/to/lib_member' share the 'l' string in the last part of the path), it would return an invalid path like '/path/to/l' of the true common ancestor directory. os.path.commonpath correctly returns the nearest common directory, which is what we need as the base for the member glob search.

This is also why os.path.commonprefix will be deprecated in Python 3.15:

edgarrmondragon and others added 4 commits February 21, 2026 15:18
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@edgarrmondragon
Copy link
Contributor Author

@cjames23 the CI failures are unrelated and I believe they were introduced by #2188:

S607 Starting a process with a partial executable path
  --> scripts/release_github.py:20:24
   |
18 |     # Create and push tag first
19 |     try:
20 |         subprocess.run(["git", "tag", tag], check=True)
   |                        ^^^^^^^^^^^^^^^^^^^
21 |         subprocess.run(["git", "push", "origin", tag], check=True)
22 |         print(f"Created and pushed tag: {tag}")
   |

S607 Starting a process with a partial executable path
  --> scripts/release_github.py:21:24
   |
19 |     try:
20 |         subprocess.run(["git", "tag", tag], check=True)
21 |         subprocess.run(["git", "push", "origin", tag], check=True)
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 |         print(f"Created and pushed tag: {tag}")
23 |     except subprocess.CalledProcessError as e:
   |

I can submit a PR adding the two needed noqa Ruff comments to ignore the start-process-with-partial-path errors, if you don't have a different fix in mind.

@cjames23
Copy link
Member

I have a fix coming shortly


- Fixes hatch shell type error for keep_env.
- SBOM documentation for including SBOM files in `sdist`
- Fixes workspace member detection to properly handle shared path prefixes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase and merge? I am about to cut a release for hatch and if you can get this updated inside the release tag for the next release I will include these updates as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rebase it, but the branch is up to date, so I'm not sure what you mean.

Copy link
Member

@cjames23 cjames23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I will get this included with the next release a little bit later today. Thank you for finding this and helping!

@cjames23 cjames23 merged commit da427e3 into pypa:master Feb 23, 2026
72 of 74 checks passed
@edgarrmondragon edgarrmondragon deleted the fix/workspace-common-path branch February 23, 2026 22:20
github-actions bot pushed a commit that referenced this pull request Feb 23, 2026
…xes (#2187)

* Add a failing test

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>

* Fixes workspace member detection to properly handle shared path prefixes

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>

* Add changelog entry

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>

---------

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Co-authored-by: Cary Hawkins <hawkinscary23@gmail.com> da427e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants