Skip to content

Commit

Permalink
Support 3.6-3.12, update Actions and deps
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch committed Dec 16, 2023
1 parent 4bddfc0 commit 4b2bcde
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 19 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,49 @@ on:
push:
branches:
- master
- main
- tmp-*
tags:
- v*
pull_request:

jobs:
simple_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7]
os: [macOS-latest, ubuntu-20.04, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run:
python -m pip install --upgrade pip
pip install -e .
pip install coverage
- name: Test
run:
make test

infer_license:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
Expand All @@ -32,6 +57,3 @@ jobs:
run: make test
- name: Lint
run: make lint
- name: Coverage
run: codecov --token ${{ secrets.CODECOV_TOKEN }} --branch ${{ github.ref }}
continue-on-error: true
Empty file.
6 changes: 3 additions & 3 deletions infer_license/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# 3.7+
# but this api is deprecated in 3.9
from importlib.resources import read_text as read_text_resource
except ImportError:
except ImportError: # pragma: no cover
# 3.6
from importlib_resources import ( # type: ignore[no-redef]
from importlib_resources import ( # type: ignore[no-redef,attr-defined,unused-ignore]
read_text as read_text_resource,
)

Expand Down Expand Up @@ -40,7 +40,7 @@ def trigrams(self) -> Set[str]:

def trigrams(text: str) -> Set[str]:
words = [w for w in text.split() if w not in ("/*", "*", "*/", "#")]
return {f"{words[i]}-{words[i+1]}-{words[i+2]}" for i in range(len(words) - 3)}
return {f"{words[i]}-{words[i + 1]}-{words[i + 2]}" for i in range(len(words) - 3)}


# See some discussion at https://github.com/pypa/warehouse/issues/2996 about
Expand Down
20 changes: 11 additions & 9 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
black==24.1a1
coverage==7.3.3
flake8==6.1.0
usort==1.0.7
ufmt==2.3.0
mypy==1.7.1
tox==4.11.4
twine==4.0.2
black==24.1a1 ; python_version >= '3.8'
coverage==7.3.3 ; python_version >= '3.8'
coverage==6.2 ; python_version < '3.8'
flake8==6.1.0 ; python_version >= '3.8'
usort==1.0.7 ; python_version >= '3.8'
ufmt==2.3.0 ; python_version >= '3.8'
mypy==1.7.1 ; python_version >= '3.8'
tox==4.11.4 ; python_version >= '3.8'
twine==4.0.2 ; python_version >= '3.8'
volatile==2.1.0
wheel==0.42.0
wheel==0.42.0 ; python_version >= '3.8'
wheel==0.37.1 ; python_version < '3.8'
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ author_email = tim@timhatch.com
[options]
packages = infer_license
setup_requires =
setuptools_scm
setuptools_scm < 7 ; python_version < '3.8'
setuptools_scm >= 8; python_version >= '3.8'
setuptools >= 38.3.0
python_requires = >=3.6
install_requires =
Expand Down

0 comments on commit 4b2bcde

Please sign in to comment.