External packages in python
- Python
- Core Python
- Standard Library
- External packages
Lets build a project which will get list of s3 buckets in AWS
- To deal with external packages we need package managers
- Package manager is a software used to manage external packages
- Pacakge managers give us three options
- Popular package managers
Python – Virtual Environment
How to create a virtual environment using pip
- Create a new folder and cd into it.
python -m venv .venv
- Activate the virtual environment
# windows
.\.venv\Scripts\activate
# linux or mac
source .venv/bin/activate
- Now lets install some packages
pip install numpy
- To list the packages installed we can use
pip freeze we store the output of this to a file called as requirements.txt
pip freeze > requirements.txt
- In the version control (git) we store code + requirements.txt
How to create virtual environment and install packages from requirements.txt
- cd into folder where we have code + requirements.txt
- Create the virtual environment and activate
python -m venv .venv
# windows
.\.venv\Scripts\activate
# linux or mac
source .venv/bin/activate
- Now install packages mentioned in requirements.txt
pip install -r requirements.txt
Creating a virtual environment using uv
- Ensure uv is installed
- Create a new folder and cd into it
- initialize uv => this creates a simple project structure
uv init
- To create virtual environment
uv venv
uv sync
uv pip install numpy
uv add numpy
Introduction to unit tests
- Best option is to
- Developer finding defects.
- Ok OK option is
- QA/Tester finding defects.
- Worst option is
- Unit testing is here for that.
Like this:
Like Loading...