Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Mar 27, 2024
0 parents commit 0db5fbe
Show file tree
Hide file tree
Showing 47 changed files with 14,262 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .flake8
@@ -0,0 +1,11 @@
[flake8]
doctests = 1
ignore =
# black takes care of line length
E501,
# black takes care of where to break lines
W503,
# black takes care of spaces within slicing (list[:])
E203,
# black takes care of spaces after commas
E231,
29 changes: 29 additions & 0 deletions .github/workflows/changelog.yml
@@ -0,0 +1,29 @@
name: Changelog check
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Fetch all history
fetch-depth: '0'

- name: Install pipx
run: pip install towncrier

- name: Check for presence of a Change Log fragment (only pull requests)
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin ${BASE_BRANCH}
towncrier check
env:
BASE_BRANCH: ${{ github.base_ref }}
if: github.event_name == 'pull_request'
31 changes: 31 additions & 0 deletions .github/workflows/code.yml
@@ -0,0 +1,31 @@
name: Test Codebase

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install tox
run: pip install tox

- name: Test
run: tox -e test
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,30 @@
name: Codebase lint

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
PYTHON_VERSION: 3.11

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"

- name: Install tox
run: pip install tox

- name: Test
run: tox -e lint
74 changes: 74 additions & 0 deletions .gitignore
@@ -0,0 +1,74 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
bin/
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
.pytest_cache

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask instance folder
instance/

# Sphinx documentation
docs/_build/

# MkDocs documentation
/site/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,43 @@
---
ci:
autofix_prs: false
autoupdate_schedule: monthly

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.14.0
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/regebro/pyroma
rev: "4.2"
hooks:
- id: pyroma
- repo: https://github.com/mgedmin/check-python-versions
rev: "0.21.3"
hooks:
- id: check-python-versions
args: ['--only', 'pyproject.toml']
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,9 @@
# Changelog

<!-- You should *NOT* be adding new change log entries to this file.
You should create a file in the news directory instead.
For helpful instructions, please see:
https://6.docs.plone.org/volto/developer-guidelines/contributing.html#create-a-pull-request
-->

<!-- towncrier release notes start -->
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2024 Érico Andrei

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
62 changes: 62 additions & 0 deletions Makefile
@@ -0,0 +1,62 @@
### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

CUR_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
GIT_FOLDER=$(CUR_FOLDER)/.git

all: install

# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
.PHONY: help
help: ## This help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

bin/pip bin/tox:
@echo "$(GREEN)==> Setup Virtual Env$(RESET)"
python3 -m venv .
bin/pip install -U "pip" "pipx"
bin/pip install -e ".[test]"
if [ -d $(GIT_FOLDER) ]; then bin/pre-commit install; else echo "$(RED) Not installing pre-commit$(RESET)";fi


.PHONY: install
install: bin/pip ## Install package

.PHONY: clean
clean: ## Remove old virtualenv and creates a new one
@echo "$(RED)==> Cleaning environment and build$(RESET)"
rm -rf bin lib lib64 include share etc var inituser pyvenv.cfg .installed.cfg instance .tox .pytest_cache

.PHONY: format
format: bin/tox ## Format the codebase according to our standards
@echo "$(GREEN)==> Format codebase$(RESET)"
bin/tox -e format

.PHONY: lint
lint: ## check code style
@echo "$(GREEN)==> Lint codebase$(RESET)"
bin/tox -e lint

# Tests
.PHONY: test
test: bin/tox ## run tests
bin/tox -e test

.PHONY: test-coverage
test-coverage: bin/tox ## run tests with coverage
bin/tox -e coverage
56 changes: 56 additions & 0 deletions README.md
@@ -0,0 +1,56 @@
<h1 align="center">pytest-jsonschema</h1>

<div align="center">

[![PyPI](https://img.shields.io/pypi/v/pytest-jsonschema)](https://pypi.org/project/pytest-jsonschema/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-jsonschema)](https://pypi.org/project/pytest-jsonschema/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/pytest-jsonschema)](https://pypi.org/project/pytest-jsonschema/)
[![PyPI - License](https://img.shields.io/pypi/l/pytest-jsonschema)](https://pypi.org/project/pytest-jsonschema/)
[![PyPI - Status](https://img.shields.io/pypi/status/pytest-jsonschema)](https://pypi.org/project/pytest-jsonschema/)


[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/pytest-jsonschema)](https://pypi.org/project/pytest-jsonschema/)

[![Tests](https://github.com/collective/pytest-jsonschema/actions/workflows/meta.yml/badge.svg)](https://github.com/collective/pytest-jsonschema/actions/workflows/main.yml)
![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)

[![GitHub contributors](https://img.shields.io/github/contributors/collective/pytest-jsonschema)](https://github.com/collective/pytest-jsonschema)
[![GitHub Repo stars](https://img.shields.io/github/stars/collective/pytest-jsonschema?style=social)](https://github.com/collective/pytest-jsonschema)
</div>

**pytest-jsonschema** is a [pytest](https://docs.pytest.org) plugin providing fixtures to perform JSONSchema validations.

Features
--------

* TODO


Requirements
------------

* TODO


Installation
------------

You can install "pytest-jsonschema" via `pip`_ from `PyPI`_::

$ pip install pytest-jsonschema


Usage
-----

* TODO

Contributing
------------
Contributions are very welcome. Tests can be run with `tox`_, please ensure
the coverage at least stays the same before you submit a pull request.

License
-------

Distributed under the terms of the `MIT`_ license, "pytest-jsonschema" is free and open source software
14 changes: 14 additions & 0 deletions docs/towncrier_template.jinja
@@ -0,0 +1,14 @@
{% if sections[""] %}
{% for category, val in definitions.items() if category in sections[""] %}

### {{ definitions[category]['name'] }}

{% for text, values in sections[""][category].items() %}
- {{ text }} {{ values|join(', ') }}
{% endfor %}

{% endfor %}
{% else %}
No significant changes.

{% endif %}
Empty file added news/.gitkeep
Empty file.

0 comments on commit 0db5fbe

Please sign in to comment.