Skip to content

Instantly share code, notes, and snippets.

@tim-hub
Forked from geoffroy-noel-ddh/npm-to-pipenv.md
Created August 1, 2020 01:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim-hub/d5a8c375b5be3e7a07fee89724d9192e to your computer and use it in GitHub Desktop.
Save tim-hub/d5a8c375b5be3e7a07fee89724d9192e to your computer and use it in GitHub Desktop.
npm to pipenv
# initialise new project package environment
npm init
PIPENV_VENV_IN_PROJECT=1 pipenv install

# install major version of package P (and dependencies)
npm i P@1
pipenv install --selective-upgrade "P<2"

# uninstall package (and unused dependencies)
npm uninstall P
pipenv uninstall --keep-outdated P && pipenv clean

# deploy locked packages
npm ci
pipenv sync && pipenv clean

# show versioned dependency tree of installed packages
npm list
pipenv graph

# minor upgrade of one package only
npm up P
# pipenv update --selective-upgrade P # Bugged in version 2018-11-26
pipenv uninstall --keep-outdated P && pipenv install --selective-upgrade "P<2" && pipenv clean

# upgrade all packages
npm i # only attempts minor upgrades
pipenv update # this locks everything then syncs

# major upgrade of one package only
npm i P@2
pipenv uninstall --keep-outdated P && pipenv install --selective-upgrade "P<3" && pipenv clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment