diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..da95fa4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: ci-test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.11 + uses: actions/setup-python@v2 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + pip install -e . + - name: Testing + run: | + python -m pytest --cov=fastvector tests + python -m codecov + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d1421a8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,252 @@ +[build-system] +requires = [ + "setuptools", + "setuptools-scm", +] +build-backend = "setuptools.build_meta" + +[project] +name = "fastvector" +authors = [ + {name = "Jan Schaffranek", email = "email@email.com"}, +] +description = "This is a simple vector python package." +readme = "README.md" +license = {file = "LICENSE"} +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS", +] +dependencies = [ + "numpy>=1.21.6; python_version<'3.11'", + "numpy>=1.23.2; python_version>='3.11'", +] +dynamic = ["version"] + +[project.optional-dependencies] +test = [ + "pytest", + "pytest-cov", + "codecov", + "pre-commit", +] +doc = [ + "mkdocs", + "mkdocstrings", + "mkdocstrings[python]", + "mkdocs-material", + "Pygments", +] +dev = [ + "black", + "isort", + "mypy", + "pre-commit", + "ruff", +] +all = ["fastvector[test,doc,dev]"] + +[tool.setuptools] +platforms = ["unix", "linux", "osx", "cygwin", "win32"] +packages = ["fastvector"] # optional + +[tool.setuptools.dynamic] +version = {attr = "fastvector.__version__"} + +[tool.pytest.ini_options] +minversion = "7.3" +testpaths = "tests" + +[tool.coverage.run] +branch = true +parallel = true +omit = [ + "setup.py", + "fastvector/__init__.py", + "fastvector/version.py", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "if self.debug", + "raise AssertionError", + "raise NotImplementedError", + "if __name__ == .__main__.:", + "raise AssertionError", + "raise NotImplementedError", +] + +[tool.coverage.paths] +source = [ + "fastvector/*", +] + +[tool.coverage.html] +directory = "reports" + +######## Tools +[tool.black] +target-version = ['py310'] +line-length = 80 +skip-string-normalization = false +skip-magic-trailing-comma = false +force-exclude = ''' +/( + | docs + | setup.py +)/ +''' + +[tool.isort] +py_version = 310 +sections = [ + "FUTURE", + "STDLIB", + "THIRDPARTY", + "FIRSTPARTY", + "LOCALFOLDER" +] +default_section = "FIRSTPARTY" +known_third_party = [ + "numpy", + "pandas", + "keras", + "tensorflow", + "sklearn", + "matplotlib", + "scipy", + "h5py", + "seaborn", + "numba", + "gym", + "PyQt5", + "PyQt6", + "pyqtgraph", + "torch", + "tqdm", + "cv2", + "skimage", + "tensorcross", + "tensorflow_datasets" +] +known_first_party = [] +known_local_folder = [] +# style: black +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +ensure_newline_before_comments = true +line_length = 80 +split_on_trailing_comma = true +lines_after_imports = 2 +force_single_line = true +skip_glob = [ + "docs/*", + "setup.py" +] +filter_files = true + +[tool.ruff] +target-version = "py310" +select = ["F", "E"] +extend-select = ["W", "C90", "I", "N", "UP", "YTT", "ANN", "ASYNC", "BLE", "B", "A", "COM", "C4", "EXE", "FA", "ISC", "ICN", "INP", "PIE", "PYI", "PT", "Q", "RSE", "RET", "SLF", "SLOT", "SIM", "TID", "TCH", "INT", "ARG", "PTH", "TD", "FIX", "PD", "PL", "TRY", "FLY", "NPY", "PERF", "FURB", "RUF"] +ignore = ["I001", "ANN401", "SIM300", "PERF203", "ANN101", "B905", "NPY002", "COM812", "N999", "PTH", "INP001", "TRY003", "PLW1641"] +fixable = ["W", "C90", "I", "N", "UP", "YTT", "ANN", "ASYNC", "BLE", "B", "A", "COM", "C4", "EXE", "FA", "ISC", "ICN", "INP", "PIE", "PYI", "PT", "Q", "RSE", "RET", "SLF", "SLOT", "SIM", "TID", "TCH", "INT", "ARG", "PTH", "TD", "FIX", "PD", "PL", "TRY", "FLY", "NPY", "PERF", "FURB", "RUF"] +unfixable = [] +line-length = 80 +extend-exclude = ["docs", "test", "tests"] +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +[tool.ruff.isort] +force-single-line = true +force-sort-within-sections = false +lines-after-imports = 2 +[tool.ruff.mccabe] +max-complexity = 24 +[tool.ruff.pycodestyle] +ignore-overlong-task-comments = true +[tool.ruff.pydocstyle] +convention = "numpy" +[tool.ruff.flake8-annotations] +allow-star-arg-any = false +ignore-fully-untyped = false +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +skip-magic-trailing-comma = false +line-ending = "auto" + +[tool.mypy] +# Platform configuration +python_version = "3.10" +# imports related +ignore_missing_imports = true +follow_imports = "silent" +# None and Optional handling +no_implicit_optional = true +strict_optional = true +# Configuring warnings +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_no_return = true +warn_unreachable = true +warn_return_any = false +# Untyped definitions and calls +check_untyped_defs = true +disallow_untyped_calls = false +disallow_untyped_defs = false +disallow_incomplete_defs = true +disallow_untyped_decorators = false +# Disallow dynamic typing +disallow_subclassing_any = true +disallow_any_unimported = false +disallow_any_expr = false +disallow_any_decorated = false +disallow_any_explicit = false +disallow_any_generics = false +# Miscellaneous strictness flags +allow_untyped_globals = false +allow_redefinition = false +local_partial_types = false +implicit_reexport = true +strict_equality = true +# Configuring error messages +show_error_context = false +show_column_numbers = false +show_error_codes = true +exclude = ["docs"] + +[tool.pyright] +pythonVersion = "3.10" +typeCheckingMode = "basic" +# enable subset of "strict" +reportDuplicateImport = true +reportInvalidStubStatement = true +reportOverlappingOverload = true +reportPropertyTypeMismatch = true +reportUntypedClassDecorator = true +reportUntypedFunctionDecorator = true +reportUntypedNamedTuple = true +reportUnusedImport = true +# disable subset of "basic" +reportGeneralTypeIssues = true +reportMissingModuleSource = false +reportOptionalCall = true +reportOptionalIterable = true +reportOptionalMemberAccess = true +reportOptionalOperand = true +reportOptionalSubscript = true +reportPrivateImportUsage = true +reportUnboundVariable = true