-
-
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
pipenv uninstall --all-dev uninstalls shared default dependencies #3722
Comments
Also, if this is confirmed to be an issue, I'd happily open a PR and contribute! This is the first sane Python package management workflow I've found, and the first one that almost enables me to purge dev dependencies from the environment (almost due to this bug... at least it's not that bad, because I can always run pipenv install again and it will only reinstall missing shared dependencies). |
Currently pipenv just simply removes all packages in dev but not smart to detect the shared dependencies of default and dev packages. Personally I feels what you are proposing is quite reasonable. |
Yeah I'd definitely merge a PR which improves the behavior but I think we'd need an accompanying addition to it does seem a bit obvious that we shouldn't remove the things that are also in the other section though... |
…tall --all-dev`
…ninstall all-dev
Filters list of packages to uninstall for shared dependencies when uninstall is used with the --all-dev option. This prevents shared dependencies from being uninstalled or removed from the default section of the lockfile. Adds a test to ensure that shared dependencies are not uninstalled and not removed from the pipfile or lockfile.
Filters list of packages to uninstall for shared dependencies when uninstall is used with the --all-dev option. This prevents shared dependencies from being uninstalled or removed from the default section of the lockfile. Adds a test to ensure that shared dependencies are not uninstalled and not removed from the pipfile or lockfile.
Bump—This is still an issue. Not too difficult to fix when it happens, but annoying and definitely unexpected. |
May I draw your attention to this behaviour:
So to sumarize the problem from my view:
|
IMHO it should not be just optional. Why would anyone want to remove those shared dependencies? I've made a PR with proposed solution. |
Issue description
pipenv uninstall --all-dev
uninstalls shared default dependenciesExpected result
When running
pipenv uninstall --all-dev
I'd expect all dev dependencies and their dependencies to be removed, except those shared by default dependencies. Doing so breaks the application and forces me to runpipenv install
.Actual result
At least on one scenario that I observed,
pipenv uninstall --all-dev
will actually remove dev dependencies that are shared by default dependencies.Steps to replicate
I'm using this sample application of mine to reproduce the behavior: https://github.com/fbcbarbosa/flask-chuck-norris
You'll notice that
click
is shared byblack
(a dev dependency) andFlask
(a "default" dependency. When runningpipenv uninstall --all-dev
,click
is also removed, breaking Flask.Running the application will throw an error, because click is not installed.
To tell the truth, the documentation is not clear on the expected behavior:
Still, I find it unlikely that this is working as intended. Since in any reasonably sized project, dev dependencies and default dependencies will share some common dependencies, running
pipenv uninstall --all-dev
would always need to be followed bypipenv install
.My use case is that I want to run pipenv as part of my CI, and after running my tests I'd like to prune all dev dependencies before shipping my application - specifically, I'll be copying the pipenv environment inside a docker image.
To give another example, I'd expect it to work like npm prune --production.
$ pipenv --support
Pipenv version:
'2018.11.26'
Pipenv location:
'/usr/lib/python3.7/site-packages/pipenv'
Python location:
'/usr/bin/python3'
Python installations found:
3.7.3
:/home/walker/Workspace/src/github.com/fbcbarbosa/flask-chuck/.venv/bin/python3
3.7.3
:/usr/bin/python3.7
3.7.3
:/usr/bin/python3.7m
2.7.15
:/usr/bin/python2
PEP 508 Information:
System environment variables:
PIPENV_VENV_IN_PROJECT
NVM_DIR
LS_COLORS
TERMINATOR_UUID
XDG_MENU_PREFIX
MODULES_RUN_QUARANTINE
LANG
GDM_LANG
HISTCONTROL
LESS
DISPLAY
HOSTNAME
OLDPWD
SDKMAN_CANDIDATES_API
KUBECONFIG
EDITOR
COLORTERM
NVM_CD_FLAGS
FPATH
DESKTOP_AUTOSTART_ID
USERNAME
JAVA_HOME
KDEDIRS
XDG_VTNR
GIO_LAUNCHED_DESKTOP_FILE_PID
ZSH
SSH_AUTH_SOCK
XDG_SESSION_ID
MODULES_CMD
USER
ENV
PAGER
LSCOLORS
DESKTOP_SESSION
GOPATH
GRADLE_HOME
PWD
HOME
KOPS_CLUSTER_NAME
SSH_AGENT_PID
XDG_SESSION_TYPE
BASH_ENV
XDG_DATA_DIRS
TERMINATOR_DBUS_NAME
XDG_SESSION_DESKTOP
LOADEDMODULES
SDKMAN_DIR
TERMINATOR_DBUS_PATH
MAIL
ZSH_CUSTOM
WINDOWPATH
SHELL
VTE_VERSION
TERM
QT_IM_MODULE
XMODIFIERS
NVM_BIN
SDKMAN_CANDIDATES_DIR
XDG_CURRENT_DESKTOP
GIO_LAUNCHED_DESKTOP_FILE
KOPS_STATE_STORE
XDG_SEAT
SHLVL
MANPATH
MODULEPATH
GDMSESSION
LOGNAME
DBUS_SESSION_BUS_ADDRESS
XDG_RUNTIME_DIR
XAUTHORITY
MODULEPATH_modshare
GOBIN
PATH
SDKMAN_VERSION
DATASTORE_TYPE
MODULESHOME
HISTSIZE
SDKMAN_PLATFORM
SESSION_MANAGER
LESSOPEN
BASH_FUNC_module%%
BASH_FUNC__module_raw%%
BASH_FUNC_switchml%%
_
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL
TERM_PROGRAM
TERM_PROGRAM_VERSION
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
PIPENV_ACTIVE
LC_CTYPE
VIRTUAL_ENV
PS1
PIP_SHIMS_BASE_MODULE
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT
:true
PIPENV_ACTIVE
:1
Debug–specific environment variables:
PATH
:/home/walker/Workspace/src/github.com/fbcbarbosa/flask-chuck/.venv/bin:/home/walker/.nvm/versions/node/v12.1.0/bin:/home/walker/.sdkman/candidates/java/current/bin:/home/walker/.sdkman/candidates/gradle/current/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/walker/bin:/var/lib/snapd/snap/bin:/home/walker/Workspace/bin:/home/walker/go/bin:/home/walker/Workspace/bin:/home/walker/go/bin:/home/walker/Workspace/bin:/home/walker/go/bin
SHELL
:/bin/zsh
EDITOR
:vim
LANG
:en_US.UTF-8
PWD
:/home/walker/Workspace/src/github.com/fbcbarbosa/flask-chuck
VIRTUAL_ENV
:/home/walker/Workspace/src/github.com/fbcbarbosa/flask-chuck/.venv
Contents of
Pipfile
('/home/walker/Workspace/src/github.com/fbcbarbosa/flask-chuck/Pipfile'):Contents of
Pipfile.lock
('/home/walker/Workspace/src/github.com/fbcbarbosa/flask-chuck/Pipfile.lock'):The text was updated successfully, but these errors were encountered: