Skip to content

UV + Precommit + a CLI Entry Point #110

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

Open
wants to merge 5 commits 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
48 changes: 23 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
- uses: actions/checkout@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools tox

- name: Run checks
run: |
python -m tox --recreate -e check
uv run tox --recreate -e check
git diff --exit-code

test:
Expand All @@ -29,17 +29,16 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy-3.8", "pypy-3.9", "pypy-3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools tox

- name: Run tests
# Disable coverage on PyPy
run: |
python -m tox --recreate -e test \
uv run tox --recreate -e test \
-- -n auto --durations=10 -k "not test_can_generate_for_real_large_schema" \
$(${{ startsWith(matrix.python-version, 'pypy') }} && echo '--no-cov')

Expand All @@ -50,32 +49,31 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"] # FIXME: these segfault PyPy
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools tox
- name: Run slow tests
run: |
python -m tox --recreate -e test \
uv run tox --recreate -e test \
-- -n auto --durations=10 --no-cov -k test_can_generate_for_real_large_schema

release:
runs-on: ubuntu-latest
needs: [check, test, test-slow]
if: github.repository == 'python-jsonschema/hypothesis-jsonschema' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: 3.8
- name: Install tools
run: python -m pip install --upgrade pip setuptools wheel twine
python-version: "3.8"
- name: Upload new release
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: python setup.py sdist bdist_wheel && twine upload --skip-existing dist/*
run: |
pip install twine
uv build
twine upload --skip-existing dist/*
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
args: ["--line-length", "120"] # this is the line length used by flake8 in the super-linter
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
args: [--profile, black] # this allows it to be compatible with ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.23
hooks:
- id: uv-lock
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------

This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
defined by the Mozilla Public License, v. 2.0.
111 changes: 110 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,68 @@
[tool.ruff]
[project]
name = "hypothesis-jsonschema"
version = "0.23.1"

keywords = [
"python",
"testing",
"fuzzing",
"property-based-testing",
"json-schema"
]
description = "Generate test data from JSON schemata with Hypothesis"
requires-python = ">=3.8"
readme = "README.md"
authors = [
{ name = "Zac Hatfield-Dodds", email = "[email protected]"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Hypothesis",
"Intended Audience :: Developers",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Education :: Testing",
"Topic :: Software Development :: Testing",
"Typing :: Typed",]
license = "MPL-2.0"

zip-safe = false


dependencies = [
"hypothesis>=6.84.3",
"jsonschema>=4.18.0",
"typer>=0.15.4",
]

[project.urls]
repository = "https://github.com/Zac-HD/hypothesis-jsonschema"
funding = "https://github.com/sponsors/Zac-HD"

[dependency-groups]
dev = [
"pytest",
"pytest-cov",
"pytest-xdist",
"flake8",
"ruff",
"mypy",
"shed"
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project.scripts]
hypothesisjson = "hypothesis_jsonschema._cli:app"

[tool.ruff.lint]
select = [
"ASYNC", # flake8-async
"B", # flake8-bugbear
Expand Down Expand Up @@ -51,4 +115,49 @@ ignore = [
"PT027",
"UP031",
]
[tool.ruff]
target-version = "py38"


# Settings for other tools
[pytest]
xfail_strict = true
addopts = [
"-Werror",
"--tb=short",
"--cov=hypothesis_jsonschema",
"--cov-branch",
"--cov-report=term-missing:skip-covered",
"--cov-fail-under=100",
]

[flake8]
ignore = [
"D1",
"E203",
"E501",
"W503",
"S101",
"S310"
]
exclude = [
".*/",
"__pycache__"
]

[mypy]
python_version = 3.8
platform = "linux"
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_untyped_decorators = true
follow_imports = "silent"
ignore_missing_imports = true
implicit_reexport = false
strict_equality = true
warn_no_return = true
warn_return_any = true
warn_unreachable = true
warn_unused_ignores = true
warn_unused_configs = true
warn_redundant_casts = true
54 changes: 0 additions & 54 deletions setup.py

This file was deleted.

Loading
Loading