From 895bc225ba0605b9c92d7f923b0b45d19ed5706b Mon Sep 17 00:00:00 2001 From: Ivan Korobkov Date: Wed, 18 Oct 2023 11:21:38 +0800 Subject: [PATCH] Cleanup obsolete files and builds --- makefile | 7 +-- pyproject.toml | 54 ++++++++--------------- {typeshed/pyi => src}/inject/__init__.pyi | 0 {test37 => test}/test_dataclass.py | 0 test37/test_future.py | 31 ------------- 5 files changed, 19 insertions(+), 73 deletions(-) rename {typeshed/pyi => src}/inject/__init__.pyi (100%) rename {test37 => test}/test_dataclass.py (100%) delete mode 100644 test37/test_future.py diff --git a/makefile b/makefile index 75cf62f..25a698e 100644 --- a/makefile +++ b/makefile @@ -4,7 +4,7 @@ SHELL := bash MAKEFLAGS += --no-builtin-rules \ --warn-undefined-variables -.PHONY: dist pytest test test37 typeshed +.PHONY: dist pytest test dist: if ! python3 -m pip freeze | grep -q build; then python3 -m pip install --upgrade build; fi @@ -35,8 +35,3 @@ pytest: test: if ! command -v nosetests &>/dev/null; then python3 -m pip install --upgrade nose; fi nosetests test - -test37: - if ! command -v nosetests &>/dev/null; then python3 -m pip install --upgrade nose; fi - nosetests test - nosetests test37 diff --git a/pyproject.toml b/pyproject.toml index 181ed78..9603367 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,30 +6,22 @@ build-backend = 'hatchling.build' name = 'inject' dynamic = ['version'] description = 'Python dependency injection framework.' -license='Apache-2.0' +license = 'Apache-2.0' readme = 'README.md' -authors = [ - { name = 'Ivan Korobkov', email = 'ivan.korobkov@gmail.com' }, -] -maintainers = [ - { name = 'Ivan Korobkov', email = 'ivan.korobkov@gmail.com' }, -] +authors = [{ name = 'Ivan Korobkov', email = 'ivan.korobkov@gmail.com' }] +maintainers = [{ name = 'Ivan Korobkov', email = 'ivan.korobkov@gmail.com' }] classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Topic :: Software Development :: Libraries :: Python Modules', ] -dependencies = [ -] +dependencies = [] [project.scripts] @@ -63,12 +55,7 @@ exclude = ''' version-file = 'src/inject/_version.py' [tool.hatch.build.targets.wheel] -packages = [ - 'src/inject', -] - -[tool.hatch.build.targets.wheel.force-include] -'typeshed/pyi/inject' = 'typeshed/pyi/inject' +packages = ['src/inject'] [tool.hatch.build.targets.wheel.shared-data] @@ -91,7 +78,6 @@ disallow_untyped_calls = true disallow_untyped_decorators = true disallow_untyped_defs = true ignore_missing_imports = true -mypy_path = ['typeshed/pyi'] no_implicit_optional = true python_version = '3.11' warn_redundant_casts = true @@ -104,25 +90,17 @@ defineConstant = { DEBUG = true } exclude = [] executionEnvironments = [] ignore = [] -include = [ - 'src/inject', - 'test', -] +include = ['src/inject', 'test'] pythonPlatform = 'Linux' pythonVersion = '3.11' reportMissingImports = true reportMissingTypeStubs = false -stubPath = 'typeshed/import' [tool.pytest.ini_options] addopts = '-rfEX --strict-markers --tb=long' minversion = '7.2' -python_files = [ - 'test_*.py', -] -testpaths = [ - './test', -] +python_files = ['test_*.py'] +testpaths = ['./test'] [tool.ruff] ignore = [ @@ -131,12 +109,18 @@ ignore = [ # Allow boolean positional values in function calls, like `dict.get(... True)` 'FBT003', # Ignore checks for possible passwords - 'S105', 'S106', 'S107', + 'S105', + 'S106', + 'S107', # Ignore complexity - 'C901', 'PLR0911', 'PLR0912', 'PLR0913', 'PLR0915', + 'C901', + 'PLR0911', + 'PLR0912', + 'PLR0913', + 'PLR0915', 'PLC1901', # empty string comparisons 'PLW2901', # `for` loop variable overwritten - 'SIM114', # Combine `if` branches using logical `or` operator + 'SIM114', # Combine `if` branches using logical `or` operator ] line-length = 120 select = [ @@ -179,9 +163,7 @@ inline-quotes = 'single' ban-relative-imports = 'all' [tool.ruff.isort] -known-first-party = [ - 'inject', -] +known-first-party = ['inject'] [tool.ruff.per-file-ignores] # Tests can use magic values, assertions, and relative imports diff --git a/typeshed/pyi/inject/__init__.pyi b/src/inject/__init__.pyi similarity index 100% rename from typeshed/pyi/inject/__init__.pyi rename to src/inject/__init__.pyi diff --git a/test37/test_dataclass.py b/test/test_dataclass.py similarity index 100% rename from test37/test_dataclass.py rename to test/test_dataclass.py diff --git a/test37/test_future.py b/test37/test_future.py deleted file mode 100644 index b61cbf8..0000000 --- a/test37/test_future.py +++ /dev/null @@ -1,31 +0,0 @@ -from __future__ import annotations - -from test import BaseTestInject - -import inject - - -class TestFutureSupport(BaseTestInject): - def test_future_support(self): - @inject.autoparams() - def func(a: 'A', b: int): - return a + b - - @inject.autoparams() - def func2(val: int): - return val - - @inject.autoparams() - def func3(a: 'A', b: 'int'): - return a + b - - def configure(binder: inject.Binder): - binder.bind('A', 1) - binder.bind(int, 2) - binder.bind('int', 3) - - inject.configure(configure) - - assert func() == 3 - assert func2() == 2 - assert func3() == 4