From 274f895ebd3989ee31346ac25e734642dddd6fd0 Mon Sep 17 00:00:00 2001 From: jjfantini <63276164+jjfantini@users.noreply.github.com> Date: Sun, 24 Sep 2023 14:37:18 +0000 Subject: [PATCH] init: change setup --- .devcontainer/Dockerfile | 8 +- .devcontainer/devcontainer.json | 27 ++- .vscode/extensions.json | 11 ++ .vscode/settings.json | 11 +- pyproject.toml | 323 ++------------------------------ 5 files changed, 39 insertions(+), 341 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9ba2f5a..0719271 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,12 +1,10 @@ FROM mcr.microsoft.com/devcontainers/python:3 RUN python -m pip install --upgrade pip \ - && python -m pip install 'flit>=3.8.0' - -ENV FLIT_ROOT_INSTALL=1 + && python -m pip install poetry COPY pyproject.toml . RUN touch README.md \ && mkdir -p src/python_package \ - && python -m flit install --only-deps --deps develop \ - && rm -r pyproject.toml README.md src + && poetry install --no-root \ + && rm -r pyproject.toml README.md src \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6d8e6f8..f1da5ff 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,31 +14,28 @@ "ms-azuretools.vscode-docker", "ms-python.python", "ms-python.vscode-pylance", - "ms-python.pylint", - "ms-python.isort", - "ms-python.flake8", "ms-python.black-formatter", "ms-vsliveshare.vsliveshare", "ryanluker.vscode-coverage-gutters", "bungcip.better-toml", - "GitHub.copilot" + "GitHub.copilot", + "charliermarsh.ruff", + "modular-mojotools.vscode-mojo", + "VisualStudioExptTeam.vscodeintellicode", + "VisualStudioExptTeam.intellicode-api-usage-examples", + "ms-vscode-remote.remote-wsl" ], "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python", "black-formatter.path": [ "/usr/local/py-utils/bin/black" - ], - "pylint.path": [ - "/usr/local/py-utils/bin/pylint" - ], - "flake8.path": [ - "/usr/local/py-utils/bin/flake8" - ], - "isort.path": [ - "/usr/local/py-utils/bin/isort" ] } } }, - "onCreateCommand": "pre-commit install-hooks" -} + "features": { + "ghcr.io/devcontainers/features/sshd:1": { + "version": "latest" + } + } +} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..516beb2 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "modular-mojotools.vscode-mojo", + "ms-vscode-remote.remote-wsl" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 5d1a32a..e91923b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,16 +14,7 @@ "python.formatting.provider": "black", "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, - "pylint.args": [ - "--rcfile=pyproject.toml" - ], "black-formatter.args": [ "--config=pyproject.toml" - ], - "flake8.args": [ - "--toml-config=pyproject.toml" - ], - "isort.args": [ - "--settings-path=pyproject.toml" ] -} +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index a8a76c7..8fbbed5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,315 +1,16 @@ -[build-system] -requires = ["flit"] -build-backend = "flit.buildapi" - -[project] -name = "py-project-toml" -authors = [ - {name = "Daniel Ciborowski", email = "dciborow@microsoft.com"}, -] -description = "Sample Python Project for creating a new Python Module" -readme = "README.md" -classifiers = [ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11" -] -requires-python = ">=3.8.1" -dynamic = ["version"] - -[project.optional-dependencies] -spark = [ - "pyspark>=3.0.0" -] -test = [ - "bandit[toml]==1.7.5", - "black==23.3.0", - "check-manifest==0.49", - "flake8-bugbear==23.5.9", - "flake8-docstrings", - "flake8-formatter_junit_xml", - "flake8", - "flake8-pyproject", - "pre-commit==3.3.1", - "pylint==2.17.4", - "pylint_junit", - "pytest-cov==4.0.0", - "pytest-mock<3.10.1", - "pytest-runner", - "pytest==7.3.1", - "pytest-github-actions-annotate-failures", - "shellcheck-py==0.9.0.2" -] - -[project.urls] -Documentation = "https://github.com/microsoft/python-package-template/tree/main#readme" -Source = "https://github.com/microsoft/python-package-template" -Tracker = "https://github.com/microsoft/python-package-template/issues" - -[tool.flit.module] -name = "python_package" - -[tool.bandit] -exclude_dirs = ["build","dist","tests","scripts"] -number = 4 -recursive = true -targets = "src" - -[tool.black] -line-length = 120 -fast = true - -[tool.coverage.run] -branch = true - -[tool.coverage.report] -fail_under = 100 - -[tool.flake8] -max-line-length = 120 -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.pytest.ini_options] -addopts = "--cov-report xml:coverage.xml --cov src --cov-fail-under 0 --cov-append -m 'not integration'" -pythonpath = [ - "src" -] -testpaths = "tests" -junit_family = "xunit2" -markers = [ - "integration: marks as integration test", - "notebooks: marks as notebook test", - "gpu: marks as gpu test", - "spark: marks tests which need Spark", - "slow: marks tests as slow", - "unit: fast offline tests", -] - -[tool.tox] -legacy_tox_ini = """ -[tox] -envlist = py, integration, spark, all - -[testenv] -commands = - pytest -m "not integration and not spark" {posargs} +[tool.poetry] +name = "pypkg-template" +version = "0.1.0" +description = "A Python Package Template" +authors = ["Your Name "] -[testenv:integration] -commands = - pytest -m "integration" {posargs} +[tool.poetry.dependencies] +python = "^3.10" +open-interpreter = "^0.1.4" -[testenv:spark] -extras = spark -setenv = - PYSPARK_DRIVER_PYTHON = {envpython} - PYSPARK_PYTHON = {envpython} -commands = - pytest -m "spark" {posargs} +[tool.poetry.dev-dependencies] -[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=120 -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" +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" -[tool.pylint.'EXCEPTIONS'] -overgeneral-exceptions= [ - "BaseException", - "Exception" -]