sphinx-contrib / sphinxcontrib-towncrier

An RST directive for injecting a Towncrier-generated changelog draft containing fragments for the unreleased (next) project version. Demo: https://ansible-pylibssh.rtfd.io/changelog. Docs: https://sphinxcontrib-towncrier.rtfd.io
https://pypi.org/p/sphinxcontrib-towncrier
BSD 3-Clause "New" or "Revised" License
18 stars 18 forks source link

[FR] Support running towncrier in isolated mode #53

Open bennyrowland opened 3 years ago

bennyrowland commented 3 years ago

I have a project which includes some C extensions, built in an isolated environment via PEP-517. This means that the source tree never has a compiled version of the C extensions in it, only the built wheel has those. This makes it impossible to import the package from the source root. When sphinxcontrib-towncrier runs "python -m towncrier" this automatically adds the current directory to the system path, resulting in a failure of towncrier to import the module. This can be fixed by telling Python to run the module isolated "python -Im towncrier ...". Would you consider supporting this paradigm, perhaps as a configurable option? I am happy to put together a PR if the proposal is acceptable. Thanks.

webknjaz commented 3 years ago

You could also achieve this by not specifying the "package" setting. Example: https://github.com/ansible/pylibssh/blob/4c3feeb/pyproject.toml#L74-L75. Does this work for you?

bennyrowland commented 3 years ago

This does allow towncrier to run without error, but it also means that I can no longer get the package name as part of the output section title. I guess that I can live with that as an easy solution.

webknjaz commented 2 years ago

Would you consider supporting this paradigm, perhaps as a configurable option? I am happy to put together a PR if the proposal is acceptable.

I just realized that I never responded to this bit. I think a PR would be welcome. Do you foresee any substantial downsides in making this unconditional? If yes, we'd need a toggle. If no, there'd be no need for one.

My only ask is trying not to break the existing users of this extension, the most prominent ones being aiohttp, ansible-pylibssh, attrs and pip. The eventual PR would need to be tested against those projects. Consider this an acceptance test.

webknjaz commented 1 year ago

Hey @bennyrowland, could you look into the previously asked question? What's your opinion on the downsides/side effects?