From a74a63d590261e98f18b5940f3ae99248fdcf041 Mon Sep 17 00:00:00 2001 From: karlicoss Date: Thu, 5 Oct 2023 00:43:35 +0100 Subject: [PATCH] general: sync project structure to pymplate --- .github/workflows/main.yml | 7 +++---- LICENSE | 21 +++++++++++++++++++++ pyproject.toml | 28 +++++++++++++++++----------- ruff.toml | 25 +++++++++++++++++++++++++ tox.ini | 23 +++++++++++++++-------- 5 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 LICENSE create mode 100644 ruff.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b10c7ed..fefd25c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,9 +22,10 @@ on: jobs: build: strategy: + fail-fast: false matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12.0-rc.3'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # vvv just an example of excluding stuff from matrix # exclude: [{platform: macos-latest, python-version: '3.6'}] @@ -33,9 +34,6 @@ jobs: steps: # ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation - run: echo "$HOME/.local/bin" >> $GITHUB_PATH - - if: ${{ matrix.platform == 'macos-latest' && matrix.python-version == '3.11' }} - # hmm somehow only seems necessary for 3.11 on osx?? - run: echo "$HOME/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH - uses: actions/setup-python@v4 with: @@ -44,6 +42,7 @@ jobs: - uses: actions/checkout@v3 with: submodules: recursive + fetch-depth: 0 # nicer to have all git history when debugging/for tests - uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c52ae84 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Dmitrii Gerasimov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pyproject.toml b/pyproject.toml index f40274c..3d20f72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,28 @@ +# see https://github.com/karlicoss/pymplate for up-to-date reference [project] dynamic = ["version"] # version is managed by setuptools_scm name = "kompress" -# -# this needs to be set if you're planning to upload to pypi -# url = "" -# author = "" -# author_email = "" -# description = "" +dependencies = [ +] -# Rest like -- classifiers, license, etc, I don't think it matters for pypi -# it's just unnecessary duplication +## these need to be set if you're planning to upload to pypi +description = "pathlib.Path adapters to transparently read data from compressed files and folders" +license = {file = "LICENSE"} +authors = [ + {name = "Dima Gerasimov (@karlicoss)", email = "karlicoss@gmail.com"}, +] +maintainers = [ + {name = "Dima Gerasimov (@karlicoss)", email = "karlicoss@gmail.com"}, +] + +[project.urls] +Homepage = "https://github.com/karlicoss/kompress" +## [project.optional-dependencies] testing = [ - "pytest", -] -linting = [ "pytest", + "ruff", "mypy", "lxml", # for mypy html coverage ] diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..0be93e0 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,25 @@ +ignore = [ +### too opinionated style checks + "E501", # too long lines + "E702", # Multiple statements on one line (semicolon) + "E731", # assigning lambda instead of using def + "E741", # Ambiguous variable name: `l` + "E742", # Ambiguous class name: `O + "E401", # Multiple imports on one line + "F403", # import *` used; unable to detect undefined names +### + +### + "E722", # Do not use bare `except` ## Sometimes it's useful for defensive imports and that sort of thing.. + "F811", # Redefinition of unused # this gets in the way of pytest fixtures (e.g. in cachew) + +## might be nice .. but later and I don't wanna make it strict + "E402", # Module level import not at top of file + +### maybe consider these soon +# sometimes it's useful to give a variable a name even if we don't use it as a documentation +# on the other hand, often is a sign of error + "F841", # Local variable `count` is assigned to but never used + "F401", # imported but unused +### +] diff --git a/tox.ini b/tox.ini index 5726a59..f71168c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,28 @@ [tox] -minversion = 3.7 +minversion = 3.21 # relies on the correct version of Python installed -envlist = tests,mypy +envlist = ruff,tests,mypy # https://github.com/tox-dev/tox/issues/20#issuecomment-247788333 # hack to prevent .tox from crapping to the project directory -toxworkdir={env:TOXWORKDIR_BASE:}{toxinidir}/.tox +toxworkdir = {env:TOXWORKDIR_BASE:}{toxinidir}/.tox [testenv] # TODO how to get package name from setuptools? package_name = "kompress" passenv = # useful for tests to know they are running under ci - CI - CI_* + CI + CI_* # respect user's cache dirs to prevent tox from crapping into project dir - MYPY_CACHE_DIR - PYTHONPYCACHEPREFIX + PYTHONPYCACHEPREFIX + MYPY_CACHE_DIR + RUFF_CACHE_DIR + + +[testenv:ruff] +commands = + {envpython} -m pip install --use-pep517 -e .[testing] + {envpython} -m ruff src/ # note: --use-pep517 here is necessary for tox --parallel flag to work properly @@ -31,7 +38,7 @@ commands = [testenv:mypy] commands = - {envpython} -m pip install --use-pep517 -e .[linting] + {envpython} -m pip install --use-pep517 -e .[testing] {envpython} -m mypy --install-types --non-interactive \ -p {[testenv]package_name} \ # txt report is a bit more convenient to view on CI