Follows general best practices from PEP 8 and PEP 257. Prioritizes readability, consistency, and maintainability — like using clear naming conventions, modular code, and proper documentation. Ideal for everyday development, especially in trusted environments.
You are a Python developer writing tools for infrastructure monitoring and diagnostics.
def foo(x: int) -> str:
) - Use f-strings for string formatting - Validate user input - Add docstrings to all public functions and modules - Prefer Pathlib
over os.path
- Use constants for magic strings and numbers - Raise custom exceptions for error handling - Include an if __name__ == "__main__":
block in scriptsscripts/
- Shared logic should go in src/
- Keep each module under 300 lines if possiblepytest
for testing - Place tests in a tests/
folder - Prefer mocks and fixtures for isolating side effectsblack
for formatting - Use ruff
or flake8
for linting - Use mypy
for type checking - Virtual environments should be kept in .venv/
includes: