Here's a list of commands for using pipenv, which is mostly coming from this website:
pip install --user pipenvCreate a new virtual environment:
pipenv --python 3.6 # Any *installed* python version worksRemoving said virtual environment:
pipenv --rmYou can install the dependencies if there is an existing Pipfile:
pipenv install # you can also add the '--dev' flag to install the dev dependenciesIf you want to ensure that the dependencies are installed exactly from Pipfile.lock, you can run the following:
pipenv syncIn the case that a Pipfile doesn't exist, you can create one after installing at least one package:
pipenv install <package>You can also import a requirements.txt file to create your Pipenv file from there:
pipenv install -r path/to/requirements.txtGenerating a Pipenv.lock lock file is as follows:
pipenv lock # you can include pre-released with the '--pre' flagYou can install or uninstall any package with the following commands (similar to pip):
pipenv install <package>
pipenv uninstall <package>You can also install specific or semi-specific versions with the following modification:
pipenv install "requests~=1.2"
pipenv install "requests>=1.4"You can find more info about this here.
If you need to nuke your virtual environment and start from scratch, you can run the following command. NOTE: THIS IS A DESTRUCTIVE ACTION
pipenv uninstall --allYou can check your dependencies for security vulnerabilities:
pipenv checkYou can also see a dependency tree of your project:
pipenv graphSince we don't have easy access to the virtual environment folder, the procedure to running the project has changed slightly. There's two ways to do so:
- Activate the virtual environment and then run the project normally:
pipenv shell
python -m webapp.app- Run a command directly in the virtual environment without explicitly activating the env itself:
pipenv run python -m webapp.appNote: You can run any command in the virtual environment via pipenv run [command]