Skip to content

Commit

Permalink
Merge branch 'main' into bool-format-checks
Browse files Browse the repository at this point in the history
* main:
  Slightly speed up pip installs by skipping the version check in CI.
  Remove the now-unused MANIFEST.in.
  v4.6.0 -> CHANGELOG
  Ignore the badge URLs, they seem super unreliable from CI.
  Ignore a deprecation warning coming from pkg_resources on 3.11
  Add basic CONTRIBUTING guidelines.
  Make project.urls be valid URLs.
  Combine the CI and packaging workflows.
  Let RTD be authoritative about what the default doc version is.
  Re-enable Python 3.11 testing in CI.
  Modernize the packaging setup via PEP 621 and Hatch.
  Update various GHA versions.
  Update docs requirements.
  Revert "Merge pull request #954 from ssbarnea/fix/py.typed"
  • Loading branch information
Julian committed Jun 2, 2022
2 parents af47da8 + fd3a457 commit ded065d
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 188 deletions.
10 changes: 10 additions & 0 deletions .flake8
@@ -0,0 +1,10 @@
[flake8]
ban-relative-imports = true
inline-quotes = "
exclude =
jsonschema/__init__.py
jsonschema/_reflect.py
ignore =
B008, # Barring function calls in default args. Ha, no.
B306, # See https://github.com/PyCQA/flake8-bugbear/issues/131
W503, # (flake8 default) old PEP8 boolean operator line breaks
73 changes: 53 additions & 20 deletions .github/workflows/ci.yml
Expand Up @@ -13,9 +13,9 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v2.0.3

ci:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -84,19 +84,18 @@ jobs:
toxenv: py310-format_nongpl-build
- name: "3.10"
toxenv: py310-format_nongpl-tests
# Temporarily disabled due to pypa/setuptools#3274
# - name: "3.11.0-alpha - 3.11.0"
# toxenv: py311-noextra-build
# - name: "3.11.0-alpha - 3.11.0"
# toxenv: py311-noextra-tests
# - name: "3.11.0-alpha - 3.11.0"
# toxenv: py311-format-build
# - name: "3.11.0-alpha - 3.11.0"
# toxenv: py311-format-tests
# - name: "3.11.0-alpha - 3.11.0"
# toxenv: py311-format_nongpl-build
# - name: "3.11.0-alpha - 3.11.0"
# toxenv: py311-format_nongpl-tests
- name: "3.11.0-beta - 3.11.0"
toxenv: py311-noextra-build
- name: "3.11.0-beta - 3.11.0"
toxenv: py311-noextra-tests
- name: "3.11.0-beta - 3.11.0"
toxenv: py311-format-build
- name: "3.11.0-beta - 3.11.0"
toxenv: py311-format-tests
- name: "3.11.0-beta - 3.11.0"
toxenv: py311-format_nongpl-build
- name: "3.11.0-beta - 3.11.0"
toxenv: py311-format_nongpl-tests
- name: "3.10"
toxenv: docs-dirhtml
- name: "3.10"
Expand Down Expand Up @@ -180,13 +179,11 @@ jobs:
toxenv: docs-style

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version.name }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version.name }}
- name: Ensure we have new enough versions to respect python_version
run: python -m pip install -U pip setuptools
- name: Install dependencies
run: >
sudo apt-get update &&
Expand All @@ -199,3 +196,39 @@ jobs:
run: python -m pip install tox
- name: Run tox
run: python -m tox -e "${{ matrix.python-version.toxenv }}"

packaging:
needs: ci
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install build
- name: Create packages
run: python -m build .
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Create Release Notes
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.ref }}",
generate_release_notes: true
});
8 changes: 3 additions & 5 deletions .github/workflows/coverage.yml
Expand Up @@ -10,13 +10,11 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Ensure we have new enough versions to respect python_version
run: python -m pip install -U pip setuptools
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- name: Collect & Upload Coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
oss-fuzz-project-name: 'jsonschema'
fuzz-seconds: 30
- name: Upload Crash
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/packaging.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.rst
@@ -1,3 +1,12 @@
v4.6.0
------

