diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index cecb92b..811e16c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -28,6 +28,6 @@ jobs: pip install -U setuptools - name: Run tests run: | - python setup.py clean --all - python setup.py install - python -W all setup.py test + pip install .[dev] + pytest + python -m build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..22ab2c9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,41 @@ +[build-system] +requires = ["setuptools>=61.2", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +version = "3.0.6" +name = "personnummer" +description = "Validate Swedish personal identity numbers" +license = { file = "./LICENSE" } +authors = [ + { name = "Personnummer and Contributors", email = "hello@personnummer.dev" }, +] + +[project.urls] +homepage = "https://personnummer.dev" +repository = "https://github.com/personnummer/python" + +[project.entry-points."console_scripts"] +personnummer = "personnummer.main:main" + +[project.optional-dependencies] +dev = [ + "pytest", + "build", +] + +[options] +packages = ["personnummer"] + +[tool.setuptools] +include-package-data = false + +[tool.setuptools.packages.find] +exclude = ["tests*"] + +[tool.pytest.ini_options] +pythonpath = "src" +testpaths = [ + "tests", +] +addopts = "-ra -v" diff --git a/setup.py b/setup.py index 84be96a..1abbd06 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,4 @@ -from setuptools import setup +import setuptools -setup( - name='personnummer', - version='3.0.6', - description='Validate Swedish personal identity numbers', - url='http://github.com/personnummer/python', - author='Personnummer and Contributors', - author_email='hello@personnummer.dev', - license='MIT', - packages=['personnummer'], - test_suite='pytest', - tests_require=['pytest'], - entry_points={ - 'console_scripts': ['personnummer = personnummer.main:main'] - }, -) +if __name__ == "__main__": + setuptools.setup() diff --git a/personnummer/tests/__init__.py b/tests/__init__.py similarity index 100% rename from personnummer/tests/__init__.py rename to tests/__init__.py diff --git a/personnummer/tests/test_personnummer.py b/tests/test_personnummer.py similarity index 100% rename from personnummer/tests/test_personnummer.py rename to tests/test_personnummer.py