### Clone Python Microservice Template Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Instructions to clone the project repository using Git. This is the first step to getting started with the template. ```bash git clone https://github.com/thorgilis/Python.Template.Microservice.git cd Python.Template.Microservice ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Commands to install production and development dependencies using pip from the provided requirements files. ```bash pip install -r requirements.txt pip install -r requirements-dev.txt ``` -------------------------------- ### Pre-commit Configuration Example Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Example snippet showing the structure of a pre-commit configuration file, defining hooks for formatting, linting, and static analysis. ```yaml repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: https://github.com/psf/black rev: 23.12.1 hooks: - id: black - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - id: isort args: ["--profile", "black"] - repo: https://github.com/pycqa/flake8 rev: 7.0.0 hooks: - id: flake8 ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Command to install pre-commit hooks, which automate code quality checks before each commit, ensuring consistency. ```bash pre-commit install ``` -------------------------------- ### Run Application Locally with Uvicorn Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Command to start the FastAPI application in development mode using Uvicorn. The `--reload` flag enables automatic restarts on code changes. ```bash uvicorn app.main:app --reload ``` -------------------------------- ### Set Up Python Virtual Environment Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Steps to create and activate a Python virtual environment for isolating project dependencies. Supports both Linux/macOS and Windows. ```bash python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate ``` -------------------------------- ### Run Linters with Pre-commit Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Command to execute all configured pre-commit hooks across the entire project. This verifies code style, formatting, and potential issues. ```bash pre-commit run --all-files ``` -------------------------------- ### Run Application with Docker Compose Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Command to build and run the application using Docker Compose. This simplifies containerized deployment and local testing. ```bash docker-compose up --build ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Instructions to copy the template environment file and edit it for local configuration. This step is crucial for setting up application-specific parameters. ```bash cp .env.template .env # Edit values as needed ``` -------------------------------- ### Run Tests with Pytest Source: https://github.com/thorgilis/python.template.microservice/blob/main/readme.md Command to execute tests using Pytest, including coverage reporting. This ensures the application's functionality and code quality. ```bash pytest --cov=app tests/ --cov-report=xml ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.