-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Locking does not respect editable flag for local packages in multiple categories #5441
Comments
Thank you for the thorough bug report. We'll try to fix this as soon as possible. |
@micahjsmith and @oz123 -- Actually this is intentional. The default package group constraints all other categories. This is also called out in the documentation: https://pipenv.pypa.io/en/latest/basics/#specifying-package-categories
The original fix to constraint dev dependencies with default category came from @dqkqd which resolved a number of other issue reports in the backlog. See original PR and trace back of issues for more details: #5234 |
One possible user workaround if you have packages you don't want constrained by default, or if you don't like that behavior, you can opt to use different categories and potentially even leave default empty, and nothing will be constrained across categories -- it would be a bit like the wild west to not care about conflicting versions; it would be on the user to understand which groups are compatible/incompatible, but I think that is the best we can do to continue to support both use cases. |
Hi @matteius thanks for the explanation. I had missed this section, but even after reading it, it's not fully clear what it means
After reading through the linked PR, I understand that this means "constrain" in the since of "pip constraints". My takeaway is that if the same dependency is specified in both packages and category X, the version in packages section "wins" during resolution. Regarding the order in which package categories are resolved:
It seems that this has the important caveat that the |
Thanks for the idea for the workaround
Here was my use case from above
Since the local package is required in the environment, the proposed workaround would mean that one could not create a satisfactory environment that has all required packages just by doing For now, I am considering a workaround of setting the local package as always editable, then uninstalling/reinstalling the package in a post-processing step when I need a non-editable install such as a in deployment context
|
@micahjsmith Thanks for your feedback; I will contemplate it more. I think the original issue stemmed from say I have Django in For your workaround idea, that is always an option, but you may want to use pipenv to run pip install (in the case of virtualenvs or to ensure you are using the same python version):
|
Makes sense, thanks for the discussion, going to close this then as expected behavior |
Issue description
If a local package is specified in both
default
anddevelop
categories with different values foreditable
, after locking the value from thedefault
category is used in both places in the lockfile. If the local package is not provided indefault
category, then the locking works correctly in that the value ofeditable
is correct in the lockfile'sdevelop
category. I haven't found any specification that says that the same package can't be provided in multiple categories, so I'd expect this to work properly.As context, the use case for having the local package specified twice is that at deployment time you want to just build a wheel and install that without any symlinks etc., whereas at development time, you want to have the editable distribution.
Expected result
in the lockfile, editable is
false
fordefault
category andtrue
fordevelop
categoryActual result
in the lockfile, editable is
false
fordefault
category andfalse
fordevelop
categorySteps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
$ pipenv --support
Pipenv version:
'2022.10.12'
Pipenv location:
'/Users/micahsmith/.pyenv/versions/3.9.13/lib/python3.9/site-packages/pipenv'
Python location:
'/Users/micahsmith/.pyenv/versions/3.9.13/bin/python3.9'
OS Name:
'posix'
User pip version:
'22.2.2'
user Python installations found:
3.10.7
:/usr/local/bin/python3
3.10.6
:/Users/micahsmith/.pyenv/versions/3.10.6/bin/python3
3.9.15
:/usr/local/bin/python3.9
3.9.13
:/Users/micahsmith/.pyenv/versions/3.9.13/bin/python3
3.9.13
:/Users/micahsmith/.pyenv/versions/3.9.13/bin/python3
3.9.13
:/Users/micahsmith/.pyenv/versions/3.9.13/bin/python
3.9.13
:/Users/micahsmith/.pyenv/versions/3.9.13/bin/python3.9
3.9.6
:/usr/bin/python3
3.8.15
:/usr/local/bin/python3.8
3.8.3
:/Users/micahsmith/.pyenv/versions/3.8.3/bin/python3
3.7.7
:/Users/micahsmith/.pyenv/versions/3.7.7/bin/python3
3.6.13
:/Users/micahsmith/.pyenv/versions/3.6.13/bin/python3
PEP 508 Information:
System environment variables (redacted):
PYENV_ROOT
PIPENV_VENV_IN_PROJECT
PYENV_VERSION
PIPENV_IGNORE_VIRTUALENVS
PYENV_DIR
PYENV_VIRTUALENV_INIT
PYENV_HOOK_PATH
PYENV_SHELL
PIP_DISABLE_PIP_VERSION_CHECK
PIP_PYTHON_PATH
PYTHONDONTWRITEBYTECODE
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT
:1
PIPENV_IGNORE_VIRTUALENVS
: ``Debug–specific environment variables:
PATH
:/Users/micahsmith/.pyenv/versions/3.9.13/bin:/usr/local/Cellar/pyenv/2.3.5/libexec:/usr/local/Cellar/pyenv/2.3.5/plugins/python-build/bin:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/micahsmith/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/micahsmith/.gem/ruby/2.7.0/bin:/usr/local/opt/ruby/bin:/usr/local/opt/libxml2/bin:/Users/micahsmith/go/bin:/usr/local/sbin:/usr/local/opt/util-linux/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/micahsmith/.local/bin:/Users/micahsmith/local/bin:/usr/local/opt/fzf/bin
SHELL
:/bin/bash
EDITOR
:vim
LANG
:en_US.UTF-8
PWD
:/Users/micahsmith/workspace/pipenv_sandbox
Contents of
Pipfile
('/Users/micahsmith/workspace/pipenv_sandbox/Pipfile'):Contents of
Pipfile.lock
('/Users/micahsmith/workspace/pipenv_sandbox/Pipfile.lock'):The text was updated successfully, but these errors were encountered: