praiskup / argparse-manpage

Automatically build man-pages for your Python project
Apache License 2.0
40 stars 21 forks source link

Use in a hatch plugin #109

Open damonlynch opened 5 months ago

damonlynch commented 5 months ago

Hello Pavel, warm greetings from New Zealand. Thank you for writing argparse-manpage!

Did you have any thoughts or preferences about making your project work with Hatch? My initial assumption is that it would work best as a build hook plugin, such that the plugin calls argparse-manpage as a commandline application, without knowing anything about its internals. Would you agree?

I have recently released my first Hatch plugin, hatch-gettext. I'm keen to get your project working seamlessly with hatch so I can use it with a project of mine that I recently switched to hatch.

damonlynch commented 4 months ago

My initial plugin implementation is here.

If you have any comments please let me know. As of now, I have not made a release. However, the code works well enough.

If you would like the Hatch plugin to be part of this project, I'm fine with that. However, I don't know how argparse-manpage could exist on Pypi as a package as it exists currently, and at the same time be available as a Hatch plugin. That might be simply because of my limited understanding of the complexities of Python packages, of course — maybe I'm just confused. So for now, hatch-argparse-manpage is a standalone package, with all the limitations that brings.

praiskup commented 3 months ago

Thank you for the report! And sorry for the late reply.

Did you have any thoughts or preferences about making your project work with Hatch?

This is almost the first time I hear about Hatch, to be honest.

My initial assumption is that it would work best as a build hook plugin, such that the plugin calls argparse-manpage as a commandline application, without knowing anything about its internals. Would you agree?

I don't disagree :) sounds good, but /shrug, I'm not able to help with the design.

If you would like the Hatch plugin to be part of this project, I'm fine with that. However, I don't know how argparse-manpage could exist on Pypi as a package as it exists currently, and at the same time be available as a Hatch plugin.

Not sure either. Up to you. It would be nice if the argparse->manpage formatting logic stayed here, so we do not duplicate the efforts. And, if you think it's better to move here - and you want to experiment, feel free to open PR.

Otherwise, congrats on the first hatch plugin; I'm going to monitor what is happening there :)

damonlynch commented 3 months ago

I made the initial 1.0.0 release late last month.

hatch-argparse-manpage calls argparse-manpage using one of two mechanisms: directly, as a Python object (preferred approach), or indirectly, via a command line call.

To call directly unfortunately I had to write my own code to parse the config specified in the user's pyproject.toml. I simply could not call the logic you already have in argparse-manpage without making changes unique to hatch plug-in requirements. This is a weakness, of course, because if your implementation changes, then so must my code.

See in particular here and here.

If breaking changes are made in future releases of argparse-manpage, I am going to rely on the release version number to differentiate between versions. I am assuming Linux distros will not be applying patches without changing that version number, which I hope is a safe assumption!