diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..696b5d7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f339603..8c8214b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,10 @@ jobs: python-version: "3.x" - name: Build package - run: pipx run build + run: | + python -m pip install --upgrade pip + pip install build + python -m build - name: Publish to Test PyPi if: ${{ startsWith(github.ref, 'refs/tags') }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ab00c05..28295ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,52 +31,6 @@ jobs: run: | .travis/prep_cron.sh - conda: - needs: - - resources - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python: ["3.7", "3.8", "3.9", "3.10"] - - defaults: - run: - shell: "bash -l {0}" - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Load resources - uses: actions/cache@v3 - with: - path: ./fortran_tests/before/*/ - key: resources-${{ github.event_name }} - - - name: Install dependencies - uses: mamba-org/provision-with-micromamba@main - with: - environment-file: environment.yml - extra-specs: | - python=${{ matrix.python }} - coveralls - - - name: Install project - run: pip install . - - - name: Run tests - run: | - coverage run --source=fprettify setup.py test - - - name: Coverage upload - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: ${{ matrix.python }} - COVERALLS_PARALLEL: true - pip: needs: - resources @@ -85,7 +39,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python: ["3.5", "3.6"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"] steps: - name: Checkout code @@ -101,11 +55,8 @@ jobs: with: python-version: ${{ matrix.python }} - - name: Install dependencies - run: pip install -r requirements.txt coveralls - - - name: Install project - run: pip install . + - name: Install project & dependencies + run: pip install .[dev] - name: Run tests run: | @@ -121,13 +72,12 @@ jobs: coverage: needs: - pip - - conda runs-on: ubuntu-latest steps: - uses: actions/setup-python@v3 with: - python-version: '3.x' + python-version: "3.x" - name: Install dependencies run: pip install coveralls diff --git a/.gitignore b/.gitignore index 817ff4b..672366a 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,9 @@ ENV/ # ctags tags + +# setuptools_scm autogeneated version +_version.py + +# fortran temporary test files +fortran_tests/ diff --git a/README.md b/README.md index 767024c..24ee740 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ pip install --upgrade fprettify Installation from source requires Python Setuptools: ```sh -./setup.py install +pip install . ``` For local installation, use `--user` option. diff --git a/environment.yml b/environment.yml index dc83729..2d543c8 100644 --- a/environment.yml +++ b/environment.yml @@ -3,3 +3,4 @@ channels: - conda-forge dependencies: - configargparse + - importlib-metadata diff --git a/fprettify/version.py b/fprettify/version.py new file mode 100644 index 0000000..53f9075 --- /dev/null +++ b/fprettify/version.py @@ -0,0 +1,10 @@ +try: + from importlib.metadata import PackageNotFoundError, version +except ModuleNotFoundError: + from importlib_metadata import PackageNotFoundError, version +try: + __version__ = version(__package__) +except PackageNotFoundError: + from setuptools_scm import get_version + + __version__ = get_version(root="..", relative_to=__file__) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..edd2ad0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = [ + "setuptools >= 45", + "wheel", + "setuptools_scm[toml] >= 6.2", + "setuptools_scm_git_archive", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "fprettify/_version.py" + +[tool.isort] +profile = "black" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..ba5454c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,49 @@ +[metadata] +name = fprettify +url = https://github.com/pseewald/fprettify +author = Patrick Seewald +author_email = patrick.seewald@gmail.com +description = auto-formatter for modern fortran source code +long_description = file: README.md +long_description_content_type = text/markdown +license = GPLv3 +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Topic :: Software Development :: Quality Assurance + License :: OSI Approved :: GNU General Public License v3 (GPLv3) + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Environment :: Console + Operating System :: OS Independent +keywords = + fortran + formatter +project_urls = + Tracker = https://github.com/pseewald/fprettify/issues + Source Code = https://github.com/pseewald/fprettify + +[options] +packages = find: +python_requires = >= 3.6 +install_requires = + configargparse + importlib-metadata; python_version < "3.8" + +[options.entry_points] +console_scripts = + fprettify = fprettify.__init__:run + +[options.extras_require] +dev = + black + isort + pre-commit + coveralls + +[flake8] +max-line-length = 88 +extend-ignore = E203, E722 diff --git a/setup.py b/setup.py index f0b2cdd..c823345 100755 --- a/setup.py +++ b/setup.py @@ -1,41 +1,4 @@ #!/usr/bin/env python from setuptools import setup -from codecs import open -from os import path -here = path.abspath(path.dirname(__file__)) -with open(path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = f.read() - -setup(name='fprettify', - version='0.3.7', - description='auto-formatter for modern fortran source code', - long_description=long_description, - long_description_content_type="text/markdown", - author='Patrick Seewald', - author_email='patrick.seewald@gmail.com', - license='GPLv3', - entry_points={'console_scripts': ['fprettify = fprettify:run']}, - packages=['fprettify'], - install_requires=[ - 'configargparse', - ], - test_suite='fprettify.tests', - keywords='fortran format formatting auto-formatter indent', - url='https://github.com/pseewald/fprettify', - download_url='https://github.com/pseewald/fprettify/archive/v0.3.7.tar.gz', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Quality Assurance', - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Environment :: Console', - 'Operating System :: OS Independent', - ] - ) +setup()