Skip to content

Tools

Poetry

Purpose: Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Usage:

  • To install dependencies: poetry install
  • To add a new dependency: poetry add <package>
  • To build your project: poetry build

Advantages:

  • Simplifies dependency management.
  • Resolves dependencies reliably.
  • Manages virtual environments for you.

Devcontainer

Purpose: A Devcontainer, or Development Container, is a configurable, reproducible, and portable development environment encapsulated within a Docker container.

Usage:

  • Use in VSCode with the Remote - Containers extension.
  • Define the container configuration in .devcontainer/devcontainer.json.

Advantages:

  • Consistent development environments for all team members.
  • Works seamlessly across different platforms (Windows, Linux, macOS).
  • Reduces "works on my machine" problems.

Semantic Versioning

Purpose: Semantic Versioning (SemVer) is a versioning scheme for software that conveys meaning about the underlying changes.

Usage:

  • Format: MAJOR.MINOR.PATCH (e.g., 2.0.1)
  • Increment MAJOR version for incompatible API changes.
  • Increment MINOR version for added functionality in a backward-compatible manner.
  • Increment PATCH version for backward-compatible bug fixes.

Advantages:

  • Provides an understanding of the impact of new versions.
  • Helps in managing dependencies and release cycles.
  • Widely adopted as a standard in the software industry.

pyproject.toml

Purpose: pyproject.toml is the configuration file for tools like Poetry. It is used to define build system requirements and project metadata.

Usage:

  • Declare project dependencies.
  • Define build system requirements.
  • Configure tools like mypy, pytest.

Advantages:

  • Centralized configuration for Python tools.
  • Simplifies project setup

  • Enhances readability and maintainability of project configurations.

Pytest

Purpose: Pytest is a testing framework that makes it easy to write simple and scalable test cases for Python codes.

Usage:

  • Write test functions prefixed with test_.
  • Run tests using the pytest command.
  • With the default VSCode settings, it will offer running tests automatically in the "tests" menu.

Advantages:

  • Supports complex functional testing for applications and libraries.
  • Rich plugin architecture for extending its functionality.
  • Easy to start with, thanks to its simple syntax.

Mypy

Purpose: Mypy is an optional static type checker for Python. It helps to catch errors early through type annotations.

Usage:

  • Add type annotations to your Python code.
  • Run mypy <your_module> to check for type errors.
  • With the existing .devcontainer VSCode will automatically install an extensions that scans your code.

Advantages:

  • Improves code quality and reliability.
  • Facilitates easier understanding and maintenance of code.
  • Detects bugs that are hard to find at runtime.

Ruff

Purpose: Ruff is a Python linter focused on speed and usability. It helps to maintain a clean and consistent code base.

Usage:

  • Run ruff . to check your Python code for stylistic errors.
  • With the existing .devcontainer VSCode will automatically install an extensions that scans your code.

Advantages:

  • Extremely fast and easy to integrate into development workflows.
  • Helps maintain a consistent coding style.
  • Catches potential errors and code smells.

SonarCloud

Purpose: SonarCloud is a cloud-based code quality and security service. It analyzes your code and provides detailed reports on bugs, vulnerabilities, and code smells.

Usage:

  • Integrate with your CI/CD pipeline for automatic code analysis.
  • Review the reports on the SonarCloud dashboard.

Advantages:

  • Improves code quality and security.
  • Offers a detailed overview of the project's health.
  • Provides actionable feedback and metrics to guide development.

pre-commit

Purpose: pre-commit is a framework to improve the quality of commits by running standardized checks before committing code.

Usage:

  • pip install pre-commit in your virtual environment.
  • Install pre-commit hooks using pre-commit install.
  • Commit your code as usual. The hooks will run automatically.
  • To run the hooks manually for all files, use pre-commit run --all-files.
  • To commit without running the hooks, use git commit --no-verify.

Advantages:

  • Improves code quality and consistency.
  • Prevents committing code with errors.
  • Provides a consistent development experience across all team members.