At least on Windows, in a file
string, environment variables are not being expanded.
_python-ldap = {platform_system = "== 'Windows'", file = "%USERPROFILE%/Downloads/python_ldap-3.1.0-cp36-cp36m-win_amd64.whl"}
WARNING: Invalid requirement, parse error at "'%USERPRO'"
ABORTING INSTALL... You will have to reinstall any packages that failed to install.
The same thing happens for ${USERPROFILE}
and $USERPROFILE
.
Python 3.6.5
Pipenv 2018.05.18
I think variable expansion is only supported in [[source]]
now. I don鈥檛 recall whether it is planned to be supported for all of Pipfile (probably not).
Sad face.
The documentation needs updating at least.
Is it possible to do what I'm trying to do here by defining a new source instead?
It is doable if you jump through a few hoops鈥ell the quick answer is no, that鈥檚 probably not what you want. In reality though, what you鈥檙e looking for is quite strange. If you鈥檙e expecting a variable setup, why not expect the wheel file inside the project, and use a relative path (e.g. ./deps/python_ldap-3.1.0-cp36-cp36m-win_amd64.whl
) instead? If you expect the file to be at a specific place, why not just expand the environment variable? The use case is really too unorthodox to be supported by a generic tool like Pipenv.
Yeah, it is a bit odd, and I'm using a relative path now.
I guess if I weren't so lazy I should set up an actual repo to serve this wheel for Windows users.
I wish python-ldap or would just do it themselves.
Well maybe you can help them on this? I am not involved in python-ldap in any way, but normally wheels are not provided because either 1. they don鈥檛 want you to use wheels, or 2. they have insufficient resource to build them. If it鈥檚 the former, you probably shouldn鈥檛 use wheels anyway, and if it鈥檚 the latter, you can help out!
A wheel server is also much more easier than you may think. Just push it to a GIt repo, and use a raw URL to install. It will just work.
Closing because I believe we鈥檝e covered everything here, and there鈥檚 nothing to fix (in Pipenv).
there鈥檚 nothing to fix
The documentation should make it clear that they only work in [[source]]
. The whole section may even be redundant to the "Injecting credentials into Pipfiles via environment variables" section.
I do wonder about this... I feel like we had expansion everywhere and it broke a lot of things. The test cases all use ${}
syntax for both windows and Linux fwiw
The implementation uses expandvars
, which (according to the documentation) accepts %...%
form on Windows. But yeah ${...}
is probably better if you want to do this on multiple platforms.
Reopening (and changing the title) to track the doc amendment.
In reality though, what you鈥檙e looking for is quite strange.
I think this use case is quite compelling though: https://github.com/pypa/pipenv/issues/2337
...although there are alternatives, see https://github.com/pypa/pipenv/issues/313#issuecomment-489557741
Most helpful comment
The documentation should make it clear that they only work in
[[source]]
. The whole section may even be redundant to the "Injecting credentials into Pipfiles via environment variables" section.