Python
=========
With only a few exceptions, Smarter Framework is implemented in Python. There are certain conventions and
best practices that we've adopted, and want to impress upon future contributors to the project.
Coding Style
--------------
- Smarter Framework follows the `PEP 8 -- Style Guide for Python Code `__.
- Smarter Framework uses `Black `__ as its code formatter.
- `isort `__ to sort imports.
- `flake8 `__ for linting.
- `flake8-coding `__ for coding style linting.
- `pylint `__ for code linting.
- `pylint-django `__ for Django-specific linting.
- `mypy `__ for static type checking.
- `pyupgrade `__ to automatically upgrade syntax for newer Python versions.
- `codespell `__ to check for spelling errors.
- `bandit `__ for security linting.
- `coverage `__ to measure test coverage.
- `pydocstringformatter `__ to format docstrings.
- `pre-commit `__ for managing git hooks.
- `tox `__ for testing in multiple environments.
- `watchdog `__ for file system monitoring.
- `pre-commit hooks `__ for additional checks, such as fixing byte order markers, checking for merge conflicts, trailing whitespace, and more.
Type Hinting
--------------
Smarter Framework uses Python type hinting extensively throughout the codebase. This helps improve code readability,
provides better support for IDEs, and enables static type checking with tools like mypy.
- `pandas-stubs `__ for pandas type annotations.
- `types-cachetools `__ for cachetools type annotations.
- `types-lxml `__ for lxml type annotations.
- `types-Markdown `__ for Markdown type annotations.
- `types-paramiko `__ for paramiko type annotations.
- `types-PyYAML `__ for PyYAML type annotations.
- `types-requests `__ for requests type annotations.
- `django-stubs `__ for Django type annotations.
- `djangorestframework-stubs `__ for Django REST Framework type annotations.
- `mypy_extensions `__ for additional type annotation utilities.
Documentation
--------------
See the :doc:`Documentation Style Guide `.
Dependencies
--------------
Smarter Framework relies on a number of third-party Python packages to provide various functionalities.
These are maintained in the `smarter/requirements/in` directory of the project, with separate
files for different environments and use cases.
.. toctree::
:maxdepth: 1
:caption: Smarter Framework Python Requirements
python/base
python/constraints
python/docker
python/local
Dependabot Configuration for Python Dependencies
----------------------------------------------------
.. literalinclude:: ../../../.github/dependabot.yml
:language: yaml