FastAPI 101 - The tools

2 weeks ago

Loading...
views

6 min read


The tools we will be using

🐍 Python

⚠️ Python 3.7+ is necessary to follow up this series.

What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed1.

What is Python used for

Python is used in virtually every industry and scientific field that you can imagine[ˆ2], including:

  • Data Science
  • Machine Learning
  • Web Development
  • Computer Science Education
  • Computer Vision and Image Processing
  • Game Development
  • Medicine and Pharmacology
  • Biology and Bioinformatics
  • Neuroscience and Psychology
  • Astronomy
  • Other areas such as robotics, autonomous vehicles, business, meteorology and graphical user interface (GUI) development

How to install?

Newer versions of Linux already has Python3 installed, please ensure that Python is installed by running:

1python3 --version

The output should be similar to:

1Python 3.10.0

🏭 Pyenv (optional)

Pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

ℹ️ This tool isn't necessary in this tutorial, but can be helpful in your daily work.


📦 Poetry

Poetry is a python dependency management tool. It helps you packaging and managing your Python dependencies isolated from the ones installed in your system (by using virtual environments), building and publishing it.

How to install

Open your terminal and type:

1curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -

There are other ways to install Poetry, but this is the most recommended one.

Ensure the installation was successful by typing the following command in your terminal:

1poetry --version

The output should be similar to:

1Poetry version 1.1.11

🐙 Git

Git is a version control system which lets you track changes you make to your files over time. With Git, you can revert to various states of your files (like a time traveling machine). You can also make a copy of your file, make changes to that copy, and then merge these changes to the original copy.

For example, you could be working on a website's landing page and discover that you do not like the navigation bar. But at the same time, you might not want to start altering its components because it might get worse.

With Git, you can create an identical copy of that file and play around with the navigation bar. Then, when you are satisfied with your changes, you can merge the copy to the original file.

You are not limited to using Git just for source code files – you can also use it to keep track of text files or even images. This means that Git is not just for developers – anyone can find it helpful[ˆ3].

How to install?

You can find the install documentation and the version for you OS here in Git site: Mac, Linux, Windows.

Ensure the installation was successful by typing the following command in your terminal:

1git --version

The output should be similar to:

1$ git --version
2git version 2.33.0

⌨️ Visual Studio Code

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Java, Python, PHP, Go) and runtimes (such as .NET and Unity).

How to install?

The installation process can be found in Visual Studio Code docs here.

Extending Visual Studio Code for Python usage

Python's Visual Studio Code plugin adds auto-complete , integration with the most common Python linters and enable code debugging.

A instalação do plugin de Python pode ser feita através da marketplace ou através dos comandos abaixo:

Abra o VS Code Quick Open (Ctrl+P) for windows and Linux or (Command+P) for Mac, paste the following code and press enter:

1ext install ms-python.python

🗂️ Docker and Docker-compose

Docker is an open source project that makes it easy to create containers and container-based apps. Docker's lightweight and portable software containers simplify application development, testing, and deployment.

How to install? Docker installation and instructions can be found here.

Ensure the installation was successful by typing the following command in your terminal:

1docker run hello-world

The output should be similar to:

1Hello from Docker!
2This message shows that your installation appears to be working correctly.
3
4To generate this message, Docker took the following steps:
5 1. The Docker client contacted the Docker daemon.
6 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
7 (amd64)
8 3. The Docker daemon created a new container from that image which runs the
9 executable that produces the output you are currently reading.
10 4. The Docker daemon streamed that output to the Docker client, which sent it
11 to your terminal.
12
13To try something more ambitious, you can run an Ubuntu container with:
14 $ docker run -it ubuntu bash
15
16Share images, automate workflows, and more with a free Docker ID:
17 https://hub.docker.com/
18
19For more examples and ideas, visit:
20 https://docs.docker.com/get-started/

🗂️ Docker-compose

Docker Compose is a tool that was developed to help define and share multi-container applications. With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.

How to install Docker-compose installation and instructions can be found here

Ensure the installation was successful by typing the following command in your terminal:

1docker-compose --version

The output should be similar to:

1docker-compose version 1.26.0, build 8a1c60f6

🎉 Congrats! We installed all the necessary tools to follow up this series

[ˆ1]: what is python? executive summary

[ˆ2]: what is python used for? 10+ coding uses for the python programming language

[ˆ3]: git and github tutorial - version control for beginners - freecodecamp



HomeBlog

© Rhian Castro

Powered by Vercel