Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 120 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta"

[project]
name = "runtime-keypath"
version = "0.1.7"
authors = [{ name = "Chris Fu", email = "17433201@qq.com" }]
description = "Supports runtime key-path recording/accessing for Python."
classifiers = [
Expand All @@ -17,8 +16,127 @@ classifiers = [
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8"
dependencies = ["typing_extensions >= 4.9"]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/Azureblade3808/py-runtime-keypath"
"Bug Tracker" = "https://github.com/Azureblade3808/py-runtime-keypath/issues"

[tool.isort]
profile = "black"

case_sensitive = true
combine_as_imports = true
reverse_relative = true
star_first = true
treat_all_comments_as_code = true

[tool.pyright]

# region[Main Configuration Options]
include = ["**/*.py", "**/*.pyi"]

pythonPlatform = "All"

typeCheckingMode = "strict"
useLibraryCodeForTypes = false
# endregion

# region[Type Check Diagnostics Settings]
analyzeUnannotatedFunctions = true
strictParameterNoneValue = false
enableTypeIgnoreComments = true
disableBytesTypePromotions = true
strictListInference = false
strictDictionaryInference = false
strictSetInference = false
deprecateTypingAliases = true
enableExperimentalFeatures = false
reportMissingTypeStubs = "none"
reportMissingModuleSource = "error"
reportInvalidTypeForm = "error"
reportMissingImports = "error"
reportUndefinedVariable = "error"
reportAssertAlwaysTrue = "error"
reportInvalidStringEscapeSequence = "error"
reportInvalidTypeVarUse = "error"
reportSelfClsParameterName = "warning"
reportUnsupportedDunderAll = "warning"
reportUnusedExpression = "none"
reportWildcardImportFromLibrary = "warning"
reportAbstractUsage = "error"
reportArgumentType = "error"
reportAssertTypeFailure = "error"
reportAssignmentType = "error"
reportAttributeAccessIssue = "error"
reportCallIssue = "error"
reportGeneralTypeIssues = "error"
reportInconsistentOverload = "error"
reportIndexIssue = "error"
reportInvalidTypeArguments = "error"
reportNoOverloadImplementation = "error"
reportOperatorIssue = "error"
reportOptionalSubscript = "error"
reportOptionalMemberAccess = "error"
reportOptionalCall = "error"
reportOptionalIterable = "error"
reportOptionalContextManager = "error"
reportOptionalOperand = "error"
reportRedeclaration = "error"
reportReturnType = "error"
reportTypedDictNotRequiredAccess = "error"
reportPrivateImportUsage = "error"
reportUnboundVariable = "error"
reportUnhashable = "error"
reportUnusedCoroutine = "error"
reportUnusedExcept = "error"
reportFunctionMemberAccess = "warning"
reportIncompatibleMethodOverride = "error"
reportIncompatibleVariableOverride = "error"
reportOverlappingOverload = "none"
reportPossiblyUnboundVariable = "error"
reportConstantRedefinition = "error"
reportDeprecated = "warning"
reportDuplicateImport = "error"
reportIncompleteStub = "warning"
reportInconsistentConstructor = "error"
reportInvalidStubStatement = "error"
reportMatchNotExhaustive = "error"
reportMissingParameterType = "none"
reportMissingTypeArgument = "none"
reportPrivateUsage = "none"
reportTypeCommentUsage = "error"
reportUnknownArgumentType = "none"
reportUnknownLambdaType = "none"
reportUnknownMemberType = "none"
reportUnknownParameterType = "none"
reportUnknownVariableType = "none"
reportUnnecessaryCast = "none"
reportUnnecessaryComparison = "none"
reportUnnecessaryContains = "none"
reportUnnecessaryIsInstance = "none"
reportUnusedClass = "warning"
reportUnusedImport = "warning"
reportUnusedFunction = "warning"
reportUnusedVariable = "warning"
reportUntypedBaseClass = "warning"
reportUntypedClassDecorator = "none"
reportUntypedFunctionDecorator = "none"
reportUntypedNamedTuple = "warning"
reportCallInDefaultInitializer = "warning"
reportImplicitOverride = "none"
reportImplicitStringConcatenation = "warning"
reportImportCycles = "none"
reportMissingSuperCall = "none"
reportPropertyTypeMismatch = "none"
reportShadowedImports = "warning"
reportUninitializedInstanceVariable = "none"
reportUnnecessaryTypeIgnoreComment = "none"
reportUnusedCallResult = "error"
# endregion

[tool.pytest.ini_options]
python_files = ["**/__test__.py", "**/*_test.py"]

[tool.setuptools.dynamic]
version = { attr = "runtime_keypath.__version__" }
8 changes: 7 additions & 1 deletion runtime_keypath/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from ._core import *
__version__ = "0.2.0"

######

from ._core import *
from ._sugarful import *
from ._sugarless import *
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pytest

from ._core import *
from . import *


class Tests__KeyPathSupporting:
Expand Down
51 changes: 51 additions & 0 deletions runtime_keypath/__typecheck__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""
Makes sure that type-checking works as expected.
"""

# pyright: reportUnnecessaryTypeIgnoreComment = true

######

from __future__ import annotations

__all__ = []

######

from typing import Any

from typing_extensions import assert_type

from . import *

######


class Check__KeyPath:
@staticmethod
def check__sugarful(any_: Any, /) -> None:
class A:
b: B

class B:
c: C

class C:
pass

a: A = any_
__ = assert_type(KeyPath[C] or a.b.c, "KeyPath[C]")

@staticmethod
def check__sugarless(any_: Any, /) -> None:
class A:
b: B

class B:
c: C

class C:
pass

a: A = any_
__ = assert_type(KeyPath.of(a.b.c), "KeyPath[C]")
Loading
Loading