* Fix ``unevaluatedProperties`` and ``unevaluatedItems`` for types they should
ignore (#949)
* ``jsonschema`` now uses `hatch <https://hatch.pypa.io/>`_ for its build
process. This should be completely transparent to end-users (and only matters
to contributors).

v4.5.1
------

Expand Down
60 changes: 60 additions & 0 deletions CONTRIBUTING.rst
@@ -0,0 +1,60 @@
============================
Contributing to `jsonschema`
============================

Found a bug?
------------

If you suspect you may have found a security-related vulnerability, please follow the instructions in `the security policy <https://github.com/python-jsonschema/jsonschema/blob/main/.github/SECURITY.md>`_.

Otherwise, it is extremely helpful if you first search to see whether your bug has been `previously reported on the Issues tab <https://github.com/python-jsonschema/jsonschema/issues?q=is%3Aissue+is%3Aopen+label%3ABug>`_.

If it doesn't appear to be a known issue, please `file a new one <https://github.com/python-jsonschema/jsonschema/issues/new>`_, and include a **title and clear description**, along with as much relevant information as possible.
Including a *minimal*, *self-sufficient* bit of code (often an instance and schema) is the fastest way to get attention, along with a description of the behavior you expect, and if you're able, a link to where in the specification contains the behavior you're noticing is incorrect.

Pull requests to fix your issue are of course very welcome.


Fixing a Bug?
-------------

Please open a new GitHub pull request with the change, along with new tests.

Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

Continuous integration via GitHub actions should run to indicate whether your change passes both the test suite as well as linters.
Please ensure it passes, or indicate in a comment if you believe it fails spuriously.


Adding New Functionality?
-------------------------

Please discuss any larger changes ahead of time for the sake of your own time!

Improvements are very welcome, but large pull requests, disruptive ones, or backwards incompatible ones, can lead to long back and forth discussions.

You're welcome to suggest a change in an issue and thereby get some initial feedback before embarking on an effort that may not get merged.


Improving the Documentation?
----------------------------

Writing good documentation is challenging both to prioritize and to do well.

Any help you may have would be great, especially if you're a beginner who's struggled to understand a part of the library.

Documentation is written in `Sphinx-flavored reStructuredText <https://www.sphinx-doc.org>`_, so you'll want to familiarize yourself a bit with Sphinx.

Feel free to file issues or pull requests.


Have a Question?
----------------

Please do not use the issue tracker for questions, it's reserved for things believed to be bugs, or new functionality.

There is a `discussions tab <https://github.com/python-jsonschema/jsonschema/discussions>`_ where general questions can be asked.

Answers on it are best-effort.

Any help you can offer to answer others' questions is of course very welcome as well.
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

5 changes: 3 additions & 2 deletions README.rst
Expand Up @@ -125,8 +125,9 @@ schemas can be found there.
Otherwise, asking questions on Stack Overflow is another means of
getting help if you're stuck.

Contributing
------------

About
-----

I'm Julian Berman.

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Expand Up @@ -240,6 +240,7 @@ def entire_domain(host):


linkcheck_ignore = [
entire_domain("img.shields.io"),
"https://github.com/python-jsonschema/jsonschema/actions",
"https://github.com/python-jsonschema/jsonschema/workflows/CI/badge.svg",
]
Expand Down
2 changes: 1 addition & 1 deletion docs/validate.rst
Expand Up @@ -205,7 +205,7 @@ to validate. Their names can be viewed by inspecting the
`FormatChecker.checkers` attribute. Certain checkers will only be
available if an appropriate package is available for use. The easiest way to
ensure you have what is needed is to install ``jsonschema`` using the
``format`` or ``format_nongpl`` setuptools extra -- i.e.
``format`` or ``format_nongpl`` collection of optional dependencies -- e.g.

.. code-block:: sh
Expand Down
Empty file removed jsonschema/py.typed
Empty file.
97 changes: 89 additions & 8 deletions pyproject.toml
@@ -1,16 +1,97 @@
[build-system]
requires = [
# The minimum setuptools version is specific to the PEP 517 backend,
# and may be stricter than the version required in `setup.py`
"setuptools>=40.6.0",
"setuptools_scm[toml]>=3.4",
"wheel",
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.version]
source = "vcs"

[project]
name = "jsonschema"
description = "An implementation of JSON Schema validation for Python"
readme = "README.rst"
requires-python = ">=3.7"
license = {text = "MIT"}
keywords = ["validation", "data validation", "jsonschema", "json"]
authors = [
{email = "Julian+jsonschema@GrayVines.com"},
{name = "Julian Berman"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["version"]

dependencies = [
"attrs>=17.4.0",
"pyrsistent>=0.14.0,!=0.17.0,!=0.17.1,!=0.17.2",

"importlib_metadata;python_version<'3.8'",
"typing_extensions;python_version<'3.8'",
"importlib_resources>=1.4.0;python_version<'3.9'",
]

[project.optional-dependencies]
format = [
"fqdn",
"idna",
"isoduration",
"jsonpointer>1.13",
"rfc3339-validator",
"rfc3987",
"uri_template",
"webcolors>=1.11",
]
format_nongpl = [
"fqdn",
"idna",
"isoduration",
"jsonpointer>1.13",
"rfc3339-validator",
"rfc3986-validator>0.1.0",
"uri_template",
"webcolors>=1.11",
]
build-backend = "setuptools.build_meta"

[project.scripts]
jsonschema = "jsonschema.cli:main"

[project.urls]
homepage = "https://github.com/python-jsonschema/jsonschema"
documentation = "https://python-jsonschema.readthedocs.io/"
issues = "https://github.com/python-jsonschema/jsonschema/issues/"
funding = "https://github.com/sponsors/Julian"
tidelift = "https://tidelift.com/subscription/pkg/pypi-jsonschema?utm_source=pypi-jsonschema&utm_medium=referral&utm_campaign=pypi-link"
changelog = "https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst"
source = "https://github.com/python-jsonschema/jsonschema"

[tool.isort]
from_first = true
include_trailing_comma = true
multi_line_output = 3

[tool.setuptools_scm]
[tool.mypy]
ignore_missing_imports = true

[tool.pydocstyle]
match = "(?!(test_|_|compat|cli)).*\\.py" # see PyCQA/pydocstyle#323
add-select = [
"D410", # Trailing whitespace plz
]
add-ignore = [
"D107", # Hah, no
"D200", # 1-line docstrings don't need to be on one line
"D202", # One line is fine.
"D412", # Trailing whitespace plz
"D413", # No trailing whitespace plz
]

0 comments on commit ded065d

Please sign in to comment.