Skip to content

Instantly share code, notes, and snippets.

@azundo
Created April 8, 2022 22:20
Show Gist options
  • Save azundo/ad0fd7b739a7147d290c33ad88ac4ddc to your computer and use it in GitHub Desktop.
Save azundo/ad0fd7b739a7147d290c33ad88ac4ddc to your computer and use it in GitHub Desktop.
Pipenv utils to rewrite lockfiles to work around pipenv bugs
from pipenv.project import Project
# for working around bug mentioned in https://github.com/pypa/pipenv/issues/4263
def remove_package(package_name):
project = Project()
lockfile = project.get_or_create_lockfile()
if package_name in lockfile.default:
del lockfile.default[package_name] # if in normal dependencies
if package_name in lockfile.develop:
del lockfile.develop[package_name] # if in dev
lockfile.write()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment