diff --git a/.flake8 b/.flake8 index 043e7a0..c2399d7 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,7 @@ [flake8] -ignore = E,W503 # Let Black handle all the formatting. +ignore = + # Let Black handle all the formatting. + E,W503 exclude = tests/snapshots, .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..70b9b86 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,62 @@ +name: CI + +on: + push: + branches: + - master + tags: + - "v*.*.*" + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - name: Check out repository + 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 setuptools tox + + - name: Run tox + run: tox + + deploy: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build setuptools twine wheel + + - name: Build package + run: | + python -m build + + - name: Publish package to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + python -m twine upload dist/* diff --git a/.travis.yml b/.travis.yml index 3278434..8178672 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ jobs: - { python: "3.12", env: "TOXENV=py312" } - { python: "3.11", env: "TOXENV=py311" } - { python: "3.10", env: "TOXENV=py310" } - - { python: "3.9", env: "TOXENV=py39" } - stage: Release if: tag IS present diff --git a/fourmat/__init__.py b/fourmat/__init__.py index fc16b68..8f544f0 100644 --- a/fourmat/__init__.py +++ b/fourmat/__init__.py @@ -1,13 +1,14 @@ +from importlib.metadata import PackageNotFoundError, version from pathlib import Path import click -from pkg_resources import DistributionNotFound, get_distribution # ----------------------------------------------------------------------------- + try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: + __version__ = version(__name__) +except PackageNotFoundError: # package is not installed pass diff --git a/fourmat/assets/pyproject.toml b/fourmat/assets/pyproject.toml index 7e035cc..3ac094e 100644 --- a/fourmat/assets/pyproject.toml +++ b/fourmat/assets/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 79 -target-version = ['py36', 'py37', 'py38', 'py39', 'py310'] +target-version = ['py310', 'py311', 'py312'] [tool.isort] profile = "black" diff --git a/fourmat/lint.py b/fourmat/lint.py index ceaaf25..d385ccb 100644 --- a/fourmat/lint.py +++ b/fourmat/lint.py @@ -16,6 +16,7 @@ CONFIGURATION_FILES = (".flake8", "pyproject.toml") + # ----------------------------------------------------------------------------- class PathContext: def __init__(self, path): diff --git a/pyproject.toml b/pyproject.toml index e3b5e4b..3ac094e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 79 -target-version = ['py39', 'py310', 'py311', 'py312'] +target-version = ['py310', 'py311', 'py312'] [tool.isort] profile = "black" diff --git a/setup.py b/setup.py index c89f222..6e5a417 100644 --- a/setup.py +++ b/setup.py @@ -2,19 +2,18 @@ setup( name="fourmat", - version="1.0.0", + version="2.0.0", description="A library for batteries-included linting and autoformatting", url="https://github.com/4Catalyzer/fourmat", author="Giacomo Tagliabue", author_email="giacomo@gmail.com", license="MIT", - python_requires=">=3.9", + python_requires=">=3.10", classifiers=[ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -22,13 +21,14 @@ ], keywords="lint autoformat black flake8 isort", packages=find_packages(), - package_data={"fourmat": ("assets/*.*", "assets/.*")}, + package_data={"fourmat": ["assets/*.*", "assets/.*"]}, install_requires=( "click>=8", - "black==24.3.0", + "black==25.1.0", "flake8-bugbear>=24,<25", "flake8>=7,<8", - "isort>=5,<6", + "isort>=6,<7", + "setuptools>=80", ), entry_points={"console_scripts": ("fourmat = fourmat:cli",)}, ) diff --git a/tox.ini b/tox.ini index cf49258..224df19 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{36,37,38,39,310} +envlist = py{310,311,312} [testenv] usedevelop = True