Installing components

Most of the tools required must be added to the Python 3.7 environment. There are two approaches in common use:

  • Use pip to install everything.
  • Use conda to create an environment. Most of the tools described in this book are part of the Anaconda distribution.

The pip installation uses a single command:

python3 -m pip install pyyaml sqlalchemy jinja2 pytest sphinx mypy pylint black

This will install all of the required packages and tools in your current Python environment.

The conda installation creates a conda environment to keep the book's material separate from any other projects:

  1. Install conda. If you have already installed Anaconda, you have the Conda tool, nothing more needs to be done. If you don't have Anaconda yet, then install miniconda, which is the ideal way to get started. Visit https://conda.io/miniconda.html and download the appropriate version of conda for your platform.
  2. Use conda to build and activate the new environment.
  1. Then upgrade pip. This is needed because the default pip installation in the Python 3.7 environment is often slightly out of date.
  2. Finally, install black. This is required because black is not currently in any of the conda distribution channels.

Here are the commands:

$ conda create --name mastering python=3.7 pyyaml sqlalchemy jinja2 
pytest sphinx mypy pylint
$ conda activate mastering
$ python3 -m pip install --upgrade pip
$ python3 -m pip install black

The suite of tools (pytest, sphinx, mypy, pylint, and black) are essential for creating high-quality, reliable Python programs. The other components, pyyaml, sqlalchemy, and jinja2, are helpful for building useful applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset