Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unsupported Python versions #33

Merged
merged 4 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 16 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,41 @@ on:
- "master"
jobs:
tox:
name: "Test ${{ matrix.toxenv }}"
runs-on: "ubuntu-20.04"
name: "Test Python ${{ matrix.python-version }}"
runs-on: "ubuntu-22.04"
strategy:
matrix:
include:
- python-version: "3.6"
toxenv: "py36"
- python-version: "3.7"
toxenv: "py37"
- python-version: "3.8"
toxenv: "py38"
- python-version: "3.9"
toxenv: "py39"
python-version: [
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
]
steps:
- name: "Check out repository"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Get pip cache dir"
id: "pip-cache"
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: "Cache pip packages"
uses: "actions/cache@v3"
with:
path: "${{ steps.pip-cache.outputs.dir }}"
key: "${{ runner.os }}-pip-${{ hashFiles('**/base.txt', '**/local.txt', '**/production.txt') }}"
restore-keys: |
${{ runner.os }}-pip-
cache: "pip"
cache-dependency-path: |
requirements-dev.txt
- name: "Install tox"
run: |
python -m pip install --upgrade pip
pip install tox
pip install tox tox-gh-actions
- name: "Run tox"
env:
TOXENV: ${{ matrix.toxenv }}
run: |
tox -- --cov fixity --cov-config .coveragerc --cov-report xml:coverage.xml
- name: "Upload coverage report"
if: github.repository == 'artefactual/fixity'
uses: "codecov/codecov-action@v3"
with:
files: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: false
verbose: true
name: ${{ matrix.toxenv }}
flags: ${{ matrix.toxenv }}
lint:
name: "Lint"
runs-on: "ubuntu-22.04"
Expand All @@ -65,7 +51,7 @@ jobs:
- name: "Set up Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.8"
python-version: "3.12"
- name: "Install tox"
run: |
python -m pip install --upgrade pip
Expand Down
17 changes: 9 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py3-plus, --py36-plus]
args: [--py38-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
rev: v3.10.0
hooks:
- id: reorder-python-imports
args: [--py3-plus, --py36-plus]
args: [--py38-plus]
- repo: https://github.com/ambv/black
rev: 22.8.0
rev: "23.7.0"
hooks:
- id: black
args: [--safe, --quiet]
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: "6.1.0"
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-bugbear==23.9.16
- flake8-comprehensions==3.14.0
5 changes: 0 additions & 5 deletions debian/changelog

This file was deleted.

1 change: 0 additions & 1 deletion debian/compat

This file was deleted.

18 changes: 0 additions & 18 deletions debian/control

This file was deleted.

8 changes: 0 additions & 8 deletions debian/copyright

This file was deleted.

1 change: 0 additions & 1 deletion debian/dirs

This file was deleted.

1 change: 0 additions & 1 deletion debian/fixity.install

This file was deleted.

1 change: 0 additions & 1 deletion debian/fixity.links

This file was deleted.

14 changes: 0 additions & 14 deletions debian/fixity.postinst

This file was deleted.

7 changes: 0 additions & 7 deletions debian/rules

This file was deleted.

2 changes: 1 addition & 1 deletion fixity/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import backref
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker

Expand Down
9 changes: 1 addition & 8 deletions fixity/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
from uuid import UUID

try:
# Python2
STRING_TYPES = basestring
except NameError:
# Python3
STRING_TYPES = str


class InvalidUUID(Exception):
def __init__(self, uuid):
Expand All @@ -25,7 +18,7 @@ def check_valid_uuid(uuid):
This uses the UUID() class constructor from the uuid module,
which raises a ValueError if the passed string is not a valid UUID.
"""
if not isinstance(uuid, STRING_TYPES):
if not isinstance(uuid, str):
raise TypeError("UUID must be a string")

try:
Expand Down
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-r requirements.txt
pytest==7.4.3
pytest-cov==4.1.0
vcrpy==5.1.0
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-r requirements/production.txt
requests==2.31.0
SQLAlchemy==1.4.49
2 changes: 0 additions & 2 deletions requirements/base.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements/local.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/production.txt

This file was deleted.

9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="fixity",
version="0.5.0",
version="0.6.0",
packages=["fixity"],
url="https://github.com/artefactual/fixity",
author="Artefactual Systems",
Expand All @@ -11,10 +11,11 @@
classifiers=[
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"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",
],
python_requires=">=3.6",
python_requires=">=3.8",
)
4 changes: 2 additions & 2 deletions tests/test_storage_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_get_single_aip():
aip = storage_service.get_single_aip(
aip_uuid, STORAGE_SERVICE_URL, STORAGE_SERVICE_USER, STORAGE_SERVICE_KEY
)
assert type(aip) == dict
assert isinstance(aip, dict)
assert aip["uuid"] == aip_uuid


Expand Down Expand Up @@ -117,7 +117,7 @@ def test_get_all_aips():
)
assert len(aips) == 2
for aip in aips:
assert type(aip) == dict
assert isinstance(aip, dict)
assert aip["uuid"] in aip_uuids


Expand Down
29 changes: 24 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
[tox]
skipsdist = True
envlist = py{36,37,38,39},linting
envlist = py{38,39,310,311,312},linting

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
skip_install = True
deps = -rrequirements/local.txt
deps = -rrequirements-dev.txt
whitelist_externals = pytest
commands = pytest {posargs}

Expand All @@ -15,6 +23,17 @@ commands = pre-commit run --all-files --show-diff-on-failure

[flake8]
exclude = .tox, .git, __pycache__, .cache, build, dist, *.pyc, *.egg-info, .eggs
application-import-names = flake8
select = C, E, F, W, B, B950
ignore = E501, W503
# Error codes:
# - https://flake8.pycqa.org/en/latest/user/error-codes.html
# - https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
# - https://github.com/PyCQA/flake8-bugbear#list-of-warnings
#
# E203: whitespace before ‘,’, ‘;’, or ‘:’
# E402: module level import not at top of file
# E501: line too long
# W503: line break before binary operator
ignore =
E203,
E402,
E501,
W503