diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bc620d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + push: + branches: [develop, main, master] + pull_request: + branches: [develop, main, master] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install "pokrok @ git+https://github.com/jdidion/pokrok.git@maintenance/modernize-packaging" + pip install -e ".[test]" + - name: Run tests + run: | + pytest -m "not perf" -vv --cov --cov-report term-missing tests diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9ea0f97 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[build-system] +requires = ["setuptools>=64", "setuptools-scm>=8"] +build-backend = "setuptools.build_meta" + +[project] +name = "xphyle" +dynamic = ["version"] +description = "Utilities for working with files." +readme = {file = "README.md", content-type = "text/markdown"} +license = {text = "MIT"} +requires-python = ">=3.10" +authors = [ + {name = "John Didion", email = "github@didion.net"}, +] +dependencies = [ + "pokrok", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: MIT License", + "License :: Public Domain", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +[project.optional-dependencies] +performance = ["lorem"] +zstd = ["zstandard"] +test = ["pytest", "pytest-cov"] + +[project.urls] +Homepage = "https://github.com/jdidion/xphyle" + +[tool.setuptools] +packages = ["xphyle"] + +[tool.setuptools_scm] + +[tool.pytest.ini_options] +markers = [ + "perf: marks performance tests", +] + +[tool.coverage.run] +omit = [ + "tests/*", + "setup.py", + "*site-packages/*", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "pragma: no-cover", + "def __repr__", + "raise NotImplementedError", + "if __name__ == .__main__.:", +] + +[tool.ruff] +target-version = "py310" + +[tool.ruff.lint] +select = ["E", "F", "W"] diff --git a/xphyle/__init__.py b/xphyle/__init__.py index abe07a0..24f1062 100644 --- a/xphyle/__init__.py +++ b/xphyle/__init__.py @@ -31,7 +31,7 @@ cast, ) -import pkg_resources +from importlib.metadata import version, PackageNotFoundError from xphyle.formats import FORMATS, THREADS, CompressionFormat from xphyle.paths import ( @@ -65,8 +65,8 @@ try: - __version__ = pkg_resources.get_distribution(__name__).version -except pkg_resources.DistributionNotFound: + __version__ = version(__name__) +except PackageNotFoundError: __version__ = "Unknown"