Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved the metadata into setup.cfg. #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
/jsonpatch/version.py
*.py[co]
build
.coverage
dist
Expand Down
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
dist: xenial
language: python
python:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
Expand All @@ -10,10 +9,6 @@ python:
- 3.10-dev
- nightly
- pypy3
addons:
apt:
packages:
- pandoc
install:
- travis_retry pip install -r requirements.txt
- travis_retry pip install coveralls
Expand Down
4 changes: 3 additions & 1 deletion jsonpatch.py → jsonpatch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
str = unicode

# Will be parsed by setup.py to determine package metadata
__author__ = 'Stefan Kögl <stefan@skoegl.net>'
__author__ = 'Stefan Kögl'
__email__ = 'stefan@skoegl.net'
__author__ += ' <' + __email__ + '>'
__version__ = '1.32'
__website__ = 'https://github.com/stefankoegl/python-json-patch'
__license__ = 'Modified BSD License'
Expand Down
Empty file added jsonpatch/cli/__init__.py
Empty file.
7 changes: 4 additions & 3 deletions bin/jsondiff → jsonpatch/cli/jsondiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@

import sys
import json
import jsonpatch
import argparse

from .. import __version__, make_patch


parser = argparse.ArgumentParser(description='Diff two JSON files')
parser.add_argument('FILE1', type=argparse.FileType('r'))
parser.add_argument('FILE2', type=argparse.FileType('r'))
parser.add_argument('--indent', type=int, default=None,
help='Indent output by n spaces')
parser.add_argument('-v', '--version', action='version',
version='%(prog)s ' + jsonpatch.__version__)
version='%(prog)s ' + __version__)


def main():
Expand All @@ -30,7 +31,7 @@ def diff_files():
args = parser.parse_args()
doc1 = json.load(args.FILE1)
doc2 = json.load(args.FILE2)
patch = jsonpatch.make_patch(doc1, doc2)
patch = make_patch(doc1, doc2)
if patch.patch:
print(json.dumps(patch.patch, indent=args.indent))
sys.exit(1)
Expand Down
7 changes: 4 additions & 3 deletions bin/jsonpatch → jsonpatch/cli/jsonpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import sys
import os.path
import json
import jsonpatch
import tempfile
import argparse

from .. import __version__, apply_patch


parser = argparse.ArgumentParser(
description='Apply a JSON patch on a JSON file')
Expand All @@ -23,7 +24,7 @@
parser.add_argument('-i', '--in-place', action='store_true',
help='Modify ORIGINAL in-place instead of to stdout')
parser.add_argument('-v', '--version', action='version',
version='%(prog)s ' + jsonpatch.__version__)
version='%(prog)s ' + __version__)
parser.add_argument('-u', '--preserve-unicode', action='store_true',
help='Output Unicode character as-is without using Code Point')

Expand All @@ -39,7 +40,7 @@ def patch_files():
args = parser.parse_args()
doc = json.load(args.ORIGINAL)
patch = json.load(args.PATCH)
result = jsonpatch.apply_patch(doc, patch)
result = apply_patch(doc, patch)

if args.in_place:
dirname = os.path.abspath(os.path.dirname(args.ORIGINAL.name))
Expand Down
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[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 = "jsonpatch/version.py"
write_to_template = "__version__ = '{version}'\n"

[tool.read_version]
author = "jsonpatch.__init__:__author__"
author_email = "jsonpatch.__init__:__email__"
url = "jsonpatch.__init__:__website__"
license = "jsonpatch.__init__:__license__"
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
build
setuptools
setuptools_scm
read_version
coverage
wheel
pypandoc
42 changes: 42 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
[metadata]
name = jsonpatch
description = Apply JSON-Patches (RFC 6902)
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
project_urls =
Website = https://github.com/stefankoegl/python-json-patch
Repository = https://github.com/stefankoegl/python-json-patch.git
Documentation = https://python-json-patch.readthedocs.org/
PyPI = https://pypi.org/pypi/jsonpatch
Tests = https://travis-ci.org/stefankoegl/python-json-patch
Test Coverage = https://coveralls.io/r/stefankoegl/python-json-patch

[options]
packages = jsonpatch, jsonpatch.cli
install_requires = jsonpointer>=1.9
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*

[options.entry_points]
console_scripts =
jsondiff = jsonpatch.cli.jsondiff:main
jsonpatch = jsonpatch.cli.jsonpatch:main

[bdist_wheel]
universal = 1
93 changes: 0 additions & 93 deletions setup.py

This file was deleted.