Skip to content
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

Is Hatch officially recommended by PyPA over Flit? #613

Closed
deepyaman opened this issue Dec 16, 2022 · 3 comments
Closed

Is Hatch officially recommended by PyPA over Flit? #613

deepyaman opened this issue Dec 16, 2022 · 3 comments

Comments

@deepyaman
Copy link

I could have also asked this in pypa/hatch, but given my question stems from an opinionated PR by the maintainer of Hatch, I thought this would get more new information.

I've used Flit on several projects previously, after I first saw it used in https://github.com/tiangolo/typer. Earlier today, I was poking around in https://tiangolo/fastapi, when I noticed that they had migrated to Hatch, and then I saw the changes in tiangolo/fastapi#5240. This PR is worded in a way that makes it seem like PyPA's official recommendation is to use Hatch, and that it provides a lot of advantages over Flit.

  1. Is that true?
  2. Are there similar reasons to prefer Flit to Hatch? Is one or the other right in certain situations, or is it just personal preference?
@takluyver
Copy link
Member

I think that FastAPI PR gives a slightly misleading impression. Flit supports the same standards as Hatch, it would have been totally possible to update the metadata to use the [project] table (specification) and to tell contributors to install things with pip, without changing backend. They could also have kept Python 3.6 support if they wanted. 😉 Understandably, though, @ofek included a switch to the newer tool as part of modernisation.

PyPA doesn't recommend any specific tool, as far as I'm aware. At some point I asked that Flit not be presented as the default in the packaging tutorial, because I don't want people to think it's 'the officially recommended tool'. PyPA once appeared to recommend pipenv, and then a lot of people got upset with pipenv.

Certainly Hatch (and Poetry, and PDM) can do more for you than Flit. In particular, all of those tools include functionality to manage an environment associated with your project; Flit leaves that up to you to manage separately.

Is there any remaining reason to use Flit? Perhaps not. 🙂 My best argument would be that for a certain type of simple packaging, Flit is a very simple, boring implementation, with no extra pieces. E.g. if you already manage development environments with virtualenv or conda and want to keep doing that, Flit will never try to create & manage a new environment for you. That's probably a fairly niche requirement, though. 🤷

@ofek
Copy link
Sponsor

ofek commented Dec 16, 2022

Hello!

PyPA's official recommendation is to use Hatch

Is that true?

No, just chosen ahead of others as the default.

it provides a lot of advantages over Flit

Is that true?

Yes, most notably plugins. This is by design as Flit wants to be minimal.

Are there similar reasons to prefer Flit to Hatch?

For libraries fundamental to the packaging ecosystem like packaging that require a build backend with vendored, or zero, dependencies.

@deepyaman
Copy link
Author

@takluyver @ofek Thank you both for chiming in; much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants