Skip to content

Refactor for Python 3.10 compatibility#8

Merged
zombyacoff merged 9 commits into
mainfrom
refactor/py310-baseline
May 21, 2026
Merged

Refactor for Python 3.10 compatibility#8
zombyacoff merged 9 commits into
mainfrom
refactor/py310-baseline

Conversation

@zombyacoff
Copy link
Copy Markdown
Owner

@zombyacoff zombyacoff commented May 20, 2026

Summary by cubic

Set Python 3.10 as the new baseline across the library, CI, and tooling. Removed deprecated Faceit/AsyncFaceit, modernized typing and validators, switched to uv_build, and bumped the package to 0.3.0.

  • Refactors

    • Drop Python 3.8/3.9; set requires-python = ">=3.10", update classifiers (incl. 3.15) and README badge.
    • Replace legacy typing with Python 3.10 features (X | Y unions, final, overload, TypeAlias); tighten generics and TYPE_CHECKING usage.
    • Simplify Pydantic validation (use AfterValidator directly); improve timestamp handling.
    • Rename warn_stacklevel to find_user_stacklevel; adjust imports.
    • Remove faceit/faceit.py and the deprecated Faceit/AsyncFaceit exports; clean __all__.
    • Exceptions: keep base API exceptions extensible (remove final on base types).
    • Tooling/CI: set ruff target-version = "py310", mypy python_version = 3.10, ignore docs/*; CI matrix runs on 3.10.03.14; run only on push (drop pull_request trigger).
    • Build/publish: migrate to uv_build; use uv build and uv publish.
  • Migration

    • Python 3.10+ is required.
    • Replace deprecated entry points:
      • Use SyncDataResource or AsyncDataResource instead of Faceit/AsyncFaceit or Faceit.data().

Written for commit b1f2b37. Summary will update on new commits. Review in cubic

@zombyacoff zombyacoff linked an issue May 20, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 45 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/faceit/api/pagination.py">

<violation number="1" location="src/faceit/api/pagination.py:53">
P1: Module-level `TypeAlias` assignments use 3.9/3.10-only runtime typing syntax, which breaks imports on supported Python 3.8 environments.</violation>
</file>

<file name="src/faceit/api/data/matches.py">

<violation number="1" location="src/faceit/api/data/matches.py:23">
P1: Dropping `FaceitMatchID._validate` removes the prefix and UUID validation from the after-validator. `FaceitMatchID` itself is a `str` subclass whose constructor performs no validation; only the `_validate` classmethod enforces the expected format.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

_PageType: TypeAlias = typing.Union[ItemPage[typing.Any], RawAPIPageResponse]
_PageList: TypeAlias = typing.List[_PageType]
_PageT = typing.TypeVar("_PageT", bound=_PageType)
_PageType: TypeAlias = RawAPIPageResponse | ItemPage[Any]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Module-level TypeAlias assignments use 3.9/3.10-only runtime typing syntax, which breaks imports on supported Python 3.8 environments.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/faceit/api/pagination.py, line 53:

<comment>Module-level `TypeAlias` assignments use 3.9/3.10-only runtime typing syntax, which breaks imports on supported Python 3.8 environments.</comment>

<file context>
@@ -31,36 +45,31 @@
-_PageType: TypeAlias = typing.Union[ItemPage[typing.Any], RawAPIPageResponse]
-_PageList: TypeAlias = typing.List[_PageType]
-_PageT = typing.TypeVar("_PageT", bound=_PageType)
+_PageType: TypeAlias = RawAPIPageResponse | ItemPage[Any]
+_PageList: TypeAlias = list[_PageType]
+_PageT = TypeVar("_PageT", bound=_PageType)
</file context>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

уже не поддерживаем 3.8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I've saved this as a new learning to improve future reviews.

_MatchIDValidated: TypeAlias = Annotated[
_MatchID, AfterValidator(FaceitMatchID._validate)
_MatchID,
AfterValidator(FaceitMatchID),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Dropping FaceitMatchID._validate removes the prefix and UUID validation from the after-validator. FaceitMatchID itself is a str subclass whose constructor performs no validation; only the _validate classmethod enforces the expected format.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/faceit/api/data/matches.py, line 23:

<comment>Dropping `FaceitMatchID._validate` removes the prefix and UUID validation from the after-validator. `FaceitMatchID` itself is a `str` subclass whose constructor performs no validation; only the `_validate` classmethod enforces the expected format.</comment>

<file context>
@@ -19,11 +18,9 @@
 _MatchIDValidated: TypeAlias = Annotated[
-    _MatchID, AfterValidator(FaceitMatchID._validate)
+    _MatchID,
+    AfterValidator(FaceitMatchID),
 ]
 
</file context>
Suggested change
AfterValidator(FaceitMatchID),
AfterValidator(FaceitMatchID._validate),

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FaceitMatchID have pydantic validation logic

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! I've saved this as a new learning to improve future reviews.

@zombyacoff zombyacoff force-pushed the refactor/py310-baseline branch from f70b0bf to b1f2b37 Compare May 21, 2026 12:07
@zombyacoff zombyacoff merged commit 58a8c95 into main May 21, 2026
5 checks passed
Repository owner deleted a comment from cubic-dev-ai Bot May 21, 2026
@zombyacoff zombyacoff added the enhancement New feature or request label May 22, 2026
@zombyacoff
Copy link
Copy Markdown
Owner Author

review @cubic-dev-ai

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented May 22, 2026

review @cubic-dev-ai

@zombyacoff I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 45 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade Python baseline to 3.10 and drop EOL versions

1 participant