Skip to content

Commit

Permalink
Moved the metadata into setup.cfg
Browse files Browse the repository at this point in the history
Added `pyproject.toml`
Version is now populated automatically from git using `setuptools_scm`.
  • Loading branch information
KOLANICH committed Feb 22, 2022
1 parent 767131c commit 4094e05
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 79 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/icecream/__version__.py
*~
.#*
\#*
Expand Down
7 changes: 2 additions & 5 deletions icecream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
from os.path import dirname, join as pjoin

from .icecream import * # noqa
from .__version__ import __version__
from .builtins import install, uninstall

# Import all variables in __version__.py without explicit imports.
meta = {}
with open(pjoin(dirname(__file__), '__version__.py')) as f:
exec(f.read(), meta)
globals().update(dict((k, v) for k, v in meta.items() if k not in globals()))
meta = {"__version__": __version__}
21 changes: 0 additions & 21 deletions icecream/__version__.py

This file was deleted.

7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "icecream/__version__.py"
write_to_template = "__version__ = '{version}'\n"
41 changes: 38 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
[bdist_wheel]
universal = 1

[metadata]
license_file = LICENSE.txt
name = icecream
version = 2.1.2
author = Ansgar Grunseid
author_email = [email protected]
license = MIT
description = Never use print() to debug again; inspect variables, expressions, and program execution with a single, simple function call.
url = https://github.com/gruns/icecream
long_description = Information and documentation can be found at https://github.com/gruns/icecream.
classifiers =
License :: OSI Approved :: MIT License
Natural Language :: English
Intended Audience :: Developers
Topic :: Software Development :: Libraries
Development Status :: 4 - Beta
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
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
Programming Language :: Python :: Implementation :: PyPy
Programming Language :: Python :: Implementation :: CPython
platforms = any

[options]
packages = find:
install_requires =
colorama>=0.3.9
pygments>=2.2.0
executing>=0.3.1
asttokens>=2.0.1
include_package_data = True

[bdist_wheel]
universal = 1
58 changes: 8 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
import os
import sys
from os.path import dirname, join as pjoin
from setuptools import setup, find_packages, Command
from glob import glob
from setuptools import Command, setup
from setuptools.command.test import test as TestCommand


meta = {}
with open(pjoin('icecream', '__version__.py')) as f:
exec(f.read(), meta)

this_dir = dirname(__file__)

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

def run(self):
os.system('python setup.py sdist bdist_wheel')

sdist = 'dist/icecream-%s.tar.gz' % meta['__version__']
wheel = 'dist/icecream-%s-py2.py3-none-any.whl' % meta['__version__']
rc = os.system('twine upload "%s" "%s"' % (sdist, wheel))
dist_dir = pjoin(this_dir, 'dist')
os.system(sys.executable + ' -m build -nwxs ' + this_dir)
files = glob(pjoin(dist_dir, '*.whl')) + glob(pjoin(dist_dir, '*.whl'))
rc = os.system(sys.executable + ' -m twine upload ' + " ".join(files))

sys.exit(rc)

Expand All @@ -59,51 +55,13 @@ class RunTests(TestCommand):
"""
def run_tests(self):
from unittest import TestLoader, TextTestRunner
tests_dir = pjoin(dirname(__file__), 'tests')
tests_dir = pjoin(this_dir, 'tests')
suite = TestLoader().discover(tests_dir)
result = TextTestRunner().run(suite)
sys.exit(0 if result.wasSuccessful() else -1)


setup(
name=meta['__title__'],
license=meta['__license__'],
version=meta['__version__'],
author=meta['__author__'],
author_email=meta['__contact__'],
url=meta['__url__'],
description=meta['__description__'],
long_description=(
'Information and documentation can be found at '
'https://github.com/gruns/icecream.'),
platforms=['any'],
packages=find_packages(),
include_package_data=True,
classifiers=[
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Development Status :: 4 - Beta',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'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',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython',
],
tests_require=[],
install_requires=[
'colorama>=0.3.9',
'pygments>=2.2.0',
'executing>=0.3.1',
'asttokens>=2.0.1',
],
cmdclass={
'test': RunTests,
'publish': Publish,
Expand Down

0 comments on commit 4094e05

Please sign in to comment.