-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make compatible with towncrier>=24.7 #96
base: master
Are you sure you want to change the base?
fix: make compatible with towncrier>=24.7 #96
Conversation
I also realised too late that I hadn't installed the pre-commit hooks before making my last commit, so have added a few more style fixes that hopefully mean some more of the linting checks will also pass. I have some issues getting everything to pass on my local (Windows) system which seem to be related to unicode encoding problems (I have also had to rename the tox package_env variable to remove the non-ascii characters to get tox to run properly). My time to work on this is a bit sporadic, but I do still want to get it sorted out, so please just let me know what you would like done to make this mergeable and I will get it done sooner or later :-) |
Yeah, it's fine to rely on pre-commit.ci for this too.
I suppose you're talking about these hacks 2189e24 / b84a3fa, eh?
Thanks for the research and the time you've spent thus far! I've left a few comments (including the PR split). And on top of that, I imagine that the GHA matrix will need updating. GHA didn't start. Apparently, the workflow got auto-disabled because it has a cron trigger, and they do that periodically. I'm planning to refactor that eventually. I'll close+reopen this PR to trigger the CI run. I may also find time to do something myself. If that'll be the case, I'll make sure to drop a note here with the updates. Thanks again! |
Additionally, the RTD config is outdated. This is something to address separately. Here's my preferred variant: https://github.com/ansible/awx-plugins/blob/ec1523d/.readthedocs.yaml. It needs to be copied with minimum (ideally zero) changes if somebody gets to it before me. |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #96 +/- ##
==========================================
- Coverage 65.93% 64.80% -1.14%
==========================================
Files 12 12
Lines 229 233 +4
Branches 10 10
==========================================
Hits 151 151
- Misses 77 81 +4
Partials 1 1 |
|
||
|
||
# used for towncrier version 24.7 and above | ||
def _lookup_towncrier_fragments_post24_7( # noqa: WPS210 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this needs to be communicated somehow)
def _lookup_towncrier_fragments_post24_7( # noqa: WPS210 | |
def _lookup_towncrier_fragments_post24_7_inclusive( # noqa: WPS210 |
Oh, and it'd be nice to have some tests added if possible. |
0c1de45
to
2996d03
Compare
I dropped a huge portion of support matrix from the CI, metadata and code. And rebased this, making the patch smaller. I see some duplication in the fragment lookup split, so I'd like to see how to reduce the divergence. And I also want to attempt dropping the use of |
2996d03
to
5193d7e
Compare
) | ||
return set() | ||
|
||
fragment_dir = towncrier_config.directory or 'newsfragments' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurred to me that this is probably going to yield weird behavior with an empty string in the directory
attribute.
2e8f17f
to
aef5188
Compare
@bennyrowland I've reshuffled stuff, dropped the I'll still need to fix up a few CI things and look into testing before merging. |
aef5188
to
3f430a9
Compare
3f430a9
to
53c29c8
Compare
Towncrier 24.7 changed the way that its `find_fragments()` function works to accept a `Config` dataclass instead of specific components of the config. Co-Authored-By: Ben Rowland <ben.rowland@hallmarq.net> Closes sphinx-contrib#94 Resolves sphinx-contrib#92
53c29c8
to
d60f568
Compare
@webknjaz this is a first pass at solving this problem, feel free to suggest alternative approaches to tackling the issue. Ultimately it is very simple to solve for only new Towncrier, but maintaining backwards compatibility is more difficult. In the end I opted to basically have side by side implementations of the key
lookup_towncrier_fragments()
function. This means that there is a little bit more duplicated code between the two versions than there needs to be, but it also means that when/if support for pre 24.7 Towncrier is dropped it will be easy to just delete the older function. I can change this if you prefer a single function.I also renamed
get_towncrier_config()
toget_towncrier_config_as_dict()
to make way for a new version ofget_towncrier_config()
returning the new dataclassConfig
object. This breaks backwards compatibility and I could have implemented a newget_towncrier_config_as_dataclass()
function instead, but given the very small chance that any other dependent code is using that function I thought it was nicer to keep the main function name providing the current API. Again, happy to change if you prefer the other way.These changes solve #92 on my system (Windows, Py3.12) but there are no existing tests of this functionality and I haven't yet added any. If you approve of the general implementation of the fix then I can add some tests to go along with it (any suggestions about how you would like those to look would also be welcome).
original commit msg below:
towncrier 24.7 changed the way that its find_fragments() function works to accept a Config dataclass instead of specific components of the config. This commit adds a new version of lookup_towncrier_fragments() to use the new API and chooses which one to use based on the version of towncrier obtained from importlib.metadata. It also slightly changes the way that towncrier config can be obtained: the previous get_towncrier_config() function (which returned a dict) is now renamed as get_towncrier_config_as_dict() and get_towncrier_config() returns the new Config dataclass object for towncrier versions above 22.12.0rc1 and raises NotImplementedError for older versions. This API change should be ok as get_towncrier_config() was only called in one place before.