Skip to content

Commit

Permalink
Merge pull request fortran-lang#135 from pseewald/feat/pyproject.toml
Browse files Browse the repository at this point in the history
Swap into using pyproject.toml and setup.cfg
  • Loading branch information
gnikit authored Mar 28, 2023
2 parents d6d24a8 + 1f9cf07 commit bb9c191
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 94 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
58 changes: 4 additions & 54 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@ ENV/

# ctags
tags

# setuptools_scm autogeneated version
_version.py

# fortran temporary test files
fortran_tests/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ channels:
- conda-forge
dependencies:
- configargparse
- importlib-metadata
10 changes: 10 additions & 0 deletions fprettify/version.py
Original file line number Diff line number Diff line change
@@ -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__)
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
49 changes: 49 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[metadata]
name = fprettify
url = https://github.com/pseewald/fprettify
author = Patrick Seewald
author_email = [email protected]
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
39 changes: 1 addition & 38 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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='[email protected]',
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()

0 comments on commit bb9c191

Please sign in to comment.