Skip to content

Commit

Permalink
Moved the metadata into pyproject.toml.
Browse files Browse the repository at this point in the history
Version is now populated automatically from git using `setuptools_scm`.
  • Loading branch information
KOLANICH committed Jul 25, 2022
1 parent cbd6da2 commit dec70fc
Show file tree
Hide file tree
Showing 6 changed files with 62 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
5 changes: 2 additions & 3 deletions icecream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +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.
from . import __version__
globals().update(dict((k, v) for k, v in __version__.__dict__.items()))
meta = {"__version__": __version__}
21 changes: 0 additions & 21 deletions icecream/__version__.py

This file was deleted.

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

[project]
name = "icecream"
authors = [{name = "Ansgar Grunseid", email = "[email protected]"}]
license = {text = "MIT"}
description = "Never use print() to debug again" # inspect variables, expressions, and program execution with a single, simple function call.
readme = "README.md"
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",
]
urls = {Homepage = "https://github.com/gruns/icecream"}
dependencies = [
"colorama>=0.3.9",
"pygments>=2.2.0",
"executing>=0.3.1",
"asttokens>=2.0.1",
]
dynamic = ["version"]

[tool.setuptools]
include-package-data = true
platforms = ["any"]
license-files = ["LICENSE.txt"]

[tool.setuptools.packages]
find = {namespaces = false}

[tool.distutils.bdist_wheel]
universal = 1

[tool.setuptools_scm]
write_to = "icecream/__version__.py"
write_to_template = "__version__ = '{version}'\n"
5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

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, "*.tar.gz"))
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 dec70fc

Please sign in to comment.