Skip to content

Commit bb9c191

Browse files
authored
Merge pull request #135 from pseewald/feat/pyproject.toml
Swap into using pyproject.toml and setup.cfg
2 parents d6d24a8 + 1f9cf07 commit bb9c191

File tree

10 files changed

+101
-94
lines changed

10 files changed

+101
-94
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "pip"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/release.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ jobs:
1818
python-version: "3.x"
1919

2020
- name: Build package
21-
run: pipx run build
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build
24+
python -m build
2225
2326
- name: Publish to Test PyPi
2427
if: ${{ startsWith(github.ref, 'refs/tags') }}

.github/workflows/test.yml

+4-54
Original file line numberDiff line numberDiff line change
@@ -31,52 +31,6 @@ jobs:
3131
run: |
3232
.travis/prep_cron.sh
3333
34-
conda:
35-
needs:
36-
- resources
37-
runs-on: ${{ matrix.os }}
38-
strategy:
39-
fail-fast: false
40-
matrix:
41-
os: [ubuntu-latest]
42-
python: ["3.7", "3.8", "3.9", "3.10"]
43-
44-
defaults:
45-
run:
46-
shell: "bash -l {0}"
47-
48-
steps:
49-
- name: Checkout code
50-
uses: actions/checkout@v2
51-
52-
- name: Load resources
53-
uses: actions/cache@v3
54-
with:
55-
path: ./fortran_tests/before/*/
56-
key: resources-${{ github.event_name }}
57-
58-
- name: Install dependencies
59-
uses: mamba-org/provision-with-micromamba@main
60-
with:
61-
environment-file: environment.yml
62-
extra-specs: |
63-
python=${{ matrix.python }}
64-
coveralls
65-
66-
- name: Install project
67-
run: pip install .
68-
69-
- name: Run tests
70-
run: |
71-
coverage run --source=fprettify setup.py test
72-
73-
- name: Coverage upload
74-
run: coveralls --service=github
75-
env:
76-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
COVERALLS_FLAG_NAME: ${{ matrix.python }}
78-
COVERALLS_PARALLEL: true
79-
8034
pip:
8135
needs:
8236
- resources
@@ -85,7 +39,7 @@ jobs:
8539
fail-fast: false
8640
matrix:
8741
os: [ubuntu-latest]
88-
python: ["3.5", "3.6"]
42+
python: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
8943

9044
steps:
9145
- name: Checkout code
@@ -101,11 +55,8 @@ jobs:
10155
with:
10256
python-version: ${{ matrix.python }}
10357

104-
- name: Install dependencies
105-
run: pip install -r requirements.txt coveralls
106-
107-
- name: Install project
108-
run: pip install .
58+
- name: Install project & dependencies
59+
run: pip install .[dev]
10960

11061
- name: Run tests
11162
run: |
@@ -121,13 +72,12 @@ jobs:
12172
coverage:
12273
needs:
12374
- pip
124-
- conda
12575
runs-on: ubuntu-latest
12676

12777
steps:
12878
- uses: actions/setup-python@v3
12979
with:
130-
python-version: '3.x'
80+
python-version: "3.x"
13181

13282
- name: Install dependencies
13383
run: pip install coveralls

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ ENV/
9191

9292
# ctags
9393
tags
94+
95+
# setuptools_scm autogeneated version
96+
_version.py
97+
98+
# fortran temporary test files
99+
fortran_tests/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pip install --upgrade fprettify
8080
Installation from source requires Python Setuptools:
8181

8282
```sh
83-
./setup.py install
83+
pip install .
8484
```
8585

8686
For local installation, use `--user` option.

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ channels:
33
- conda-forge
44
dependencies:
55
- configargparse
6+
- importlib-metadata

fprettify/version.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
try:
2+
from importlib.metadata import PackageNotFoundError, version
3+
except ModuleNotFoundError:
4+
from importlib_metadata import PackageNotFoundError, version
5+
try:
6+
__version__ = version(__package__)
7+
except PackageNotFoundError:
8+
from setuptools_scm import get_version
9+
10+
__version__ = get_version(root="..", relative_to=__file__)

pyproject.toml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 45",
4+
"wheel",
5+
"setuptools_scm[toml] >= 6.2",
6+
"setuptools_scm_git_archive",
7+
]
8+
build-backend = "setuptools.build_meta"
9+
10+
[tool.setuptools_scm]
11+
write_to = "fprettify/_version.py"
12+
13+
[tool.isort]
14+
profile = "black"

setup.cfg

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[metadata]
2+
name = fprettify
3+
url = https://github.com/pseewald/fprettify
4+
author = Patrick Seewald
5+
author_email = [email protected]
6+
description = auto-formatter for modern fortran source code
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
license = GPLv3
10+
classifiers =
11+
Development Status :: 5 - Production/Stable
12+
Intended Audience :: Developers
13+
Topic :: Software Development :: Quality Assurance
14+
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
15+
Programming Language :: Python :: 3
16+
Programming Language :: Python :: 3.6
17+
Programming Language :: Python :: 3.7
18+
Programming Language :: Python :: 3.8
19+
Programming Language :: Python :: 3.9
20+
Environment :: Console
21+
Operating System :: OS Independent
22+
keywords =
23+
fortran
24+
formatter
25+
project_urls =
26+
Tracker = https://github.com/pseewald/fprettify/issues
27+
Source Code = https://github.com/pseewald/fprettify
28+
29+
[options]
30+
packages = find:
31+
python_requires = >= 3.6
32+
install_requires =
33+
configargparse
34+
importlib-metadata; python_version < "3.8"
35+
36+
[options.entry_points]
37+
console_scripts =
38+
fprettify = fprettify.__init__:run
39+
40+
[options.extras_require]
41+
dev =
42+
black
43+
isort
44+
pre-commit
45+
coveralls
46+
47+
[flake8]
48+
max-line-length = 88
49+
extend-ignore = E203, E722

setup.py

+1-38
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,4 @@
11
#!/usr/bin/env python
22
from setuptools import setup
3-
from codecs import open
4-
from os import path
53

6-
here = path.abspath(path.dirname(__file__))
7-
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
8-
long_description = f.read()
9-
10-
setup(name='fprettify',
11-
version='0.3.7',
12-
description='auto-formatter for modern fortran source code',
13-
long_description=long_description,
14-
long_description_content_type="text/markdown",
15-
author='Patrick Seewald',
16-
author_email='[email protected]',
17-
license='GPLv3',
18-
entry_points={'console_scripts': ['fprettify = fprettify:run']},
19-
packages=['fprettify'],
20-
install_requires=[
21-
'configargparse',
22-
],
23-
test_suite='fprettify.tests',
24-
keywords='fortran format formatting auto-formatter indent',
25-
url='https://github.com/pseewald/fprettify',
26-
download_url='https://github.com/pseewald/fprettify/archive/v0.3.7.tar.gz',
27-
classifiers=[
28-
'Development Status :: 5 - Production/Stable',
29-
'Intended Audience :: Developers',
30-
'Topic :: Software Development :: Quality Assurance',
31-
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
32-
'Programming Language :: Python :: 3',
33-
'Programming Language :: Python :: 3.5',
34-
'Programming Language :: Python :: 3.6',
35-
'Programming Language :: Python :: 3.7',
36-
'Programming Language :: Python :: 3.8',
37-
'Programming Language :: Python :: 3.9',
38-
'Environment :: Console',
39-
'Operating System :: OS Independent',
40-
]
41-
)
4+
setup()

0 commit comments

Comments
 (0)