Skip to content

Instantly share code, notes, and snippets.

@geoffroy-noel-ddh
Last active August 1, 2020 01:55
Show Gist options
  • Save geoffroy-noel-ddh/dbc50865f2553e55ad19b242f1361d0c to your computer and use it in GitHub Desktop.
Save geoffroy-noel-ddh/dbc50865f2553e55ad19b242f1361d0c 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