Skip to content

Commit 8462423

Browse files
committed
Moved the metadata into setup.cfg
Added `pyproject.toml` Version is now populated automatically from git using `setuptools_scm`.
1 parent 767131c commit 8462423

6 files changed

Lines changed: 56 additions & 79 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/icecream/__version__.py
12
*~
23
.#*
34
\#*

icecream/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
from os.path import dirname, join as pjoin
1414

1515
from .icecream import * # noqa
16+
from .__version__ import __version__
1617
from .builtins import install, uninstall
1718

18-
# Import all variables in __version__.py without explicit imports.
19-
meta = {}
20-
with open(pjoin(dirname(__file__), '__version__.py')) as f:
21-
exec(f.read(), meta)
22-
globals().update(dict((k, v) for k, v in meta.items() if k not in globals()))
19+
meta = {"__version__": __version__}

icecream/__version__.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
write_to = "icecream/__version__.py"
7+
write_to_template = "__version__ = '{version}'\n"

setup.cfg

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
1-
[bdist_wheel]
2-
universal = 1
3-
41
[metadata]
52
license_file = LICENSE.txt
3+
name = icecream
4+
version = 2.1.2
5+
author = Ansgar Grunseid
6+
author_email = [email protected]
7+
license = MIT
8+
description = Never use print() to debug again; inspect variables, expressions, and program execution with a single, simple function call.
9+
url = https://github.com/gruns/icecream
10+
long_description = Information and documentation can be found at https://github.com/gruns/icecream.
11+
classifiers =
12+
License :: OSI Approved :: MIT License
13+
Natural Language :: English
14+
Intended Audience :: Developers
15+
Topic :: Software Development :: Libraries
16+
Development Status :: 4 - Beta
17+
Programming Language :: Python
18+
Programming Language :: Python :: 2
19+
Programming Language :: Python :: 2.7
20+
Programming Language :: Python :: 3
21+
Programming Language :: Python :: 3.5
22+
Programming Language :: Python :: 3.6
23+
Programming Language :: Python :: 3.7
24+
Programming Language :: Python :: 3.8
25+
Programming Language :: Python :: 3.9
26+
Programming Language :: Python :: Implementation :: PyPy
27+
Programming Language :: Python :: Implementation :: CPython
28+
platforms = any
29+
30+
[options]
31+
packages = find:
32+
install_requires =
33+
colorama>=0.3.9
34+
pygments>=2.2.0
35+
executing>=0.3.1
36+
asttokens>=2.0.1
37+
include_package_data = True
38+
39+
[bdist_wheel]
40+
universal = 1

setup.py

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
import os
1515
import sys
1616
from os.path import dirname, join as pjoin
17-
from setuptools import setup, find_packages, Command
17+
from glob import glob
18+
from setuptools import Command, setup
1819
from setuptools.command.test import test as TestCommand
1920

20-
21-
meta = {}
22-
with open(pjoin('icecream', '__version__.py')) as f:
23-
exec(f.read(), meta)
24-
21+
this_dir = dirname(__file__)
2522

2623
class Publish(Command):
2724
"""Publish to PyPI with twine."""
@@ -34,11 +31,10 @@ def finalize_options(self):
3431
pass
3532

3633
def run(self):
37-
os.system('python setup.py sdist bdist_wheel')
38-
39-
sdist = 'dist/icecream-%s.tar.gz' % meta['__version__']
40-
wheel = 'dist/icecream-%s-py2.py3-none-any.whl' % meta['__version__']
41-
rc = os.system('twine upload "%s" "%s"' % (sdist, wheel))
34+
dist_dir = pjoin(this_dir, "dist")
35+
os.system(sys.executable + " -m build -nwxs " + this_dir)
36+
files = glob(pjoin(dist_dir, "*.whl")) + glob(pjoin(dist_dir, "*.tar.gz"))
37+
rc = os.system(sys.executable + " -m twine upload " + " ".join(files))
4238

4339
sys.exit(rc)
4440

@@ -59,51 +55,13 @@ class RunTests(TestCommand):
5955
"""
6056
def run_tests(self):
6157
from unittest import TestLoader, TextTestRunner
62-
tests_dir = pjoin(dirname(__file__), 'tests')
58+
tests_dir = pjoin(this_dir, 'tests')
6359
suite = TestLoader().discover(tests_dir)
6460
result = TextTestRunner().run(suite)
6561
sys.exit(0 if result.wasSuccessful() else -1)
6662

6763

6864
setup(
69-
name=meta['__title__'],
70-
license=meta['__license__'],
71-
version=meta['__version__'],
72-
author=meta['__author__'],
73-
author_email=meta['__contact__'],
74-
url=meta['__url__'],
75-
description=meta['__description__'],
76-
long_description=(
77-
'Information and documentation can be found at '
78-
'https://github.com/gruns/icecream.'),
79-
platforms=['any'],
80-
packages=find_packages(),
81-
include_package_data=True,
82-
classifiers=[
83-
'License :: OSI Approved :: MIT License',
84-
'Natural Language :: English',
85-
'Intended Audience :: Developers',
86-
'Topic :: Software Development :: Libraries',
87-
'Development Status :: 4 - Beta',
88-
'Programming Language :: Python',
89-
'Programming Language :: Python :: 2',
90-
'Programming Language :: Python :: 2.7',
91-
'Programming Language :: Python :: 3',
92-
'Programming Language :: Python :: 3.5',
93-
'Programming Language :: Python :: 3.6',
94-
'Programming Language :: Python :: 3.7',
95-
'Programming Language :: Python :: 3.8',
96-
'Programming Language :: Python :: 3.9',
97-
'Programming Language :: Python :: Implementation :: PyPy',
98-
'Programming Language :: Python :: Implementation :: CPython',
99-
],
100-
tests_require=[],
101-
install_requires=[
102-
'colorama>=0.3.9',
103-
'pygments>=2.2.0',
104-
'executing>=0.3.1',
105-
'asttokens>=2.0.1',
106-
],
10765
cmdclass={
10866
'test': RunTests,
10967
'publish': Publish,

0 commit comments

Comments
 (0)