pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.16k stars 134 forks source link

Option to Include files that are ignored by the VCS #178

Open ipmb opened 6 years ago

ipmb commented 6 years ago

My use case is a webapp which uses some tools to compile static assets for distribution. I don't want to check the compiled assets into the VCS, just the source code and package.json. I do however want the compiled files to be distributed when I package the app.

Is this use case something you'd consider supporting in flit?

takluyver commented 6 years ago

I'm considering it for wheels - see issue #119. The model would be that when you run flit build it would run your tools, and pack the resulting files into a wheel. However, it's potentially a significant amount of extra complexity, and I haven't committed to doing it yet.

Input on that issue is welcome - though I'm not setting much store by +1s, because no-one's going to be -1 on a feature unless they have to implement it. ;-)

ipmb commented 6 years ago

I think running the tools necessary to compile the static assets is outside the scope of flit. I can be responsible for that on my own and then just tell flit to include the directory in the wheel.

takluyver commented 6 years ago

It's in scope for a packaging tool because those build steps are part of producing the package. If they're separate, it's harder to give consistent results - the generated files could be missing or outdated.

As it happens, you can currently do what you want with 'one weird trick': if you build/publish the wheel and sdist in two separate commands, using the --format wheel and --format sdist options, the wheel build will pick up any files that are inside your package directory. This isn't really a feature, though, and it may not always work in the future.

dholth commented 6 years ago

With SCons + enscons the 'build' step keeps track of everything it has built, and those go in. It is really complicated. IIRC everything in the wheel counts as 'built' as part of the build step is 'copy the .py files into their wheel locations' so there's no distinction between including 'built' and 'unbuilt' files. Some of the files in the sdist are not VCS tracked and are generated with a build step too, like the package metadata.