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
Use hatchling build backend #373
Comments
Thanks for the issue. One reason to use setuptools was that it's already there and it was, well, mostly simple to use. Plus the "migration" (if you want to call it that way) from old I looked briefly into the other, more modern build backends. Surely they offer a lot of other great features. However, some (most?) of them require a lot of other dependencies. For a "small" library like semver, I'm a bit hesitant to introduce them as I think a a lean build backend is "good enough" of this project. You can build it with standard Python and don't need any other packages. For me, it seems there is not one, dominant build backend right now (probably it will never be). They all have their pros and cons. Apart from the "recommended build backend" does hatchling have other convincing benefits that setuptools doesn't have? To be honest, I'm a bit skeptical about this change. However, I have only touched flit and poetry (which created some obscure error messages to me), so my experiences is a bit, well, not so great. 😉 I need to look into this a bit more, to get a better picture. If you have some good arguments or you could open a pull request so I can test that, that would be very helpful. |
Hatchling maintainer here! I can do a few:
|
Oh cool, thanks Ofek for your comments. Really appreciated your input. 👍 It sounds all good. I'm not against it, but I need to test it myself to see what benefits it brings to this project. On the "cost" side, as far as I can see, it needs some more requirements. If someone wants to create a PR, I'm happy to look into it. |
I have never tried flit or poetry, always had been using setuptools before. And yes, it's a hassle to change an existing project to hatch (creating new ones is very easy). I needed about a day or two to get acquainted with hatch, but: it is worth it. Things I love about hatch: Everything in pyproject.tomlPractically all the config you need is there.
Virtual environment definitions and managementWith setuptools I used to have one manually managed virtual environment where I had all I needed to develop the project. With hatch, you can separate it in many different dedicated environments:
When things change around a lot you can tear down and rebuild these environments in no time hatch env prune
hatch env create and get a nice overview of them with ScriptsFor each virtual environment you can define scripts which you can call with
For rebuilding the project documentation, I do
For every environment you can define its own environment variables (e.g. as an extra config for some tools) Building and publishingOnce you have hatch config set up, you build the project with
(I find it useful to have the env var
|
Challenge accepted. I wanted to offer you my help with updating the test code, should you decide to do something about #339, #344, or #369, so I might as well help you here, too, as it will ease my potential upcoming contributions to this project. |
That would be great! At the moment, it's a one-man show 😄 My time is as limited as everyone else's. Help is always appreciated. 👍 |
To play devils advocate, I would like to comment on some of what you wrote before:
Hope my list doesn't sound to negative. 🙂 It shouldn't prevent you from creating a PR, quite the opposite. Convince me! I just trying to get a full picture and sort the benefits for this project and the pros and cons. However, you haven't addressed one of my major concerns: dependencies. 😄 Maybe I over-emphasize these parts and it's not a big deal today, but I still think we should keep these things to a minimum. I see it as a con, although not a big one. That's where setuptools clearly wins. That's why I choose it. To keep it simple. Controlling many moving targets can be a nightmare. How can we mitigate this issue? Can we freeze some versions that hatchling depends on? Would it be feasible? Or should we just rely on the latest releases? What happens when one of these dependencies break? That would make developing and/or building this project at risk, wouldn't it? I really see the benefits in using hatchling. As I don't have any experiences with it, I'm waiting for your pull request and curious to see this in action! To summarize it:
|
I have no experience with tox, so I think I would just leave it untouched and have all tests and matrices managed by tox, because I don't exacty undestand what goes on there and how tox locks into your Github Actions. I will prepare a smaller test matrix with hatch, which you can try independently, and see if it can be extended to cover all you do with tox. |
Tox is used in the GHA here and here. These parts needs to be replaced by the respective hatchling commands. But yes, start with something small and we can proceed from there. Many thanks for taking that! 👍 |
Situation
python-semver currently uses the setuptools build backend
Possible Solution/Idea
hatchling seems to be the recommended build backend now. (Tutorial uses it by default.)
Additional context
One of the benefits of switching to hatch (which uses hatchling), besides a nice venv management, would be the possibility of using hatch-semver plugin to semantically version this project.
The text was updated successfully, but these errors were encountered: