Skip to content

Commit 3027e31

Browse files
committed
build: swap to pyproject.toml and setup.cfg
Also enables the use of automatic incrementation of the version number with the use of setuptools_scm and the creation of dev versions for local installs e.g. fprettify-0.3.8.dev10+g369708e.d20220831
1 parent db18540 commit 3027e31

File tree

6 files changed

+78
-38
lines changed

6 files changed

+78
-38
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,6 @@ ENV/
9191

9292
# ctags
9393
tags
94+
95+
# setuptools_scm autogeneated version
96+
_version.py

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ channels:
33
- conda-forge
44
dependencies:
55
- configargparse
6+
- importlib-metadata # [py<38]

fprettify/version.py

Lines changed: 10 additions & 0 deletions
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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 49 additions & 0 deletions
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.5
17+
Programming Language :: Python :: 3.6
18+
Programming Language :: Python :: 3.7
19+
Programming Language :: Python :: 3.8
20+
Programming Language :: Python :: 3.9
21+
Environment :: Console
22+
Operating System :: OS Independent
23+
keywords =
24+
fortran
25+
formatter
26+
project_urls =
27+
Tracker = https://github.com/pseewald/fprettify/issues
28+
Source Code = https://github.com/pseewald/fprettify
29+
30+
[options]
31+
packages = find:
32+
python_requires = >= 3.5
33+
install_requires =
34+
configargparse
35+
importlib-metadata; python_version < "3.8"
36+
37+
[options.entry_points]
38+
console_scripts =
39+
fprettify = fprettify.__init__:run
40+
41+
[options.extras_require]
42+
dev =
43+
black
44+
isort
45+
pre-commit
46+
47+
[flake8]
48+
max-line-length = 88
49+
extend-ignore = E203, E722

setup.py

Lines changed: 1 addition & 38 deletions
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)