Skip to content

Commit

Permalink
Update supported Python versions (#92)
Browse files Browse the repository at this point in the history
* Update supported Python versions

- Remove Python 3.7 from the test matrix and list of supported versions
  in `setup.py`, as it reached end of life on 2023-06-27
- Add Python 3.12 to the list of tested / supported versions as the
  current major version

* Modernize usage of deprecated / removed features

- Replace usage of `python setup.py test` and the `PyTest` test command
  with a more direct invocation of `pytest` in `tox.ini`
- Replace usage of `pkg_resources.get_distribution` with
  `importlib.metadata` to get the installed version number for
  `vladiate`
  • Loading branch information
jonafato committed Mar 13, 2024
1 parent d831d62 commit 48f92e1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ jobs:
strategy:
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
24 changes: 1 addition & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,10 @@

import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

__version__ = "0.0.26"


class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]

def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ["-x", "tests"]

def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest

errno = pytest.main(self.pytest_args)
sys.exit(errno)


def readme():
with open("README.rst") as f:
return f.read()
Expand All @@ -44,11 +23,11 @@ def readme():
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
"Intended Audience :: Developers",
],
keywords="validate CSV vampires",
Expand All @@ -63,7 +42,6 @@ def readme():
install_requires=[],
extras_require={"s3": ["boto"]},
tests_require=["pretend", "pytest", 'black;python_version>="3.6"'],
cmdclass={"test": PyTest},
entry_points={
"console_scripts": [
"vladiate = vladiate.main:main",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_parse_args():
assert options.processes == 1
assert options.show_version is False
assert options.vladfile == "vladfile"
assert options.vlads == ["test"]
assert options.vlads == ["tests"]


@pytest.mark.parametrize(
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ deps =
black

[testenv]
commands = coverage run --append --source=vladiate setup.py test
commands = coverage run --append --source=vladiate -m pytest tests
deps =
pretend
pytest
coverage

Expand Down
4 changes: 2 additions & 2 deletions vladiate/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from importlib.metadata import version
from multiprocessing import Pool, Queue
from vladiate import Vlad
from vladiate import logs
Expand All @@ -7,7 +8,6 @@
import sys
import inspect
from argparse import ArgumentParser
from pkg_resources import get_distribution


def parse_args():
Expand Down Expand Up @@ -187,7 +187,7 @@ def main():
logger = logs.logger

if arguments.show_version:
print("Vladiate %s" % (get_distribution("vladiate").version,))
print("Vladiate %s" % (version("vladiate"),))
return exits.OK

vladfile = find_vladfile(arguments.vladfile)
Expand Down

0 comments on commit 48f92e1

Please sign in to comment.