Install pipenv package and dependencies:
user@notebook:~/repos/pipenv$ pip install pipenv
Defaulting to user installation because normal site-packages is not writeable
Collecting pipenv
Downloading pipenv-2023.12.1-py3-none-any.whl (3.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 9.8 MB/s eta 0:00:00
Collecting virtualenv>=20.24.2
Downloading virtualenv-20.25.1-py3-none-any.whl (3.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 11.2 MB/s eta 0:00:00
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from pipenv) (2020.6.20)
Collecting setuptools>=67
Downloading setuptools-69.2.0-py3-none-any.whl (821 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 821.5/821.5 KB 9.7 MB/s eta 0:00:00
Collecting filelock<4,>=3.12.2
Downloading filelock-3.13.4-py3-none-any.whl (11 kB)
Collecting distlib<1,>=0.3.7
Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 KB 10.9 MB/s eta 0:00:00
Collecting platformdirs<5,>=3.9.1
Using cached platformdirs-4.2.0-py3-none-any.whl (17 kB)
Installing collected packages: distlib, setuptools, platformdirs, filelock, virtualenv, pipenv
Successfully installed distlib-0.3.8 filelock-3.13.4 pipenv-2023.12.1 platformdirs-4.2.0 setuptools-69.2.0 virtualenv-20.25.1
Create a virtual environment:
user@notebook:~/repos/pipenv$ pipenv --python 3.8
Creating a virtualenv for this project...
Pipfile: /home/rmoyano/vamos/Pipfile
Using /usr/bin/python3.8 (3.8.16) to create virtualenv...
⠸ Creating virtual environment...created virtual environment CPython3.8.16.final.0-64 in 266ms
creator CPython3Posix(dest=/home/rmoyano/.local/share/virtualenvs/vamos-kH-yfo1M, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/rmoyano/.local/share/virtualenv)
added seed packages: pip==24.0, setuptools==69.5.1, wheel==0.43.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
✔ Successfully created virtual environment!
Virtualenv location: /home/rmoyano/.local/share/virtualenvs/vamos-kH-yfo1M
Creating a Pipfile for this project...
Verify Pipfile has been created:
(cicd) user@notebook:~/repos/pipenv$ ls
LICENSE main.py Pipfile README.md
Deactivate and exit virtual environment shell:
(cicd) user@notebook:~/repos/pipenv$ exit
exit
user@notebook:~/repos/pipenv$
Warning
Do not use deactive command, it does not behave in the same way as virtualenv does.
Remove project virtualenv (Inferred from current directory):
user@notebook:~/repos/pipenv$ pipenv --rm
Removing virtualenv (/home/user/.local/share/virtualenvs/vamos-kH-yfo1M)...
Install a package:
(cicd) user@notebook:~/repos/pipenv$ pipenv install fastapi
Installing fastapi...
Resolving fastapi...
Added fastapi to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (72b2f5f2bf4e24d04303d3d94905e4d56656941323131731b9f2f83a9a474d6a)!
Installing dependencies from Pipfile.lock (474d6a)...
Pipfile.lock should have been created:
(cicd) user@notebook:~/repos/pipenv$ ls
LICENSE main.py Pipfile Pipfile.lock README.md
Install many packages like pip does:
(cicd) rmoyano@thinkpad:~/code/cicd$ pipenv install requests flask
Installing requests...
Resolving requests...
Added requests to Pipfile's [packages] ...
✔ Installation Succeeded
Installing flask...
Resolving flask...
Added flask to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock (b6b148) out of date, updating to (84c501)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (0f41c297379e4288f692df184d9964a13184e3b54c26d264944984ceb884c501)!
Installing dependencies from Pipfile.lock (84c501)...
(cicd) rmoyano@thinkpad:~/code/cicd$ pip list
Package Version
------------------ --------
annotated-types 0.6.0
anyio 4.3.0
blinker 1.7.0
exceptiongroup 1.2.0
fastapi 0.110.0
Flask 3.0.3
idna 3.7
Jinja2 3.1.3
MarkupSafe 2.1.5
pip 24.0
pydantic 2.7.0
pydantic_core 2.18.1
requests 2.31.0
setuptools 69.1.0
starlette 0.36.3
typing_extensions 4.11.0
urllib3 2.2.1
Werkzeug 3.0.2
wheel 0.42.0
Install an specific version (Fastapi 0.110.0):
(cicd) user@notebook:~/repos/pipenv$ pipenv install fastapi==0.110.0
Installing fastapi==0.110.0...
Resolving fastapi==0.110.0...
Added fastapi to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock (e4eef2) out of date, updating to (b6b148)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (00284ff6c75c59871606c7b2e6d80bc86df4f6aaec3be9a890d850bd55b6b148)!
Installing dependencies from Pipfile.lock (b6b148)...
(cicd) user@notebook:~/repos/pipenv$ pip list
Package Version
----------------- -------
annotated-types 0.6.0
anyio 4.3.0
exceptiongroup 1.2.0
fastapi 0.110.0
idna 3.7
pip 24.0
Update one package to an specific version (Fastapi 0.109.2 to 0.110.0):
(cicd) rmoyano@thinkpad:~/code/cicd$ pip list
Package Version
----------------- -------
annotated-types 0.6.0
anyio 4.3.0
exceptiongroup 1.2.0
fastapi 0.109.2
idna 3.7
pip 24.0
(cicd) rmoyano@thinkpad:~/code/cicd$ pipenv update fastapi==0.110.0
Building requirements...
Resolving dependencies...
✔ Success!
Building requirements...
Resolving dependencies...
✔ Success!
Installing dependencies from Pipfile.lock (b6b148)...
All dependencies are now up-to-date!
(cicd) rmoyano@thinkpad:~/code/cicd$ pip list
Package Version
----------------- -------
annotated-types 0.6.0
anyio 4.3.0
exceptiongroup 1.2.0
fastapi 0.110.0
idna 3.7
pip 24.0
Install all packages specified in Pipfile.lock:
(cicd) user@notebook:~/repos/pipenv$ pipenv sync
Installing dependencies from Pipfile.lock (1a91d6)...
All dependencies are now up-to-date!
Uninstall a package:
(cicd) user@notebook:~/repos/pipenv$ pipenv uninstall fastapi
Removing fastapi from Pipfile.lock...
Removed fastapi from Pipfile category packages
Uninstalling fastapi...
Found existing installation: fastapi 0.110.1
Uninstalling fastapi-0.110.1:
Successfully uninstalled fastapi-0.110.1
Locking [packages] dependencies...
Locking [dev-packages] dependencies...
Updated Pipfile.lock (fedbd2ab7afd84cf16f128af0619749267b62277b4cb6989ef16d4bef6e4eef2)!
Uninstall all packages:
(cicd) user@notebook:~/repos/pipenv$ pipenv uninstall --all
Un-installing all [dev-packages] and [packages]...
Found 10 installed package(s), purging...
Found existing installation: exceptiongroup 1.2.0
Uninstalling exceptiongroup-1.2.0:
Successfully uninstalled exceptiongroup-1.2.0
Found existing installation: idna 3.7
Uninstalling idna-3.7:
Successfully uninstalled idna-3.7
Found existing installation: anyio 4.3.0
Uninstalling anyio-4.3.0:
Successfully uninstalled anyio-4.3.0
Found existing installation: annotated-types 0.6.0
Uninstalling annotated-types-0.6.0:
Successfully uninstalled annotated-types-0.6.0
Found existing installation: starlette 0.36.3
Uninstalling starlette-0.36.3:
Successfully uninstalled starlette-0.36.3
Found existing installation: pydantic_core 2.18.1
Uninstalling pydantic_core-2.18.1:
Successfully uninstalled pydantic_core-2.18.1
Found existing installation: fastapi 0.110.0
Uninstalling fastapi-0.110.0:
Successfully uninstalled fastapi-0.110.0
Found existing installation: pydantic 2.7.0
Uninstalling pydantic-2.7.0:
Successfully uninstalled pydantic-2.7.0
Environment now purged and fresh!
(cicd) user@notebook:~/repos/pipenv$ pip list
Package Version
---------- -------
pip 24.0
setuptools 69.1.0
wheel 0.42.0
(cicd) user@notebook:~/repos/pipenv$ pipenv requirements
-i https://pypi.org/simple
blinker==1.7.0; python_version >= '3.8'
certifi==2024.2.2; python_version >= '3.6'
charset-normalizer==3.3.2; python_full_version >= '3.7.0'
click==8.1.7; python_version >= '3.7'
flask==3.0.3; python_version >= '3.8'
idna==3.7; python_version >= '3.5'
itsdangerous==2.1.2; python_version >= '3.7'
jinja2==3.1.3; python_version >= '3.7'
markupsafe==2.1.5; python_version >= '3.7'
requests==2.31.0; python_version >= '3.7'
urllib3==2.2.1; python_version >= '3.8'
werkzeug==3.0.2; python_version >= '3.8'
(cicd) user@notebook:~/repos/pipenv$ pipenv graph
flask==3.0.3
├── blinker [required: >=1.6.2, installed: 1.7.0]
├── click [required: >=8.1.3, installed: 8.1.7]
├── itsdangerous [required: >=2.1.2, installed: 2.1.2]
├── Jinja2 [required: >=3.1.2, installed: 3.1.3]
│ └── MarkupSafe [required: >=2.0, installed: 2.1.5]
└── werkzeug [required: >=3.0.0, installed: 3.0.2]
└── MarkupSafe [required: >=2.1.1, installed: 2.1.5]
requests==2.31.0
├── certifi [required: >=2017.4.17, installed: 2024.2.2]
├── charset-normalizer [required: >=2,<4, installed: 3.3.2]
├── idna [required: >=2.5,<4, installed: 3.7]
└── urllib3 [required: >=1.21.1,<3, installed: 2.2.1]
Thanks @penguinar!