Skip to content

Only exclude _version from top-level Import Linter contracts#1536

Merged
nathanjmcdougall merged 2 commits intomainfrom
copilot/test-version-inclusion-import-linter
Mar 25, 2026
Merged

Only exclude _version from top-level Import Linter contracts#1536
nathanjmcdougall merged 2 commits intomainfrom
copilot/test-version-inclusion-import-linter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

_version was being excluded from all layer contracts, including submodule contracts. Since VCS plugins (setuptools-scm, hatch-vcs) only auto-generate _version.py at the package root, a.b._version should participate normally in the a.b contract.

  • Fix: Guard the _version exclusion in _get_module_layered_architecture with if "." not in module:, so it only applies to root packages
  • Test: Added test_version_not_excluded_in_submodule verifying _version stays in layers for subpackage contracts
Original prompt

This section details on the original issue you should resolve

<issue_title>Test that _version is not excluded from Import Linter contracts for submodules</issue_title>
<issue_description>Following up from #1427

We shouldn't exclude a.b._version from the a.b layer contract. Only from a._version, c._version, etc.</issue_description>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

…t submodule contracts

Closes #1432

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/385f0827-605c-428f-8947-960907d3c5a9
Copilot AI changed the title [WIP] Add test for version inclusion in Import Linter contracts Only exclude _version from top-level Import Linter contracts Mar 25, 2026
Copilot AI requested a review from nathanjmcdougall March 25, 2026 19:16
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 25, 2026 19:39
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/test-version-inclusion-import-linter (78eff52) with main (40cd6ef)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall merged commit 76485cc into main Mar 25, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/test-version-inclusion-import-linter branch March 25, 2026 19:48
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.

Test that _version is not excluded from Import Linter contracts for submodules

2 participants