Skip to content

Deprecate colcon_mixin.mixin.repository.mixin_repositories_file - #55

Merged
cottsay merged 5 commits into
masterfrom
cottsay/deprecate_mixin_repositories_file
Nov 24, 2025
Merged

Deprecate colcon_mixin.mixin.repository.mixin_repositories_file#55
cottsay merged 5 commits into
masterfrom
cottsay/deprecate_mixin_repositories_file

Conversation

@cottsay

@cottsay cottsay commented Oct 20, 2025

Copy link
Copy Markdown
Member

Importing this module currently requires that colcon has already initialized the config location, which makes testing difficult and produces undesired behavior if the location changes during runtime. Following the behavior of colcon_mixin.mixin.get_mixin_path, we should use a "getter" pattern here.

This change also adds a test for an existing deprecation in this package.

Importing this module currently requires that colcon has already
initialized the config location, which makes testing difficult and
produces undesired behavior if the location changes during runtime.
Following the behavior of colcon_mixin.mixin.get_mixin_path, we should
use a "getter" pattern here.

This change also adds a test for an existing deprecation in this
package.
@cottsay cottsay self-assigned this Oct 20, 2025
@cottsay cottsay added this to the 0.2.4 milestone Oct 20, 2025
@cottsay cottsay added the enhancement New feature or request label Oct 20, 2025
@codecov-commenter

codecov-commenter commented Oct 20, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.30%. Comparing base (c91a0fd) to head (d581a36).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
colcon_mixin/mixin/repository.py 69.23% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #55       +/-   ##
===========================================
+ Coverage    0.00%   15.30%   +15.30%     
===========================================
  Files          11       11               
  Lines         551      562       +11     
  Branches        0       94       +94     
===========================================
+ Hits            0       86       +86     
+ Misses        551      474       -77     
- Partials        0        2        +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leander-dsouza leander-dsouza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added some minor comments about the category of warning to be raised.

However, importing set_repositories on its own still leads to an error, as set_default_config_path needs to be called before get_config_path().

warnings.warn(
"'colcon_mixin.mixin.repository.mixin_repositories_file' has "
"been deprecated, use 'colcon_mixin.mixin.repository."
"get_mixin_repositories_file()' instead", stacklevel=2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"get_mixin_repositories_file()' instead", stacklevel=2)
"get_mixin_repositories_file()' instead",
DeprecationWarning, stacklevel=2)

PEP 387 suggests adding DeprecationWarning as the warning category for usage.

In anticipation of this change, I have added suggestions to the tests to match this call.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This package already uses UserWarning for deprecations elsewhere. The main reason is that DeprecationWarning messages are not shown to on the console and are effectively silent unless specifically enabled: https://docs.python.org/3/library/warnings.html#default-warning-filter

@leander-dsouza leander-dsouza Nov 21, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the explanation, Scott. The remaining associated comments are related to this addition and can therefore be ignored.

Comment thread colcon_mixin/mixin/repository.py Outdated
Comment thread colcon_mixin/mixin/repository.py Outdated
Comment thread test/test_deprecations.py
cottsay and others added 4 commits November 20, 2025 11:27
Co-authored-by: Leander Stephen D'Souza <leanderdsouza1234@gmail.com>
Co-authored-by: Leander Stephen D'Souza <leanderdsouza1234@gmail.com>
@cottsay
cottsay merged commit 9f2dc67 into master Nov 24, 2025
23 checks passed
@cottsay
cottsay deleted the cottsay/deprecate_mixin_repositories_file branch November 24, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants