-
Notifications
You must be signed in to change notification settings - Fork 137
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
Discussion: future shape of the 'flit' command #522
Comments
I agree :-) I like 2, in particular because using many tools may force you to write wrapper shell script. I'm ok as well for "infinite deprecation", where basically you can do something, but it's not the recommended way. Even if So all in all, at least for now I don't think removing deprecating any of those commands is the right move. |
I’m totally in love 💜 with the current commands, but… I have to admit that having a different behavior with The situation is really complicated, because it would require to either (1) make So… I like 2, as long as the differences between
👍 On the other side, but that’s another story, packagers should have a "standard" way to create packages for Linux distributions. As long as Python source packages generated by Flit work with "standard" tools, we can give Linux packagers a way that always works the same way (something like: download source package from PyPI, build wheel, install wheel). They could thus use the same shell commands, and let these tools (namely |
What about a cross between 1 & 2? Mention the "standard" way to do things (which is what I'd always use anyway - with |
I think the CLI was the main reason poetry new my_project & cd my_project/
poetry build
poetry publish I personally really like option 3: having a unified, generic CLI which would work with any PEP 517 backend ( But I don't think this CLI should be called If it exists, this CLI should only be a very slim wrapper around tl;dr; My very personal opinion is: Deprecate the pyproject new my_project --backend=flit & cd my_project/
pyproject build
pyproject publish The main issue would be to initialise the |
Vs. today: pipx run cookiecutter gh:scikit-hep/cookie & cd my_project
pipx run build
pipx run twine upload dist/* I think if we embraced pipx a bit more, a lot of "everything must be merged into one tool" would just go away. |
We also cannot forget that in most project templates out there (cookiecutter, PyScaffold, etc), most of these tasks can be performed with |
I personnally think that |
I use and like flit commands! I’m fine with editing the config file myself, and really like that I have simple commands to make and upload artifacts, with docs in one place. The decoupling of build backends from installer frontends is a big achievement with a lot of efforts over the last 10 years, but when developping on a project it’s nice to have one packaging tool for packaging tasks, without requiring the use of pip machinery or build-the-tool-with-bad-name to build the package. So definitely option 2 🙂 I’m quite happy using python to run code, pytest to execute tests, tox to run pytest with isolation, flit to package, pip to install dev tools. I do not really enjoy all-in-one jack-of-all-trades tools in other ecosystems (or python tools inspired by them). |
Thanks everyone for the input. That looks to me like a rough consensus for option 2, where we keep the If people want to continue discussing a unified frontend tool aimed at package authors (option 3 but not called Flit), I think the packaging board on Discourse might be a good place for that. Or go directly to making it and getting people to use it! So, that being the case, how do we clean up the discrepancies I mentioned in the original issue?
|
I'm thinking about how we might add support for symlinks to wheels. It's an often-requested feature for other reasons as well as for symlink-based editables. I don't have the appetite to start a public discussion on it right now, but I do have a basic design that might work, and in general I expect symlink support to get added to wheels at some point. So unless there's a rush, doing the simplest thing to preserve the current behaviour might be sufficient for the short term. |
One issue I just encountered - if you create a new project with IMO, if |
Are you saying: rename the editable install command to be |
On reflection, one thing that bothers me about the differing behaviours of In practical terms this is likely not that important (if you have a sdist, why build a sdist from it?) but it seems to me that it would be a reasonable assumption to think that building a sdist from a sdist gets back what you started with. So I could imagine tools working on that assumption, for whatever reason. |
This is the approach that was taken by frontend-editables, for what it's worth. Not that there was much uptake, but I didn't experience any issues in my own use of the tool :) |
One problem (sort of hidden in the discussion) is that
So where is the source coming from for |
Sorry, but I'm not going to go for any solution where the backend can give you a different sdist depending on whether the build comes from a VCS repo or not, nor whether the relevant VCS commands are on PATH. It makes sense in the simple case of a developer directly running
The way the backend creates the sdist should include all files that will go into the wheel. Flit doesn't offer you any ways to create or rearrange files at build time, so we can tell which they are. If something doesn't go into the sdist which does go into the wheel, I'd say that's a bug we can fix. |
"VCS" is a "dirty" checkout, which is why you ask VCS what files are not supposed to be there. Anything else is a "clean" checkout, and you can start with all files. So the formula is: graph TD
A[Input files] --> B[includes]
B --> C[excludes]
If you are not in VCS, "input files" is all files, everything in the extracted SDist / extracted archive, whatever. If you are in VCS, then you are probably a developer, so you should instead make "input files" only files that are in VCS, assuming any extra ones are "dirty". You do not get different files based on if you are in a VSC or not! You only get different files if you are not in an VCS and there are extra files that shouldn't be there - but arbitrary other source trees and environments shouldn't be "developing". |
Sorry, I'm rejecting any solution where the backend has a VCS behaviour and a fallback behaviour. I can see how it 'should' make sense to distinguish things that way, but things are just too messy, and I don't believe they'll stick to your assumptions well enough not to cause problems. It's a requirement for me that the |
Then I think An idea on a separate thread would be to add [tool.flit]
vcs = true And/or have |
I view requiring git to build an sdist the same as requiring a C compiler to build an extension module: it's an external tool requirement of the build process. So for me, requiring git to be there doesn't bother me. I'm also with @henryiii about naively expecting Lastly, if the various build backends don't like the idea of relying on git being installed, then we should look to standardize on how to specify what goes into an sdist. Tools could obviously provide their own bonus features, but if we need a baseline then that may be the next thing to add to pyproject.toml. |
Personally, I come to flit/poetry/setuptools every six months when I'm starting a new package and thinking "what's the best way to write my pyproject.toml to do PEP517/660/621...?" Accordingly, I see option 1 as the best Single Responsibility for flit. I'm just a layman with this stuff, but in general I think @brettcannon is right that sdist might need some standardization, particularly with the ambiguity of static vs dynamic metadata. tl;dr: in some contexts dynamic means "at build time" and in others int means "after pyproject.toml is written". Getting version from VCS for an sdist fits right between those points. |
I am a simple Flit user, not an expert in packaging at all. I personally use Flit because of its |
Regarding the
However, these are incompatible with each other. Specifically, (1) and (3) imply that So at least one of these requirements has to be dropped, and IMO, it makes the most sense to drop (4). I think it's reasonable for a project to not support building itself from a raw Git archive, since the VCS metadata is as much a part of the project as the code. Without (4), the following solution is possible, which satisfies all other requirements:
The purpose of the |
For what it's worth, as a user I personally would be fine dropping (3). I doubt that's going to happen, but I just wanted to be clear that "nobody seems to want this functionality removed" is not quite true. But I'm without a doubt an outlier here, so I'm happy if the consensus is to use VCS data (it's easy enough for me to switch to another backend). Having said that, the setting |
In the same spirit as #522 (comment), I think if you configure pyproject.toml to require VCS, it's fair to reject a VCS archive. I'd prefer if there's a way to keep as much information in |
After a few more months thought on this, and a recent prompt from @pfmoore to revisit the question, my current plan is that the get-files-from-VCS behaviour will become optional for I'm thinking the switch will be command-line options, like Once the default changes, the |
I think it might be better to move those bits of functionality into flit_core, and make them both opt-in in a 4.0 release. |
I see the attraction of that, but I don't think the switch belongs in the I'd also rather not have the added complexity and fragility of this feature in flit_core, which is used more often and in more contexts, and is focused on being simple and reliable. To my mind, the only time you really want this feature is when making a release, and then people that want it can use the |
For me, whether you decide for your own project if having a git checkout to build an sdist is like requiring any specific files to be available for that build. In this instance it just so happens you require
But isn't that the primary use case for sdists which is what we are talking about here? I would assume most people are either building from an sdist to a wheel for bootstrapping reasons (in which case VCS isn't important), or they are building an sdist (in which case it's the people doing the release and VCS is important). |
Requiring The second, but IMO more important question, is whether So for me, a command line option to |
Why does a command line option feel like the right solution to you? If the project expects its sdists to be built with the |
Basically I consider it wrong if calling the PEP 517 I have a personal dislike of determining what files go in the sdist via VCS by default, because it means that irrelevant content like Please remember, though that this is only my view. If you don't find my arguments persuasive, that's OK. After all, if things don't go the way I'm suggesting, I'll be fine, I'll just use a different build backend and no-one suffers. Footnotes
|
I broadly agree; I'll just say that a project-level option could be deactivated when not building from source or a VCS checkout. This could be predicated on e.g. the presence of As a safeguard, and provided that |
I agree that both of those are wrong.
But aren't both of these solutions wrong by the above criteria? In the former case, the |
I've opened #625 as a concrete proposal to discuss (both adding the It also occurs to me that we could make a tool which examines the committed files and the
I dislike this whole class of solution, I'm afraid. In particular when Flit is behaving as the backend, I want it to work the same whether I'm working from a git checkout (with or without (If I'd anticipated making sdists as a backend to other tools, I'd probably never have made Flit use the VCS at all, but I didn't anticipate that.) |
I'd also love it if this proposed command had a success/fail return code, with success if there are no files missing from the flit-core only SDist. I keep having to write a test that runs |
Makes sense, though I'd probably do it only on an option like I might not have time to work on this tool for a while, if anyone's interested in making it. I'd be open to including it in flit, although I might also take a while to get round to reviewing a PR. |
This tool presumably doesn't even need to be part of flit. It could be a standalone tool with the ability to generate the include/exclude lists in the correct format for various backends.
Actually, isn't this functionality something that could just be added to the existing check-manifest project (assuming they were willing, of course)? They already have the VCS scanning code from the look of it, so why reinvent that wheel? |
FYI, I made a little tool to do this, https://github.com/henryiii/check-sdist - it compares the SDist with Git, regardless of backend. AFAICT from trying it a few places, it seems to be helpful. |
Hi! Is Flit heading towards becoming a simple tool that follows all the modern standards by default? Throughout the discussion, I noticed that e.g. |
Flit came about in a very different world, before various standards defined how packaging tools should work together (in particular, PEPs 517, 621 and 660). A lot of design decisions I took back then don't really fit with the world we have now, and I don't have a strong sense of how they should be reconciled. So, let's have a discussion. 🙂
First, a couple of specific examples of where Flit doesn't fit in:
.pth
files to add entries tosys.path
. But I happen to prefer doing editable installs with symlinks, which was implemented in Flit long before there was a standardised API. So if you use the Flit command, this is still possible asflit install --symlink
. A fair bit of code which was more general now basically remains just for this feature. See also Addflit install --editable
option #512.flit build
creates an sdist using information from git (or mercurial) to decide which files to include. I envisaged that you would only build sdists to upload to PyPI, and it was reasonable to assume you did that from a git checkout with thegit
command available. But PEP 517 madebuild_sdist
a standard hook, and I didn't want to make the same assumption in the PEP 517 backend. Soflit build
gives you what I think of as the 'gold standard' sdist, but using e.g.python -m build
, which calls the PEP 517 hook, gives you a 'minimal' sdist unless you add include/exclude patterns in your config file. See alsoflit build
packages different files into the sdist thanpython -m build
#513.But beyond the specifics, I want to ask a more general question about the role of Flit. Part of my goal was for Flit to provide a single CLI for tasks around making & sharing a package, similar to how pip is a single CLI for consuming packages.
flit init
helps you set up the metadata,flit install
lets you try it out, andflit publish
checks everything and uploads it to PyPI. I still use it that way - old habits die hard - but with the new wave of standards, people often recommend using tools that work with any backend -pip
to install,build
to, uh, build,twine
to upload. It's a worse experience if you're working on one particular package, but it works the same way for any package.So, what do we want? I see 3 main options:
flit
command around as an alternative interface for people (like me!) who want to use it. The status quo isn't actually broken, after all - though I'd like to clean up things like how to decide what files to put in an sdist.flit
command work through the PEP 517 interface as much as possible, and let it work with other backends. So you couldflit publish
a package which is built with setuptools, and it would work. It could still have some extra features (like installing as a symlink) for packages using Flit. I think a lot of people would like a tool like this, but perhaps it would be confusing that it appeared to be related to a specific backend (flit_core). 🤷I'm particularly interested in what @Carreau @pradyunsg @gaborbernat think, as the people who've volunteered to help maintain Flit. But this question is also open to anyone else who's interested.
The text was updated successfully, but these errors were encountered: