Developer Tools & Scripts
Relevant source files
The following files were used as context for generating this wiki page:
Developer tools and scripts provide the infrastructure for maintaining, testing, and verifying the faceit-python library. These tools manage project dependencies, enforce code quality standards, and facilitate comprehensive testing across different environments. The system relies on uv as the build backend and includes specialized scripts for workspace maintenance.
Sources: pyproject.toml:1-5, README.md:38-46
Project Configuration & Dependency Management
The project uses pyproject.toml to define the build system, project metadata, and development environment. It employs the uv_build backend and categorizes dependencies into runtime requirements and development groups.
Build System
The project enforces specific versioning for its build infrastructure to ensure reproducible builds.
- Backend:
uv_build - Python Requirement:
ge 3.10
Sources: pyproject.toml:1-12
Dependency Groups
Dependencies are split to keep the runtime footprint minimal while providing a robust development experience.
| Group | Packages | Purpose |
|---|---|---|
| Runtime | httpx, pydantic, tenacity | Core API interaction and data modeling. |
| Optional | python-decouple | Automatic environment variable loading. |
| Dev | mypy, pytest, ruff, pre-commit | Linting, type checking, and testing. |
Sources: pyproject.toml:25-33, pyproject.toml:40-49
Linting and Static Analysis
The project integrates ruff and mypy to enforce strict coding standards and type safety. Configuration for these tools is centralized in the project metadata.
Ruff Configuration
ruff serves as both a linter and formatter. The configuration targets Python 3.10 and adheres to a line length of 88 characters. It specifically ignores several rules to accommodate the library's architecture, such as S101 (assert use in tests) and PLR0913 (too many function arguments).
Sources: pyproject.toml:77-105
Mypy Type Checking
Type checking is configured to be strict. The project excludes documentation and local directories from type analysis to focus on the source code.
The diagram shows the flow of source code through the strict Mypy type checker, highlighting directories that are intentionally ignored during analysis.
Sources: pyproject.toml:52-60
Testing Suite & Utilities
The testing infrastructure uses pytest and includes specific markers for different test categories. The suite covers unit tests for custom types, HTTP client behavior, and pagination logic.
Test Markers and Configuration
Tests are categorized to separate fast unit tests from slower external interactions.
- e2e: Marker for end-to-end tests that interact with the real FACEIT API.
- asyncio: Automatically handles asynchronous test functions via
pytest-asyncio.
Sources: pyproject.toml:68-75, tests/test_http_client.py:1-15
Testing Components
| Test Module | Focus Area | Key Tools Used |
|---|---|---|
test_pagination.py | Validates offset/limit logic and Unix timestamp iterators. | unittest.mock.patch, _DummyResource |
test_http_client.py | Verifies retry logic, SSL error handling, and adaptive rate limiting. | httpx.AsyncClient, tenacity |
test_custom_types.py | Ensures FaceitID, FaceitMatchID, and URLs validate correctly. | pydantic.TypeAdapter |
Sources: tests/test_pagination.py:27-50, tests/test_http_client.py:440-460, tests/test_custom_types.py:53-70
Workspace Maintenance Scripts
The project includes maintenance scripts located in the scripts/ directory to manage the developer environment.
Cleanup Utility
The scripts/clean.py script automates the removal of build artifacts and temporary files. It target specific patterns to keep the repository clean.
- Ignored Lints: The script is exempt from
INP001(missing__init__.py) andT201(print()statements) to allow for simple command-line execution.
Sources: pyproject.toml:139-142, scripts/clean.py
Development Workflow
The development workflow is structured to ensure code quality before commits are finalized.
The sequence diagram illustrates the automated quality gates that code must pass during the commit process, involving linting, type checking, and unit testing.
Sources: pyproject.toml:42-49, README.md:28-36
Summary
Developer Tools & Scripts in faceit-python establish a rigorous environment for high-quality library development. By leveraging uv for builds, ruff for linting, and a comprehensive pytest suite, the project ensures that API interactions remain type-safe and reliable. Maintenance scripts and strict CI-ready configurations in pyproject.toml support the project's goal of achieving 100% test coverage.
Sources: pyproject.toml:43-46, README.md:104-108