Skip to content

Commit

Permalink
chore: bump version to 0.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Oct 19, 2023
1 parent 687b012 commit b153121
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- docs/**
- examples/**
- mkdocs.yml
- setup.py
- pyproject.toml
pull_request:
paths:
- apischema/**
Expand All @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- name: Install apischema
run: pip install -e .
- name: Install requirements
Expand Down Expand Up @@ -66,6 +66,8 @@ jobs:
${{ runner.os }}-pip-
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: actions/download-artifact@v3
with:
name: benchmark_table
Expand Down Expand Up @@ -99,6 +101,8 @@ jobs:
${{ runner.os }}-pip-
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: actions/download-artifact@v3
with:
name: benchmark_table
Expand All @@ -120,12 +124,12 @@ jobs:
git fetch origin gh-pages --depth=1
- name: Set environment variable
run: |
echo "version=$(python setup.py --version | cut -d. -f-2)" >> $GITHUB_ENV
echo "revision=$(python setup.py --version | cut -d. -f3)" >> $GITHUB_ENV
echo "version=$(cat pyproject.toml | grep "version =" | cut -d' ' -f3 | cut -d'"' -f2 | cut -d. -f-2)" >> $GITHUB_ENV
echo "revision=$(cat pyproject.toml | grep "version =" | cut -d' ' -f3 | cut -d'"' -f2 | cut -d. -f3)" >> $GITHUB_ENV
echo "latest=$(mike list latest -j | jq .version -r)" >> $GITHUB_ENV
- name: Publish dev documentation
if: github.event_name == 'push' && env.version != env.latest
run: mike deploy -p $version dev -t "$version (dev)" -u
run: mike deploy -p $version dev -t "dev" -u
- name: Publish latest documentation
if: github.event_name == 'release' && env.revision == '0'
run: |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ It requires only Python 3.8+. *PyPy3* is also fully supported.

## Why another library?

(If you wonder how this differs from the *pydantic* library, see the [dedicated section of the documentation](https://wyfo.github.io/apischema/0.18/difference_with_pydantic) — there are many differences.)
(If you wonder how this differs from the *pydantic* library, see the [dedicated section of the documentation](https://wyfo.github.io/apischema/dev/difference_with_pydantic) — there are many differences.)

This library fulfills the following goals:

Expand All @@ -25,11 +25,11 @@ This library fulfills the following goals:
- be adaptable, provide tools to support any types (ORM, etc.);
- avoid dynamic things like using raw strings for attributes name - play nicely with your IDE.

No known alternative achieves all of this, and apischema is also [(a lot) faster](https://wyfo.github.io/apischema/0.18/optimizations_and_benchmark#benchmark) than all of them.
No known alternative achieves all of this, and apischema is also [(a lot) faster](https://wyfo.github.io/apischema/dev/optimizations_and_benchmark#benchmark) than all of them.

On top of that, because APIs are not only JSON, *apischema* is also a complete GraphQL library

> Actually, *apischema* is even adaptable enough to enable support of competitor libraries in a few dozens of line of code ([pydantic support example](https://wyfo.github.io/apischema/0.18/examples/pydantic_support) using [conversions feature](https://wyfo.github.io/apischema/0.18/conversions))
> Actually, *apischema* is even adaptable enough to enable support of competitor libraries in a few dozens of line of code ([pydantic support example](https://wyfo.github.io/apischema/dev/examples/pydantic_support) using [conversions feature](https://wyfo.github.io/apischema/dev/conversions))
## Example

Expand Down
5 changes: 2 additions & 3 deletions benchmark/benchmarks/pydantic.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from datetime import datetime
from typing import Optional, Type

import pydantic.generics
import pydantic
from common import Benchmark, Methods, Payment, to_camel_case


class CamelModel(pydantic.BaseModel):
class Config:
alias_generator = to_camel_case
model_config = pydantic.ConfigDict(alias_generator=to_camel_case)


class Message(CamelModel):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "apischema"
version = "0.18.1"
version = "0.19.0"
authors = [{ name = "Joseph Perez", email = "[email protected]" }]
license = { text = "MIT" }
description = "JSON (de)serialization, GraphQL and JSON schema generation using Python typing."
Expand Down
14 changes: 4 additions & 10 deletions scripts/generate_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@
ROOT_DIR = pathlib.Path(__file__).parent.parent
README = ROOT_DIR / "README.md"
INDEX = ROOT_DIR / "docs" / "index.md"
PYPROJECT = ROOT_DIR / "pyproject.toml"
QUICKSTART = ROOT_DIR / "examples" / "quickstart.py"

USED_FILES = {
str(path.relative_to(ROOT_DIR)) for path in (INDEX, PYPROJECT, QUICKSTART)
}
USED_FILES = {str(path.relative_to(ROOT_DIR)) for path in (INDEX, QUICKSTART)}


def main():
version_match = re.search(r"version = \"(\d+\.\d+)", PYPROJECT.read_text())
assert version_match is not None
version = version_match.group(1)
content = INDEX.read_text()
# Set title
content = re.sub(r"# Overview\s*## apischema", "# apischema", content)
Expand All @@ -30,7 +24,7 @@ def main():
content = content.replace(
r"<!--insert chart-->",
"\n".join(
f"![benchmark chart](https://wyfo.github.io/apischema/{version}/"
"![benchmark chart](https://wyfo.github.io/apischema/dev/"
f"benchmark_chart_{theme}#gh-{theme}-mode-only)"
for theme in ("light", "dark")
),
Expand All @@ -39,12 +33,12 @@ def main():
content = re.sub(r"<!--\n(\s*(.|\n)*?\s*)\n-->", lambda m: m.group(1), content)
# TODO remove this unused part?
content = re.sub(
r"(\d+\.\d+)/benchmark_chart\.svg", f"{version}/benchmark_chart.svg", content
r"(\d+\.\d+)/benchmark_chart\.svg", "dev/benchmark_chart.svg", content
)
# Rewrite links
content = re.sub(
r"\(([\w/]+)\.(md|svg)(#[\w-]+)?\)",
lambda m: f"(https://wyfo.github.io/apischema/{version}/{m.group(1)}"
lambda m: f"(https://wyfo.github.io/apischema/dev/{m.group(1)}"
+ (".svg" if m.group(2) == "svg" else "")
+ (m.group(3) or "")
+ ")",
Expand Down

0 comments on commit b153121

Please sign in to comment.