diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1683a0d..127d2d0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,7 +66,7 @@ jobs: pip install black - name: Run black run: | - black --check --diff src/ tests/ setup.py + black --check --diff . isort: name: "ISort" @@ -83,7 +83,7 @@ jobs: pip install isort - name: Run isort run: | - isort --check-only --diff src/ tests/ setup.py + isort --check-only --diff . ssort: name: "SSort" @@ -100,7 +100,7 @@ jobs: pip install -e . - name: Run ssort run: | - ssort --check --diff src/ tests/ setup.py + ssort --check --diff src/ tests/ pyflakes: name: "PyFlakes" @@ -117,7 +117,7 @@ jobs: pip install pyflakes - name: Run pyflakes run: | - pyflakes src/ tests/ setup.py + pyflakes src/ tests/ pylint: name: "PyLint" @@ -136,7 +136,7 @@ jobs: pip install pylint - name: Run pylint run: | - pylint -E src/ tests/ setup.py + pylint -E src/ tests/ mypy: name: "Mypy" @@ -155,4 +155,4 @@ jobs: pip install types-setuptools - name: Run mypy run: | - mypy src/ssort tests setup.py + mypy . diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f7d41a8..6a2bbf4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,14 +11,17 @@ jobs: runs-on: ubuntu-22.04 if: success() && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 with: python-version: 3.7 - - name: Build source distribution + - name: Install dependencies run: | - python setup.py sdist + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build --sdist - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@master with: diff --git a/README.rst b/README.rst index cf1d4b2..db563fc 100644 --- a/README.rst +++ b/README.rst @@ -104,7 +104,7 @@ We recommend that you reformat using `isort `_ a .. code:: bash - $ ssort src/ tests/ setup.py; isort src/ tests/ setup.py; black src/ tests/ setup.py + $ ssort src/ tests/; isort src/ tests/; black src/ tests/ You can also setup ssort to run automatically before commit by setting up `pre-commit `_, and registering ssort in your `.pre-commit-config.yaml`. diff --git a/pyproject.toml b/pyproject.toml index 65de09a..5ab348e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,77 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=61.2" +] + +[project] +authors = [ + {email = "bwhmather@bwhmather.com", name = "Ben Mather"} +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Quality Assurance" +] +dependencies = [ + "pathspec >=0.9.0" +] +description = "The python statement sorter" +dynamic = [ + "version" +] +maintainers = [ + {email = "bwhmather@bwhmather.com", name = "Ben Mather"} +] +name = "ssort" +readme = "README.rst" +requires-python = ">=3.8" + +[project.license] +text = "MIT" + +[project.scripts] +ssort = "ssort._main:main" + +[project.urls] +Homepage = "https://github.com/bwhmather/ssort" + [tool.black] +force-exclude = 'test_data/samples/*' line_length = 79 +[tool.distutils.bdist_wheel] +universal = 1 + [tool.isort] -profile = "black" -multi_line_output = 3 +extend_skip = ["test_data/samples"] line_length = 79 +multi_line_output = 3 +profile = "black" + +[tool.mypy] +exclude = "test_data/samples/*" [[tool.mypy.overrides]] -module = "pathspec" ignore_missing_imports = true +module = "pathspec" + +[tool.setuptools] +include-package-data = false +license-files = [ + "LICENSE" +] + +[tool.setuptools.dynamic.version] +attr = "ssort.__version__" + +[tool.setuptools.packages.find] +where = ["src"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1fa6964..0000000 --- a/setup.cfg +++ /dev/null @@ -1,43 +0,0 @@ -[bdist_wheel] -universal = 1 - -[metadata] -name = ssort -version = attr: ssort.__version__ -license = MIT -license_file = LICENSE -description = The python statement sorter -long_description = file: README.rst -author = Ben Mather -author_email = bwhmather@bwhmather.com -maintainer = Ben Mather -maintainer_email = bwhmather@bwhmather.com -url = https://github.com/bwhmather/ssort -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Software Development :: Quality Assurance - -[options] -package_dir= - =src -packages = find: - -install_requires = - pathspec >=0.9.0 -python_requires = >=3.8 - -[options.packages.find] -where = src - -[options.entry_points] -console_scripts = - ssort = ssort._main:main diff --git a/setup.py b/setup.py deleted file mode 100644 index 435df65..0000000 --- a/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -import os -import sys - -import setuptools - -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src")) # noqa - -setuptools.setup() diff --git a/tox.ini b/tox.ini index b90444e..5c52c21 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] envlist = py38,py39,py310,black,isort,ssort,pyflakes,pylint,mypy +isolated_build = true [testenv] deps = @@ -12,25 +13,25 @@ deps = black skip_install = True commands = - black --check src/ssort tests setup.py + black --check . [testenv:isort] deps = isort skip_install = True commands = - isort --check-only src/ssort tests setup.py + isort --check-only . [testenv:ssort] commands = - ssort --check --diff src/ssort tests setup.py + ssort --check --diff src/ssort tests [testenv:pyflakes] deps = pyflakes skip_install = True commands = - pyflakes src/ssort tests setup.py + pyflakes src/ssort tests [testenv:pylint] deps = @@ -39,7 +40,7 @@ deps = extras= test commands = - pylint -E src/ssort tests setup.py + pylint -E src/ssort tests [testenv:mypy] deps = @@ -48,4 +49,4 @@ deps = types-setuptools skip_install = True commands = - mypy src/ssort tests setup.py + mypy .