Frameworks¶
What a framework finds and calls by itself counts as used, such as pytest's tests or Django's settings. A framework is turned off in the configuration:
[tool.unref.frameworks]
unittest = false
pytest¶
Enabled by default: yes.
- In
test_*.pyand*_test.pyfiles:test*functions,Test*classes and theirtest*methods, setup and teardown functions. - Anywhere:
pytest_*hooks and fixtures.
A project that sets python_files, python_classes or python_functions adds its own names with an
override:
[[tool.unref.overrides]]
paths = ["tests"]
used-names = ["check_*", "Describe*"]
unittest¶
Enabled by default: yes.
- Subclasses of
unittest.TestCase, with theirtest*,setUpandtearDownmethods.
pydantic¶
Enabled by default: yes.
- In subclasses of
pydantic.BaseModel: fields andmodel_config. - Anywhere: methods with Pydantic's validator and serializer decorators and
computed_field, also when applied by hand, as in_check = field_validator("name")(check).
dataclasses¶
Enabled by default: yes.
- Fields of classes with
dataclasses.dataclass, Pydantic'sdataclassor an attrs decorator such asattrs.define. - Fields of
NamedTuplesubclasses.
sqlalchemy¶
Enabled by default: yes.
- In declarative models and their mixins: attributes annotated
Mapped, or set tomapped_column,Column,relationshipand the like. - Anywhere: functions with
event.listens_for,validates,reconstructorordeclared_attr.
fastapi¶
Enabled by default: yes.
- Functions and methods with a route or event decorator, such as
app.getorrouter.websocket, of aFastAPI()orAPIRouter(), or an instance of a subclass, set at module level or in the same function.
flask¶
Enabled by default: yes.
- Functions and methods with a route, error or request decorator, such as
app.routeorbp.errorhandler, ofFlask()orBlueprint(), or an instance of a subclass, set at module level or in the same function, of a parameter annotated as one, of a parameter of a test or fixture named as a pytest fixture that returns or yields one, of a module-level variable set to what a factory makes, or ofcurrent_app. - Commands of
cli.commandandcli.groupof these, and ofcommandandgroupof anAppGroup()or of such a group. - Module-level
create_appandmake_appfunctions that make aFlask(), and module-levelappandapplicationvariables set toFlask()or to what such a factory makes. - HTTP method handlers of
MethodViewsubclasses, anddispatch_requestofViewsubclasses.
sphinx¶
Enabled by default: yes.
- In Sphinx's configuration files: module-level variables not starting with
_, and thesetupandlinkcode_resolvefunctions.
The configuration files are each conf.py that sets project, extensions or html_theme, or those that
configuration names. A table turns the rules on:
[tool.unref.frameworks.sphinx]
configuration = ["docs/conf.py"]
django¶
Enabled by default: yes.
- In settings modules: module-level uppercase names, such as
DEBUG. - In the module that
ROOT_URLCONFnames:urlpatternsandhandler400,handler403,handler404,handler500. - In modules that
include("...")names:urlpatternsandapp_name. - Module-level variables set to
get_wsgi_application()orget_asgi_application(). - Subclasses of
AppConfig, with theirreadymethod and attributes such asname. - Subclasses of
MigrationnamedMigration, with their attributes such asoperationsanddependencies.
The settings modules are those that os.environ.setdefault("DJANGO_SETTINGS_MODULE", ...) names, those
that settings names, and the modules they star import. A table turns the rules on:
[tool.unref.frameworks.django]
settings = ["config/settings/production.py"]
celery¶
Enabled by default: yes.
- Tasks of
shared_task, and of thetaskdecorator ofCelery(), or an instance of a subclass, set at module level or in the same function, of a parameter annotated as one, or ofcurrent_app. - In subclasses of
Task:runand handlers such ason_failure.