Skip to content

Conversation

@delatrie
Copy link
Contributor

@delatrie delatrie commented Apr 2, 2025

Context

According to typing.python.org:

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing.

At the same time:

The single-file module should be refactored into a package and indicate that the package supports typing as described above.

Since the Allure API is exposed to users via the allure.py module (not via a package), it can't be affected by py.typed.

Solution

This PR refactors allure.py into a package. Now the allure-python-commons project defines two packages: allure_commons (for integrations) and allure (for test authors). Both packages include py.typed, which enables type checking.

Currently, this mainly affects type checking of functions with @allure.step applied to them (see #731).

More typing annotations will be added in the future.

Other changes

  • standardize quotes in allure-python-commons/setup.py
  • fix description type of allure-python-commons
  • fix typing of allure.dynamic.parameter's mode

Fixes #731
Supersedes #848

@delatrie delatrie force-pushed the enable-commons-typecheck branch from 8c24e28 to 12a7df4 Compare April 2, 2025 13:59
@delatrie delatrie merged commit 3ea25a2 into master Apr 2, 2025
48 checks passed
@delatrie delatrie deleted the enable-commons-typecheck branch April 2, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add py.typed marker files to conform PEP-561 and better typechecking

3 participants