diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2c795eb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,297 @@ +[build-system] +requires = ["hatchling >= 1.13.0"] +build-backend = "hatchling.build" + +[project] +name = "nvcc4jupyter" +description = "Jupyter notebook plugin to run CUDA C/C++ code" +readme = "README.md" +requires-python = ">=3.7" +license = {text = "MIT License"} +authors = [ + { name = "Andrei Nechaev", email = "lyfaradey@yahoo.com" }, +] +classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python", +] +dependencies = [] +dynamic = ["version"] + +[tool.hatch.version] +path = "nvcc4jupyter/__init__.py" + +[tool.hatch.build.targets.wheel] +packages = ["nvcc4jupyter"] + +[project.optional-dependencies] +testing = ["pytest>=7.4.3", "IPython>=8.19.0"] + + +[tool.pytest.ini_options] +addopts = [ + "--color=yes", + "--durations=0", + "--strict-markers", + "--doctest-modules", +] +filterwarnings = [ + "ignore::DeprecationWarning", + "ignore::UserWarning", +] +log_cli = "True" +markers = [ + "slow: slow tests", +] +minversion = "6.0" +testpaths = "tests/" + +[tool.coverage.report] +exclude_lines = [ + "pragma: nocover", + "raise NotImplementedError", + "raise NotImplementedError()", + "if __name__ == .__main__.:", +] + +[tool.isort] +profile = "black" + +[tool.bandit] +exclude_dirs = ["build","dist","tests","scripts"] +number = 4 +recursive = true +targets = "src" +skips = ["B101", "B311"] + +[tool.black] +line-length = 79 +fast = true +experimental-string-processing = true + +[tool.coverage.run] +branch = true + +[tool.flake8] +max-line-length = 79 +select = "F,E,W,B,B901,B902,B903" +exclude = [ + ".eggs", + ".git", + ".tox", + "nssm", + "obj", + "out", + "packages", + "pywin32", + "tests", + "swagger_client" +] +ignore = [ + "E722", + "B001", + "W503", + "E203" +] + +[tool.pyright] +include = ["src"] +exclude = [ + "**/node_modules", + "**/__pycache__", +] +venv = "env37" + +reportMissingImports = true +reportMissingTypeStubs = false + +pythonVersion = "3.7" +pythonPlatform = "Linux" + +executionEnvironments = [ + { root = "src" } +] + +[tool.tox] +legacy_tox_ini = """ +[tox] +envlist = py, integration, spark, all +[testenv] +commands = + pytest -m "not integration and not spark" {posargs} +[testenv:integration] +commands = + pytest -m "integration" {posargs} +[testenv:spark] +extras = spark +setenv = + PYSPARK_DRIVER_PYTHON = {envpython} + PYSPARK_PYTHON = {envpython} +commands = + pytest -m "spark" {posargs} +[testenv:all] +extras = all +setenv = + PYSPARK_DRIVER_PYTHON = {envpython} + PYSPARK_PYTHON = {envpython} +commands = + pytest {posargs} +""" + +[tool.pylint] +extension-pkg-whitelist= [ + "numpy", + "torch", + "cv2", + "pyodbc", + "pydantic", + "ciso8601", + "netcdf4", + "scipy" +] +ignore="CVS" +ignore-patterns="test.*?py,conftest.py" +init-hook='import sys; sys.setrecursionlimit(8 * sys.getrecursionlimit())' +jobs=0 +limit-inference-results=100 +persistent="yes" +suggestion-mode="yes" +unsafe-load-any-extension="no" + +[tool.pylint.'MESSAGES CONTROL'] +enable="c-extension-no-member" + +[tool.pylint.'REPORTS'] +evaluation="10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)" +output-format="text" +reports="no" +score="yes" + +[tool.pylint.'REFACTORING'] +max-nested-blocks=5 +never-returning-functions="sys.exit" + +[tool.pylint.'BASIC'] +argument-naming-style="snake_case" +attr-naming-style="snake_case" +bad-names= [ + "foo", + "bar" +] +class-attribute-naming-style="any" +class-naming-style="PascalCase" +const-naming-style="UPPER_CASE" +docstring-min-length=-1 +function-naming-style="snake_case" +good-names= [ + "i", + "j", + "k", + "ex", + "Run", + "_" +] +include-naming-hint="yes" +inlinevar-naming-style="any" +method-naming-style="snake_case" +module-naming-style="any" +no-docstring-rgx="^_" +property-classes="abc.abstractproperty" +variable-naming-style="snake_case" + +[tool.pylint.'FORMAT'] +ignore-long-lines="^\\s*(# )?.*['\"]??" +indent-after-paren=4 +indent-string=' ' +max-line-length=79 +max-module-lines=1000 +single-line-class-stmt="no" +single-line-if-stmt="no" + +[tool.pylint.'LOGGING'] +logging-format-style="old" +logging-modules="logging" + +[tool.pylint.'MISCELLANEOUS'] +notes= [ + "FIXME", + "XXX", + "TODO" +] + +[tool.pylint.'SIMILARITIES'] +ignore-comments="yes" +ignore-docstrings="yes" +ignore-imports="yes" +min-similarity-lines=7 + +[tool.pylint.'SPELLING'] +max-spelling-suggestions=4 +spelling-store-unknown-words="no" + +[tool.pylint.'STRING'] +check-str-concat-over-line-jumps="no" + +[tool.pylint.'TYPECHECK'] +contextmanager-decorators="contextlib.contextmanager" +generated-members="numpy.*,np.*,pyspark.sql.functions,collect_list" +ignore-mixin-members="yes" +ignore-none="yes" +ignore-on-opaque-inference="yes" +ignored-classes="optparse.Values,thread._local,_thread._local,numpy,torch,swagger_client" +ignored-modules="numpy,torch,swagger_client,netCDF4,scipy" +missing-member-hint="yes" +missing-member-hint-distance=1 +missing-member-max-choices=1 + +[tool.pylint.'VARIABLES'] +additional-builtins="dbutils" +allow-global-unused-variables="yes" +callbacks= [ + "cb_", + "_cb" +] +dummy-variables-rgx="_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_" +ignored-argument-names="_.*|^ignored_|^unused_" +init-import="no" +redefining-builtins-modules="six.moves,past.builtins,future.builtins,builtins,io" + +[tool.pylint.'CLASSES'] +defining-attr-methods= [ + "__init__", + "__new__", + "setUp", + "__post_init__" +] +exclude-protected= [ + "_asdict", + "_fields", + "_replace", + "_source", + "_make" +] +valid-classmethod-first-arg="cls" +valid-metaclass-classmethod-first-arg="cls" + +[tool.pylint.'DESIGN'] +max-args=5 +max-attributes=7 +max-bool-expr=5 +max-branches=12 +max-locals=15 +max-parents=7 +max-public-methods=20 +max-returns=6 +max-statements=50 +min-public-methods=2 + +[tool.pylint.'IMPORTS'] +allow-wildcard-with-all="no" +analyse-fallback-blocks="no" +deprecated-modules="optparse,tkinter.tix" + +[tool.pylint.'EXCEPTIONS'] +overgeneral-exceptions= [ + "BaseException", + "Exception" +] \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 0643352..0000000 --- a/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from distutils.core import setup - -setup( - name='NVCCPlugin', - version='0.0.2', - author='Andrei Nechaev', - author_email='lyfaradey@yahoo.com', - py_modules=['nvcc_plugin', 'v2.v2', 'v1.v1', 'common.helper'], - url='https://github.com/andreinechaev/nvcc4jupyter', - license='LICENSE', - description='Jupyter notebook plugin to run CUDA C/C++ code', - # long_description=open('README.md').read(), -) diff --git a/tests/fixtures/fixtures.py b/tests/fixtures/fixtures.py index f898df6..f97b086 100644 --- a/tests/fixtures/fixtures.py +++ b/tests/fixtures/fixtures.py @@ -1,8 +1,5 @@ import glob import os -import sys - -sys.path.append(".") import pytest from IPython.core.interactiveshell import InteractiveShell diff --git a/tests/test_v1.py b/tests/test_v1.py index 45f5d4c..05d340e 100644 --- a/tests/test_v1.py +++ b/tests/test_v1.py @@ -3,14 +3,10 @@ import math import os import re import shutil -import sys from typing import List import pytest -sys.path.append(".") - - from nvcc4jupyter.plugin import NVCCPlugin @@ -42,9 +38,9 @@ def copy_source_to_group( @pytest.fixture(autouse=True, scope="function") def before_each(plugin: NVCCPlugin): - shutil.rmtree(plugin.workdir, ignore_errors=True) # before test + shutil.rmtree(plugin.workdir, ignore_errors=True) # before test yield - pass # after test + pass # after test def test_save_source(plugin: NVCCPlugin, sample_cuda_code: str) -> None: