Skip to content

Commit 823e021

Browse files
committed
Initial commit
0 parents  commit 823e021

13 files changed

+363
-0
lines changed

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
repos:
3+
- repo: https://github.com/python/black
4+
rev: 19.10b0
5+
hooks:
6+
- id: black
7+
language_version: python3
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v2.4.0
10+
hooks:
11+
- id: end-of-file-fixer
12+
- id: trailing-whitespace
13+
- id: mixed-line-ending
14+
- id: check-byte-order-marker
15+
- id: check-executables-have-shebangs
16+
- id: check-merge-conflict
17+
- id: debug-statements
18+
- id: check-yaml
19+
files: .*\.(yaml|yml)$
20+
- repo: https://gitlab.com/pycqa/flake8
21+
rev: 3.7.9
22+
hooks:
23+
- id: flake8
24+
additional_dependencies:
25+
- flake8-black
26+
- repo: https://github.com/adrienverge/yamllint.git
27+
rev: v1.20.0
28+
hooks:
29+
- id: yamllint
30+
files: \.(yaml|yml)$
31+
types: [file, yaml]
32+
entry: yamllint --strict -f parsable

.pre-commit-hooks.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- id: scheme8
3+
name: scheme8
4+
description: scheme8 verifies JSON/YAML syntax
5+
language: python
6+
pass_filenames: true
7+
verbose: true
8+
entry: scheme8

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 PyContribs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include scheme8/data/*.json

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# scheme8
2+
A multi-purpose JSON/YAML scheme checker written in python and pre-commit compatible

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 41.0.0",
4+
"setuptools_scm >= 1.15.0",
5+
"setuptools_scm_git_archive >= 1.0",
6+
"wheel",
7+
]
8+
build-backend = "setuptools.build_meta"

scheme8/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from __future__ import absolute_import, division, print_function
2+
3+
__metaclass__ = type
4+
5+
try:
6+
import pkg_resources
7+
8+
__version__ = pkg_resources.get_distribution("scheme8").version
9+
except Exception:
10+
__version__ = "unknown"

scheme8/__main__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from __future__ import print_function
2+
from jsonschema import Draft7Validator
3+
import argparse
4+
import json
5+
import os
6+
import pkg_resources
7+
import sys
8+
import yaml
9+
10+
11+
def main():
12+
"""Scheme8 Linter
13+
"""
14+
parser = argparse.ArgumentParser(prog="scheme8")
15+
parser.add_argument(
16+
"--version",
17+
action="version",
18+
version=pkg_resources.get_distribution("scheme8").version,
19+
)
20+
parser.add_argument("file", nargs="+", help="file(s) to lint")
21+
args = parser.parse_args()
22+
23+
24+
if __name__ == "__main__":
25+
main()

setup.cfg

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[metadata]
2+
name = scheme8
3+
version = 0.0.1
4+
description = scheme8
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
url = https://github.com/pycontribs/scheme8
8+
author = Sorin Sbarnea
9+
author_email = [email protected]
10+
project_urls =
11+
Source=https://github.com/pycontribs/scheme8
12+
Tracker=https://github.com/tox-dev/pycontribs/scheme8
13+
license = MIT
14+
license_file = LICENSE
15+
classifiers =
16+
License :: OSI Approved :: MIT License
17+
Programming Language :: Python :: 2
18+
Programming Language :: Python :: 2.7
19+
Programming Language :: Python :: 3
20+
Programming Language :: Python :: 3.5
21+
Programming Language :: Python :: 3.6
22+
Programming Language :: Python :: 3.7
23+
Programming Language :: Python :: 3.8
24+
Programming Language :: Python :: Implementation :: CPython
25+
Programming Language :: Python :: Implementation :: PyPy
26+
27+
[options]
28+
use_scm_version = True
29+
packages = find:
30+
include_package_data = true
31+
install_requires =
32+
pyyaml
33+
jsonschema
34+
six
35+
typing; python_version<"3.5"
36+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
37+
38+
[options.entry_points]
39+
console_scripts =
40+
scheme8 = scheme8.__main__:main
41+
42+
[options.packages.find]
43+
exclude =
44+
tests*
45+
testing*
46+
47+
[bdist_wheel]
48+
universal = True
49+
50+
[mypy]
51+
check_untyped_defs = true
52+
disallow_any_generics = true
53+
disallow_incomplete_defs = true
54+
disallow_untyped_defs = true
55+
no_implicit_optional = true
56+
57+
[mypy-testing.*]
58+
disallow_untyped_defs = false
59+
60+
[mypy-tests.*]
61+
disallow_untyped_defs = false
62+
63+
[flake8]
64+
# do not add excludes for files in repo
65+
exclude = .venv/,.tox/,dist/,build/,.eggs/
66+
format = pylint
67+
# E203: https://github.com/python/black/issues/315
68+
ignore = E741,W503,W504,H,E501,E203
69+
# 88 is official black default:
70+
max-line-length = 88

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from setuptools import setup
2+
3+
setup(use_scm_version=True, setup_requires=["setuptools_scm"])

tests/test_scheme8.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import pytest
2+
import sh
3+
4+
5+
def test_foo():
6+
pass

tox.ini

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[tox]
2+
envlist = lint,py27,py36,py37,pre-commit
3+
4+
[testenv]
5+
deps =
6+
pre-commit
7+
pytest-sugar
8+
sh
9+
setenv =
10+
GIT_AUTHOR_NAME = "test"
11+
GIT_COMMITTER_NAME = "test"
12+
GIT_AUTHOR_EMAIL = "[email protected]"
13+
GIT_COMMITTER_EMAIL = "[email protected]"
14+
commands =
15+
pytest
16+
pre-commit try-repo .
17+
whitelist_externals =
18+
rm
19+
bash
20+
21+
[testenv:pre-commit]
22+
skip_install = true
23+
deps = pre-commit
24+
commands = pre-commit run --all-files --show-diff-on-failure
25+
[testenv:lint]
26+
description = Performs linting, style checks, metadata-validation, packaging
27+
skip_install = true
28+
deps =
29+
pep517>=0.5.0
30+
pre-commit
31+
twine
32+
commands =
33+
pre-commit run -a
34+
bash -c "rm -rf {toxinidir}/dist/ && mkdir -p {toxinidir}/dist/"
35+
python -m pep517.build \
36+
--source \
37+
--binary \
38+
--out-dir {toxinidir}/dist/ \
39+
{toxinidir}
40+
twine check dist/*
41+
42+
[testenv:upload]
43+
description = Builds the packages and uploads them to https://pypi.org
44+
envdir={toxworkdir}/lint
45+
deps={[testenv:lint]deps}
46+
commands =
47+
{[testenv:lint]commands}
48+
twine upload --disable-progress-bar --skip-existing --verbose dist/*

0 commit comments

Comments
 (0)