From 6e74616048e50fcc7ba895ef2ca793a8ce66d377 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Sat, 11 May 2024 19:32:12 -0400 Subject: [PATCH] refactor: apply standard configs from TNR projects --- .devcontainer/Dockerfile | 14 ++ .devcontainer/devcontainer.json | 59 ++++++++ .docker/Dockerfile | 4 +- .docker/entrypoint.sh | 0 .github/dependabot.yml | 16 +++ .github/workflows/codeql.yml | 89 ++++++++++++ .github/workflows/docker.yml | 0 .github/workflows/python-tests.yml | 42 ++++++ .gitignore | 187 +++++++++++++++++++++++- .pre-commit-config.yaml | 100 ++++++++++--- .vscode/extensions.json | 16 +++ .vscode/settings.json | 17 +++ pyproject.toml | 205 +++++++++++++++++++++------ src/gvm_sync_targets/__about__.py | 4 - src/gvm_sync_targets/__init__.py | 13 ++ src/gvm_sync_targets/cli/__init__.py | 2 +- 16 files changed, 691 insertions(+), 77 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json mode change 100755 => 100644 .docker/Dockerfile mode change 100644 => 100755 .docker/entrypoint.sh create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql.yml mode change 100755 => 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/python-tests.yml create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json mode change 100755 => 100644 pyproject.toml delete mode 100644 src/gvm_sync_targets/__about__.py diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..16a2c04 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +FROM mcr.microsoft.com/devcontainers/python:3.9 + +RUN \ + pipx uninstall mypy \ + && pipx uninstall pylint \ + && pipx uninstall pytest \ + && pipx uninstall flake8 \ + && pipx uninstall black \ + && pipx install commitizen \ + && pip install -U hatch hatch-containers + +RUN su vscode -c "hatch config set dirs.env.virtual /home/vscode/.virtualenvs" + +ENV SHELL /bin/bash diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1357a63 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,59 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "dockerFile": "./Dockerfile", + "context": "..", + "features": { + "ghcr.io/devcontainers-contrib/features/zsh-plugins": { + "omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions" + }, + "ghcr.io/devcontainers/features/docker-in-docker": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "hatch run setup-dev", + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root", + "customizations": { + "vscode": { + "extensions": [ + "tamasfe.even-better-toml", + "ms-python.python", + "ms-python.vscode-pylance", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github", + "github.vscode-github-actions", + "redhat.vscode-yaml", + "ms-python.black-formatter", + "ms-python.isort", + "ms-azuretools.vscode-docker", + "ms-python.mypy-type-checker", + "sunipkm.autodocstringpy" + ], + "settings": { + "python.defaultInterpreterPath": "~/.virtualenvs/polymatch/bin/python", + "python.testing.pytestArgs": ["--no-cov"], + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/usr/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "zsh", + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + } + } + } + } +} diff --git a/.docker/Dockerfile b/.docker/Dockerfile old mode 100755 new mode 100644 index 2ac60fa..4d94065 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8 AS builder +FROM python:3.9 AS builder RUN apt-get update && \ apt-get install --no-install-recommends --no-install-suggests -y \ @@ -13,7 +13,7 @@ WORKDIR /source RUN rm -rf dist && /root/.local/bin/hatch build -t wheel -FROM python:3.8-slim +FROM python:3.9-slim WORKDIR /gvm-sync-targets diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh old mode 100644 new mode 100755 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0e1f9f5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "devcontainers" + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..fab0bbf --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,89 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '18 15 * * 3' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: python + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..0335303 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,42 @@ +name: Python tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: + - '3.9' + - '3.10' + - '3.11' + - '3.12' + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "${{matrix.python-version}}" + cache: "pip" + + - name: Install Hatch + run: pip install --user --upgrade hatch + + - name: Test with pytest + run: hatch run cov + env: + PYTHONDEVMODE: 1 + + - uses: codecov/codecov-action@v4 + with: + name: "build-${{ matrix.python-version }}" + fail_ci_if_error: true + env: + CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} diff --git a/.gitignore b/.gitignore index 26f82bc..569f3ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,186 @@ -*.py[oc] -.cache/ -.mypy_cache/ +# Created by .ignore support plugin (hsz.mobi) +### VirtualEnv template +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +.venv +pip-selfcheck.json +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* +### Python template +# Byte-compiled / optimized / DLL files __pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +env/ +build/ +develop-eggs/ dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### Vim template +# swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-v][a-z] +[._]sw[a-p] +# session +Session.vim +# temporary +.netrwhist +# auto-generated tag files +tags + +*/_version.py +src/*/_version.py + +.mypy_cache/ +.pytest_cache/ +.ruff_cache/ +coverage.* +.coverage.* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f06152f..47ad795 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,89 @@ repos: -- repo: https://github.com/commitizen-tools/commitizen - rev: faff6a61f4f53585a965addd06156eedf0027643 - hooks: - - id: commitizen -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c - hooks: +- hooks: + - args: + - --markdown-linebreak-ext=md,markdown + id: trailing-whitespace - id: end-of-file-fixer - - id: trailing-whitespace -- repo: https://github.com/psf/black - rev: 3702ba224ecffbcec30af640c149f231d90aebdb + - id: check-yaml + - id: check-added-large-files + - id: check-ast + - id: fix-byte-order-marker + - id: check-merge-conflict + - id: debug-statements + - id: detect-private-key + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - args: + - --fix=lf + id: mixed-line-ending + - exclude: ^\.(vscode|devcontainer)/ + id: check-json + - args: + - --indent + - '4' + - --autofix + - --no-sort-keys + exclude: ^\.(vscode|devcontainer)/ + id: pretty-format-json + - id: check-toml + repo: https://github.com/pre-commit/pre-commit-hooks + rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c +- repo: https://github.com/bwhmather/ssort + rev: dcb59fdb9b46ed1bb8e6ca2107e35f76cdc9c97e # frozen: 0.12.4 hooks: + - id: ssort +- hooks: - id: black -- repo: https://github.com/pycqa/isort - rev: c235f5e450b4b84e58d114ed4c589cbf454175a3 - hooks: + repo: https://github.com/psf/black + rev: 8fe627072f15ff2e3d380887b92f7868efaf6d05 +- hooks: - id: isort -- repo: https://github.com/andreoliwa/nitpick - rev: 36d4912df1f0bd2ed8cc535b57c5ba3b09ce3d46 - hooks: - - id: nitpick -- repo: https://github.com/ikamensh/flynt - rev: 651c822fdcf45fffcf9743dc755085f32acb65e3 - hooks: + repo: https://github.com/pycqa/isort + rev: c235f5e450b4b84e58d114ed4c589cbf454175a3 +- hooks: + - id: python-no-eval + - id: python-no-log-warn + repo: https://github.com/pre-commit/pygrep-hooks + rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 +- hooks: - id: flynt + repo: https://github.com/ikamensh/flynt + rev: 651c822fdcf45fffcf9743dc755085f32acb65e3 +- hooks: + - args: + - --py39-plus + id: pyupgrade + repo: https://github.com/asottile/pyupgrade + rev: 12af25eb252deaaecb6b259df40d01f42e716dc3 +- hooks: + - additional_dependencies: + - tomli ; python_version < '3.11' + id: auto-walrus + repo: https://github.com/MarcoGorelli/auto-walrus + rev: 7855759486496a3248e9ff37dce7c6d57d39bfce +- hooks: + - additional_dependencies: + - tomli ; python_version < '3.11' + id: codespell + repo: https://github.com/codespell-project/codespell + rev: 6e41aba91fb32e9feb741a6258eefeb9c6e4a482 +- hooks: + - id: commitizen + repo: https://github.com/commitizen-tools/commitizen + rev: 7c0bc1591103b1f089aab9810fc2a201ccb0552b +- hooks: + - entry: hatch run python3 -m mypy + exclude: tests/.* + id: mypy + language: system + name: mypy + types: + - python + repo: local minimum_pre_commit_version: 2.18.0 default_install_hook_types: - pre-commit diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..9af92b8 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,16 @@ +{ + "recommendations": [ + "tamasfe.even-better-toml", + "ms-python.python", + "ms-python.vscode-pylance", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github", + "github.vscode-github-actions", + "redhat.vscode-yaml", + "ms-python.black-formatter", + "ms-python.isort", + "ms-azuretools.vscode-docker", + "ms-python.mypy-type-checker", + "sunipkm.autodocstringpy" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..de9d932 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "python.testing.pytestArgs": [ + "." + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.analysis.enablePytestSupport": true, + "[python]": { + "diffEditor.ignoreTrimWhitespace": false, + "editor.formatOnType": true, + "editor.wordBasedSuggestions": "off", + "editor.defaultFormatter": "ms-python.black-formatter" + }, + "python.analysis.diagnosticMode": "workspace", + "autoDocstringPy.docstringFormat": "google-notypes", + "autoDocstringPy.startOnNewLine": true +} diff --git a/pyproject.toml b/pyproject.toml old mode 100755 new mode 100644 index 4b063a0..171a570 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] @@ -7,26 +7,24 @@ name = "gvm-sync-targets" dynamic = ["version"] description = '' readme = "README.md" -requires-python = ">=3.8" license = "MIT" +requires-python = ">=3.9" +authors = [{ name = "linuxdaemon", email = "linuxdaemon.irc@gmail.com" }] keywords = [] -authors = [ - { name = "linuxdaemon", email = "linuxdaemon.irc@gmail.com" }, -] classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", + "Development Status :: 3 - Alpha", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [ "click", - "python-gvm", + "python-gvm>=23.12.0", ] [project.urls] @@ -38,14 +36,153 @@ Source = "https://github.com/snoonetIRC/gvm-sync-targets" gvm-sync-targets = "gvm_sync_targets.cli:gvm_sync_targets" [tool.hatch.version] -path = "src/gvm_sync_targets/__about__.py" +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "src/gvm_sync_targets/_version.py" + +[tool.hatch.env] +requires = ["hatch-containers"] + +[tool.hatch.envs.default] +dependencies = [ + "coverage[toml]>=6.5", + "pytest>=6.0", + "pre-commit", + "mypy>=1.8", +] + +[tool.hatch.envs.default.scripts] +test = "pytest" +test-cov = ["coverage run -pm pytest"] +cov-report = [ + "- coverage combine", + "coverage xml", + "coverage report --show-missing", +] +cov = ["- coverage erase", "test-cov", "cov-report"] +cov-all = ["- coverage erase", "hatch run testall:test-cov", "cov-report"] + +setup-pre-commit = "python3 -m pre_commit install --install-hooks" +setup-dev = ["setup-pre-commit"] + +pre-commit = "python3 -m pre_commit run {args:--all}" + +[tool.hatch.envs.testall] +type = "container" +dependencies = ["coverage[toml]>=6.5", "pytest>=6.0"] + +[[tool.hatch.envs.testall.matrix]] +python = ["3.9", "3.10", "3.11", "3.12"] + +[tool.isort] +profile = "black" +line_length = 80 +include_trailing_comma = true +use_parentheses = true +float_to_top = true + +[tool.black] +line-length = 80 +target-version = ["py39"] +include = '\.pyi?$' + +[tool.ruff] +line-length = 80 +target-version = 'py39' + +[tool.ruff.format] +docstring-code-format = true +line-ending = "lf" +skip-magic-trailing-comma = true + +[tool.ruff.lint] +ignore-init-module-imports = false +extend-safe-fixes = [ + "EM101", + "EM102", + "EM103", + "FLY002", + "TCH001", + "TCH002", + "TRY400", + "SIM117", + "SIM108", + "ANN201", + "D415", + "D200", +] +ignore = [ + "TRY003", # TODO(aspen): Switch to custom exceptions + "ANN101", # Due to be deprecated in ruff + "ANN102", # Due to be deprecated in ruff + "COM812", # Conflicts with formatter + "ISC001", # Conflicts with formatter + "EXE002", # pre-commit does it better, works with SMB shares + "FA100", +] +select = ["ALL"] + +[tool.ruff.lint.per-file-ignores] +"tests/*.py" = [ + "PLR2004", # Allow "magic values" in tests -aspen + "S101", # Allow asserts in tests + "S301", # Allow pickle in tests + "SIM201", # We need to test weird comparison operators + "SIM202", # We need to test weird comparison operstors + "SIM300", # We need to test both forward and reverse comparisons + "FBT001", # Boolean parameters are fine for test cases +] + +[tool.ruff.lint.pycodestyle] +max-line-length = 100 + +[tool.ruff.lint.isort] +split-on-trailing-comma = false + +[tool.ruff.lint.pydocstyle] +convention = "google" -[tool.hatch.envs.types] -extra-dependencies = [ - "mypy>=1.0.0", +[tool.flynt] +aggressive = true +transform-joins = true +transform-concats = true + +[tool.mypy] +namespace_packages = true +python_version = "3.9" +warn_unused_configs = true +strict = true +strict_optional = true +check_untyped_defs = true +show_error_codes = true +warn_unused_ignores = true +no_implicit_reexport = true +warn_redundant_casts = true +strict_equality = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_untyped_decorators = true +extra_checks = true +warn_unreachable = true +warn_return_any = true +warn_no_return = true +incremental = false +enable_error_code = [ + "redundant-self", + "redundant-expr", + "possibly-undefined", + "truthy-bool", + "truthy-iterable", + "ignore-without-code", ] -[tool.hatch.envs.types.scripts] -check = "mypy --install-types --non-interactive {args:src/gvm_sync_targets tests}" + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "--doctest-modules" +testpaths = ["polymatch", "tests"] +filterwarnings = ["error"] [tool.coverage.run] source_pkgs = ["gvm_sync_targets", "tests"] @@ -66,32 +203,6 @@ exclude_lines = [ "if TYPE_CHECKING:", ] -[tool.nitpick] -style = [ - "gh://TotallyNotRobots/nitpick/app-style.toml",] - -[tool.isort] -line_length = 80 -profile = "black" -float_to_top = true - -[tool.black] -line-length = 80 -target-version = ["py38"] - -[tool.mypy] -ignore_missing_imports = true -show_error_codes = true -warn_unused_ignores = true -warn_redundant_casts = true -strict = true - -[tool.flynt] -transform-concats = true -transform-joins = true -line-length = 120 -aggressive = true - [tool.commitizen] name = "cz_conventional_commits" tag_format = "v$version" diff --git a/src/gvm_sync_targets/__about__.py b/src/gvm_sync_targets/__about__.py deleted file mode 100644 index 2ba3815..0000000 --- a/src/gvm_sync_targets/__about__.py +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-FileCopyrightText: 2024-present linuxdaemon -# -# SPDX-License-Identifier: MIT -__version__ = "0.0.1" diff --git a/src/gvm_sync_targets/__init__.py b/src/gvm_sync_targets/__init__.py index e99c26e..7270a90 100644 --- a/src/gvm_sync_targets/__init__.py +++ b/src/gvm_sync_targets/__init__.py @@ -1,3 +1,16 @@ # SPDX-FileCopyrightText: 2024-present linuxdaemon # # SPDX-License-Identifier: MIT +from gvm_sync_targets._version import ( + __version__, + __version_tuple__, + version, + version_tuple, +) + +__all__ = [ + "__version__", + "__version_tuple__", + "version", + "version_tuple", +] diff --git a/src/gvm_sync_targets/cli/__init__.py b/src/gvm_sync_targets/cli/__init__.py index 3d3ba4b..f313dd3 100644 --- a/src/gvm_sync_targets/cli/__init__.py +++ b/src/gvm_sync_targets/cli/__init__.py @@ -5,7 +5,7 @@ from gvm.connections import UnixSocketConnection from gvm.protocols.gmp import Gmp -from gvm_sync_targets.__about__ import __version__ +from gvm_sync_targets import __version__ @click.group(