Closed mattdodge closed 6 years ago
So python_package
only works with "normal" packages by design. It doesn't support stuff like URLs or filenames. I don't think 73b0999 is actually related (it only applies to the internal representation, not what gets passed to pip), but if this works at all with non-underscore wheel filenames, I promise you that was an accident.
The problem with all the non-"normal" package name strings that pip supports is that Chef would have no way to be idempotent in that situation, it dosn't know how to get the current version of the package or check if the wheel is a different version. pip itself knows how to do this, but it doesn't expose enough info to script that from the outside. If you are okay with non-idempotent behavior (read: it will re-run the install every converge) or want to control idempotence yourself via notifications or guard statements, you can use this:
python_execute '-m pip install my_package-1.0.0-py3-none-any.whl'
Yeah I have it wired up right now that way, with the python_execute
. The downside is exactly what you described, it will run this every time. The executions at least are fast if nothing changed, but that's a bummer that it's not possible (at least easily possible) to bring that idempotence in to chef here.
Thanks for the quick response though, I'll close this now as it seems like the desired behavior for wheel files is to use python_execute
.
If you want to help petition Pip for a "dry run" mode of some kind, I could some day support that kind of thing. I already had to implement a terrible hack just to do the data gathering for normal packages >_<
Related to (caused by?) #71.
By substituting all underscores with dashes (https://github.com/poise/poise-python/commit/73b0999ca279191b2909aaaeb858282d1438e3f4) it makes it impossible to install wheel files (or packages from local repositories) that consist of underscores.
For example, if I build a local packaged wheel file with package name
my_package
then the resulting wheel filename will bemy_package-1.0.0-py3-none-any.whl
. Then running a recipe that looks like this:will give you some failure logs like this:
You can see that the underscore was replaced with a hyphen and thus it can't find the wheel. I know PyPI used to (don't know if it still does) prevent underscores in their package names but if the
python_package
resource is intended to be used for more than just PyPI packages (which I assume it is) then I don't think it makes sense to carry that replacement into this codebase.