diff --git a/.gitignore b/.gitignore index ce09cfb..924ddea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -*.pyc +/jsonpointer/version.py +*.py[co] build .coverage MANIFEST diff --git a/jsonpointer.py b/jsonpointer/__init__.py similarity index 98% rename from jsonpointer.py rename to jsonpointer/__init__.py index 53191ef..7a31f4d 100644 --- a/jsonpointer.py +++ b/jsonpointer/__init__.py @@ -35,8 +35,10 @@ from __future__ import unicode_literals # Will be parsed by setup.py to determine package metadata -__author__ = 'Stefan Kögl ' -__version__ = '2.1' +__author__ = 'Stefan Kögl' +__email__ = 'stefan@skoegl.net' +__author__ += ' <' + __email__ + '>' +from .version import __version__ __website__ = 'https://github.com/stefankoegl/python-json-pointer' __license__ = 'Modified BSD License' diff --git a/bin/jsonpointer b/jsonpointer/__main__.py similarity index 100% rename from bin/jsonpointer rename to jsonpointer/__main__.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d9062e9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3", "read_version[toml] >= 0.3.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "jsonpointer/version.py" +write_to_template = "__version__ = '{version}'\n" + +[tool.read_version] +#version = "jsonpointer.__init__:__version__" +author = "jsonpointer.__init__:__author__" +author_email = "jsonpointer.__init__:__email__" +url = "jsonpointer.__init__:__website__" +license = "jsonpointer.__init__:__license__" diff --git a/setup.cfg b/setup.cfg index 2a9acf1..ec45cf7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,35 @@ +[metadata] +name = jsonpointer +description = Identify specific nodes in a JSON document (RFC 6901) +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Console + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + 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 :: CPython + Programming Language :: Python :: Implementation :: PyPy + Topic :: Software Development :: Libraries + Topic :: Utilities + +[options] +packages = jsonpointer +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* + [bdist_wheel] universal = 1 + +[options.entry_points] +console_scripts = + jsonpointer = jsonpointer.__main__:main diff --git a/setup.py b/setup.py deleted file mode 100644 index da27f3f..0000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup -import re -import io -import os.path - -dirname = os.path.dirname(os.path.abspath(__file__)) -filename = os.path.join(dirname, 'jsonpointer.py') -src = io.open(filename, encoding='utf-8').read() -metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", src)) -docstrings = re.findall('"""(.*)"""', src) - -PACKAGE = 'jsonpointer' - -MODULES = ( - 'jsonpointer', -) - -AUTHOR_EMAIL = metadata['author'] -VERSION = metadata['version'] -WEBSITE = metadata['website'] -LICENSE = metadata['license'] -DESCRIPTION = docstrings[0] - -# Extract name and e-mail ("Firstname Lastname ") -AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups() - - -with open('README.md') as readme: - long_description = readme.read() - - -CLASSIFIERS = [ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - '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 :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries', - 'Topic :: Utilities', -] - -setup(name=PACKAGE, - version=VERSION, - description=DESCRIPTION, - long_description=long_description, - long_description_content_type="text/markdown", - author=AUTHOR, - author_email=EMAIL, - license=LICENSE, - url=WEBSITE, - py_modules=MODULES, - scripts=['bin/jsonpointer'], - classifiers=CLASSIFIERS, - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', -)