pydantic-i18n is an extension to support an i18n for the pydantic error messages.

Overview

pydantic-i18n

pydantic-i18n is an extension to support an i18n for the pydantic error messages.

Test Coverage Package version Code style: black Imports: isort


Documentation: https://pydantic-i18n.boardpack.org

Source Code: https://github.com/boardpack/pydantic-i18n


Requirements

Python 3.6+

pydantic-i18n has the next dependencies:

Installation

$ pip install pydantic-i18n

---> 100%

First steps

To start to work with pydantic-i18n, you can just create a dictionary (or create any needed translations storage and then convert it into dictionary) and pass to the main PydanticI18n class.

To translate messages, you need to pass result of exception.errors() call to the translate method:

from pydantic import BaseModel, ValidationError
from pydantic_i18n import PydanticI18n


translations = {
    "en_US": {
        "field required": "field required",
    },
    "de_DE": {
        "field required": "Feld erforderlich",
    },
}

tr = PydanticI18n(translations)


class User(BaseModel):
    name: str


try:
    User()
except ValidationError as e:
    translated_errors = tr.translate(e.errors(), locale="de_DE")

print(translated_errors)
# [
#     {
#         'loc': ('name',),
#         'msg': 'Feld erforderlich',
#         'type': 'value_error.missing'
#     }
# ]

(This script is complete, it should run "as is")

In the next chapters, you will see current available loaders and how to implement your own loader.

Usage with FastAPI

Here is a simple example usage with FastAPI.

Create it

Let's create a tr.py file:

str: return locale async def validation_exception_handler( request: Request, exc: RequestValidationError ) -> JSONResponse: current_locale = request.query_params.get("locale", DEFAULT_LOCALE) return JSONResponse( status_code=HTTP_422_UNPROCESSABLE_ENTITY, content={"detail": tr.translate(exc.errors(), current_locale)}, ) ">
from fastapi import Request
from fastapi.exceptions import RequestValidationError
from starlette.responses import JSONResponse
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY

from pydantic_i18n import PydanticI18n

__all__ = ["get_locale", "validation_exception_handler"]


DEFAULT_LOCALE = "en_US"

translations = {
    "en_US": {
        "field required": "field required",
    },
    "de_DE": {
        "field required": "Feld erforderlich",
    },
}

tr = PydanticI18n(translations)


def get_locale(locale: str = DEFAULT_LOCALE) -> str:
    return locale


async def validation_exception_handler(
    request: Request, exc: RequestValidationError
) -> JSONResponse:
    current_locale = request.query_params.get("locale", DEFAULT_LOCALE)
    return JSONResponse(
        status_code=HTTP_422_UNPROCESSABLE_ENTITY,
        content={"detail": tr.translate(exc.errors(), current_locale)},
    )

11-20: As you see, we selected the simplest variant to store translations, you can use any that you need.

23-24: To not include locale query parameter into every handler, we created a simple function get_locale, which we will include as a global dependency with Depends.

29-36: An example of overridden function to return translated messages of the validation exception.

Now we are ready to create a FastAPI application:

from fastapi import Depends, FastAPI, Request
from fastapi.exceptions import RequestValidationError

from pydantic import BaseModel

import tr

app = FastAPI(dependencies=[Depends(tr.get_locale)])

app.add_exception_handler(RequestValidationError, tr.validation_exception_handler)


class User(BaseModel):
    name: str


@app.post("/user", response_model=User)
def create_user(request: Request, user: User):
    pass

8: Add get_locale function as a global dependency.

!!! note If you need to use i18n only for specific part of your application, you can add this get_locale function to the specific APIRouter. More information about APIRouter you can find here.

10: Override default request validation error handler with validation_exception_handler.

Run it

Run the server with:

$ uvicorn main:app --reload

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [28720]
INFO:     Started server process [28722]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
About the command uvicorn main:app --reload...

The command uvicorn main:app refers to:

  • main: the file main.py (the Python "module").
  • app: the object created inside of main.py with the line app = FastAPI().
  • --reload: make the server restart after code changes. Only do this for development.

Send it

Open your browser at http://127.0.0.1:8000/docs#/default/create_user_user_post.

Send POST-request with empty body and de_DE locale query param via swagger UI or curl:

$ curl -X 'POST' \
  'http://127.0.0.1:8000/user?locale=de_DE' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
}'

Check it

As a result, you will get the next response body:

{
  "detail": [
    {
      "loc": [
        "body",
        "name"
      ],
      "msg": "Feld erforderlich",
      "type": "value_error.missing"
    }
  ]
}

If you don't mention the locale param, English locale will be used by default.

Get current error strings from Pydantic

pydantic-i18n doesn't provide prepared translations of all current error messages from pydantic, but you can use a special class method PydanticI18n.get_pydantic_messages to load original messages in English. By default, it returns a dict object:

from pydantic_i18n import PydanticI18n

print(PydanticI18n.get_pydantic_messages())
# {
#     "field required": "field required",
#     "extra fields not permitted": "extra fields not permitted",
#     "none is not an allowed value": "none is not an allowed value",
#     "value is not none": "value is not none",
#     "value could not be parsed to a boolean": "value could not be parsed to a boolean",
#     "byte type expected": "byte type expected",
#     .....
# }

(This script is complete, it should run "as is")

You can also choose JSON string or Babel format with output parameter values "json" and "babel":

from pydantic_i18n import PydanticI18n

print(PydanticI18n.get_pydantic_messages(output="json"))
# {
#     "field required": "field required",
#     "extra fields not permitted": "extra fields not permitted",
#     "none is not an allowed value": "none is not an allowed value",
#     .....
# }

print(PydanticI18n.get_pydantic_messages(output="babel"))
# msgid "field required"
# msgstr "field required"
#
# msgid "extra fields not permitted"
# msgstr "extra fields not permitted"
#
# msgid "none is not an allowed value"
# msgstr "none is not an allowed value"
# ....

(This script is complete, it should run "as is")

Loaders

pydantic-i18n provides a list of loaders to use translations.

DictLoader

DictLoader is the simplest loader and default in PydanticI18n. So you can just pass your translations dictionary without any other preparation steps.

from pydantic import BaseModel, ValidationError
from pydantic_i18n import PydanticI18n


translations = {
    "en_US": {
        "field required": "field required",
    },
    "de_DE": {
        "field required": "Feld erforderlich",
    },
}

tr = PydanticI18n(translations)


class User(BaseModel):
    name: str


try:
    User()
except ValidationError as e:
    translated_errors = tr.translate(e.errors(), locale="de_DE")

print(translated_errors)
# [
#     {
#         'loc': ('name',),
#         'msg': 'Feld erforderlich',
#         'type': 'value_error.missing'
#     }
# ]

(This script is complete, it should run "as is")

JsonLoader

JsonLoader needs to get the path to some directory with the next structure:


|-- translations
    |-- en_US.json
    |-- de_DE.json
    |-- ...

where e.g. en_US.json looks like:

{
    "field required": "field required"
}

and de_DE.json:

{
    "field required": "Feld erforderlich"
}

Then we can use JsonLoader to load our translations:

from pydantic import BaseModel, ValidationError
from pydantic_i18n import PydanticI18n, JsonLoader

loader = JsonLoader("./translations")
tr = PydanticI18n(loader)


class User(BaseModel):
    name: str


try:
    User()
except ValidationError as e:
    translated_errors = tr.translate(e.errors(), locale="de_DE")

print(translated_errors)
# [
#     {
#         'loc': ('name',),
#         'msg': 'Feld erforderlich',
#         'type': 'value_error.missing'
#     }
# ]

(This script is complete, it should run "as is")

BabelLoader

BabelLoader works in the similar way as JsonLoader. It also needs a translations directory with the next structure:


|-- translations
    |-- en_US
        |-- LC_MESSAGES
            |-- messages.mo
            |-- messages.po
    |-- de_DE
        |-- LC_MESSAGES
            |-- messages.mo
            |-- messages.po
    |-- ...

Information about translations preparation you can find on the Babel docs pages{:target="_blank"} and e.g. from this article{:target="_blank"}.

Here is an example of the BabelLoader usage:

from pydantic import BaseModel, ValidationError
from pydantic_i18n import PydanticI18n, BabelLoader

loader = BabelLoader("./translations")
tr = PydanticI18n(loader)


class User(BaseModel):
    name: str


try:
    User()
except ValidationError as e:
    translated_errors = tr.translate(e.errors(), locale="de")

print(translated_errors)
# [
#     {
#         'loc': ('name',),
#         'msg': 'Feld erforderlich',
#         'type': 'value_error.missing'
#     }
# ]

(This script is complete, it should run "as is")

Write your own loader

If current loaders aren't suitable for you, it's possible to write your own loader and use it with pydantic-i18n. To do it, you need to import BaseLoader and implement the next items:

  • property locales to get a list of locales;
  • method get_translations to get content for the specific locale.

In some cases you will also need to change implementation of the gettext method.

Here is an example of the loader to get translations from CSV files:

|-- translations
    |-- en_US.csv
    |-- de_DE.csv
    |-- ...

en_US.csv content:

field required,field required

de_DE.csv content:

field required,Feld erforderlich
Dict[str, str]: with open(os.path.join(self.directory, f"{locale}.csv")) as fp: data = dict(line.strip().split(",") for line in fp) return data class User(BaseModel): name: str if __name__ == '__main__': loader = CsvLoader("./translations") tr = PydanticI18n(loader) try: User() except ValidationError as e: translated_errors = tr.translate(e.errors(), locale="de") print(translated_errors) # [ # { # 'loc': ('name',), # 'msg': 'Feld erforderlich', # 'type': 'value_error.missing' # } # ] ">
import os
from typing import List, Dict

from pydantic import BaseModel, ValidationError
from pydantic_i18n import PydanticI18n, BaseLoader


class CsvLoader(BaseLoader):
    def __init__(self, directory: str):
        self.directory = directory

    @property
    def locales(self) -> List[str]:
        return [
            filename[:-4]
            for filename in os.listdir(self.directory)
            if filename.endswith(".csv")
        ]

    def get_translations(self, locale: str) -> Dict[str, str]:
        with open(os.path.join(self.directory, f"{locale}.csv")) as fp:
            data = dict(line.strip().split(",") for line in fp)

        return data


class User(BaseModel):
    name: str


if __name__ == '__main__':
    loader = CsvLoader("./translations")
    tr = PydanticI18n(loader)

    try:
        User()
    except ValidationError as e:
        translated_errors = tr.translate(e.errors(), locale="de")

    print(translated_errors)
    # [
    #     {
    #         'loc': ('name',),
    #         'msg': 'Feld erforderlich',
    #         'type': 'value_error.missing'
    #     }
    # ]

(This script is complete, it should run "as is")

Acknowledgments

Thanks to Samuel Colvin and his pydantic library.

Also, thanks to Sebastián Ramírez and his FastAPI project, some scripts and documentation structure and parts were used from there.

License

This project is licensed under the terms of the MIT license.

Comments
  • ⬆ Bump actions/setup-python from 3 to 4

    ⬆ Bump actions/setup-python from 3 to 4

    Bumps actions/setup-python from 3 to 4.

    Release notes

    Sourced from actions/setup-python's releases.

    v4.0.0

    What's Changed

    • Support for python-version-file input: #336

    Example of usage:

    - uses: actions/[email protected]
      with:
        python-version-file: '.python-version' # Read python version from a file
    - run: python my_script.py
    

    There is no default python version for this setup-python major version, the action requires to specify either python-version input or python-version-file input. If the python-version input is not specified the action will try to read required version from file from python-version-file input.

    • Use pypyX.Y for PyPy python-version input: #349

    Example of usage:

    - uses: actions/[email protected]
      with:
        python-version: 'pypy3.9' # pypy-X.Y kept for backward compatibility
    - run: python my_script.py
    
    • RUNNER_TOOL_CACHE environment variable is equal AGENT_TOOLSDIRECTORY: #338

    • Bugfix: create missing pypyX.Y symlinks: #347

    • PKG_CONFIG_PATH environment variable: #400

    • Added python-path output: #405 python-path output contains Python executable path.

    • Updated zeit/ncc to vercel/ncc package: #393

    • Bugfix: fixed output for prerelease version of poetry: #409

    • Made pythonLocation environment variable consistent for Python and PyPy: #418

    • Bugfix for 3.x-dev syntax: #417

    • Other improvements: #318 #396 #384 #387 #388

    Update actions/cache version to 2.0.2

    In scope of this release we updated actions/cache package as the new version contains fixes related to GHES 3.5 (actions/setup-python#382)

    Add "cache-hit" output and fix "python-version" output for PyPy

    This release introduces new output cache-hit (actions/setup-python#373) and fix python-version output for PyPy (actions/setup-python#365)

    The cache-hit output contains boolean value indicating that an exact match was found for the key. It shows that the action uses already existing cache or not. The output is available only if cache is enabled.

    ... (truncated)

    Commits
    • d09bd5e fix: 3.x-dev can install a 3.y version (#417)
    • f72db17 Made env.var pythonLocation consistent for Python and PyPy (#418)
    • 53e1529 add support for python-version-file (#336)
    • 3f82819 Fix output for prerelease version of poetry (#409)
    • 397252c Update zeit/ncc to vercel/ncc (#393)
    • de977ad Merge pull request #412 from vsafonkin/v-vsafonkin/fix-poetry-cache-test
    • 22c6af9 Change PyPy version to rebuild cache
    • 081a3cf Merge pull request #405 from mayeut/interpreter-path
    • ff70656 feature: add a python-path output
    • fff15a2 Use pypyX.Y for PyPy python-version input (#349)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 5
  • ⬆ Bump actions/cache from 2 to 3

    ⬆ Bump actions/cache from 2 to 3

    Bumps actions/cache from 2 to 3.

    Release notes

    Sourced from actions/cache's releases.

    v3.0.0

    • This change adds a minimum runner version(node12 -> node16), which can break users using an out-of-date/fork of the runner. This would be most commonly affecting users on GHES 3.3 or before, as those runners do not support node16 actions and they can use actions from github.com via github connect or manually copying the repo to their GHES instance.

    • Few dependencies and cache action usage examples have also been updated.

    v2.1.7

    Support 10GB cache upload using the latest version 1.0.8 of @actions/cache

    v2.1.6

    • Catch unhandled "bad file descriptor" errors that sometimes occurs when the cache server returns non-successful response (actions/cache#596)

    v2.1.5

    • Fix permissions error seen when extracting caches with GNU tar that were previously created using BSD tar (actions/cache#527)

    v2.1.4

    • Make caching more verbose #650
    • Use GNU tar on macOS if available #701

    v2.1.3

    • Upgrades @actions/core to v1.2.6 for CVE-2020-15228. This action was not using the affected methods.
    • Fix error handling in uploadChunk where 400-level errors were not being detected and handled correctly

    v2.1.2

    • Adds input to limit the chunk upload size, useful for self-hosted runners with slower upload speeds
    • No-op when executing on GHES

    v2.1.1

    • Update @actions/cache package to v1.0.2 which allows cache action to use posix format when taring files.

    v2.1.0

    • Replaces the http-client with the Azure Storage SDK for NodeJS when downloading cache content from Azure. This should help improve download performance and reliability as the SDK downloads files in 4 MB chunks, which can be parallelized and retried independently
    • Display download progress and speed
    Changelog

    Sourced from actions/cache's changelog.

    Releases

    3.0.0

    • Updated minimum runner version support from node 12 -> node 16

    3.0.1

    • Added support for caching from GHES 3.5.
    • Fixed download issue for files > 2GB during restore.
    Commits
    • 48af2dc Update actions/cache version (#786)
    • f63a711 Merge pull request #781 from actions/t-dedah/cacheSize
    • 770a27c Update licenses
    • c2131ab New build
    • 5751604 Updated @​actions/cache to 2.0.1
    • 136d96b Enabling actions/cache for GHES based on presence of AC service (#774)
    • 7d4f40b Bumping up the version to fix download issue for files > 2 GB. (#775)
    • 2d8d0d1 Updated what's new. (#771)
    • 7799d86 Updated the usage and docs to the major version release. (#770)
    • 4b0cf6c Merge pull request #769 from actions/users/ashwinsangem/bump_major_version
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 5
  • ⬆ Bump actions/upload-artifact from 2 to 3

    ⬆ Bump actions/upload-artifact from 2 to 3

    Bumps actions/upload-artifact from 2 to 3.

    Release notes

    Sourced from actions/upload-artifact's releases.

    v3.0.0

    What's Changed

    • Update default runtime to node16 (#293)
    • Update package-lock.json file version to 2 (#302)

    Breaking Changes

    With the update to Node 16, all scripts will now be run with Node 16 rather than Node 12.

    v2.3.1

    Fix for empty fails on Windows failing on upload #281

    v2.3.0 Upload Artifact

    • Optimizations for faster uploads of larger files that are already compressed
    • Significantly improved logging when there are chunked uploads
    • Clarifications in logs around the upload size and prohibited characters that aren't allowed in the artifact name or any uploaded files
    • Various other small bugfixes & optimizations

    v2.2.4

    • Retry on HTTP 500 responses from the service

    v2.2.3

    • Fixes for proxy related issues

    v2.2.2

    • Improved retryability and error handling

    v2.2.1

    • Update used actions/core package to the latest version

    v2.2.0

    • Support for artifact retention

    v2.1.4

    • Add Third Party License Information

    v2.1.3

    • Use updated version of the @action/artifact NPM package

    v2.1.2

    • Increase upload chunk size from 4MB to 8MB
    • Detect case insensitive file uploads

    v2.1.1

    • Fix for certain symlinks not correctly being identified as directories before starting uploads

    v2.1.0

    • Support for uploading artifacts with multiple paths
    • Support for using exclude paths
    • Updates to dependencies

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 5
  • ⬆ Bump nwtgck/actions-netlify from 1.2.2 to 1.2.3

    ⬆ Bump nwtgck/actions-netlify from 1.2.2 to 1.2.3

    Bumps nwtgck/actions-netlify from 1.2.2 to 1.2.3.

    Changelog

    Sourced from nwtgck/actions-netlify's changelog.

    [1.2.3] - 2021-12-20

    Changed

    • Update dependencies
    Commits
    • b7c1504 Merge branch 'release/1.2.3'
    • e9f9459 bump: 1.2.3
    • c200daf deps: update again
    • 8e29fc7 deps: update
    • 9612c43 Actions build/nwtgck dependabot/npm and yarn/actions/core 1.6.0 (#707)
    • add97a2 Actions build/nwtgck dependabot/npm and yarn/vercel/ncc 0.33.1 (#706)
    • df95b37 Actions build/nwtgck dependabot/npm and yarn/path parse 1.0.7 (#617)
    • efc0859 Upgrade to GitHub-native Dependabot (#525)
    • 5fb99fa chore(deps-dev): bump eslint-plugin-jest from 24.3.7 to 24.4.0 (#610)
    • 8edd0b1 chore(deps-dev): bump @​types/node from 12.20.13 to 12.20.16 (#609)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 4
  • ⬆ Bump dawidd6/action-download-artifact from 2.15.0 to 2.16.0

    ⬆ Bump dawidd6/action-download-artifact from 2.15.0 to 2.16.0

    Bumps dawidd6/action-download-artifact from 2.15.0 to 2.16.0.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 4
  • Problems with enum validation messages

    Problems with enum validation messages

    Describe the bug

    I have a schema that checks various fields against enums. When I feed it an invalid value in one of those fields, I get the following traceback:

    api2_1             | Traceback (most recent call last):
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
    api2_1             |     result = await app(self.scope, self.receive, self.send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    api2_1             |     return await self.app(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 146, in __call__
    api2_1             |     await super().__call__(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 102, in __call__
    api2_1             |     await self.middleware_stack(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    api2_1             |     raise exc from None
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    api2_1             |     await self.app(scope, receive, _send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    api2_1             |     return await self.app(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 84, in __call__
    api2_1             |     await self.simple_response(scope, receive, send, request_headers=headers)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 140, in simple_response
    api2_1             |     await self.app(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    api2_1             |     raise exc from None
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    api2_1             |     await self.app(scope, receive, sender)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 550, in __call__
    api2_1             |     await route.handle(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    api2_1             |     await self.app(scope, receive, send)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    api2_1             |     response = await func(request)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 196, in app
    api2_1             |     raw_response = await run_endpoint_function(
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 150, in run_endpoint_function
    api2_1             |     return await run_in_threadpool(dependant.call, **values)
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
    api2_1             |     return await loop.run_in_executor(None, func, *args)
    api2_1             |   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    api2_1             |     result = self.fn(*self.args, **self.kwargs)
    api2_1             |   File "./studies/router.py", line 73, in upload_studies_with_csv
    api2_1             |     return controller.crud.upload_studies_with_csv(
    api2_1             |   File "./studies/controller.py", line 356, in upload_studies_with_csv
    api2_1             |     all_errors.append(_csv_line_error(idx, tr.translate(e.errors(), locale="es_AR").json(), row))
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/pydantic_i18n/main.py", line 25, in translate
    api2_1             |     return [
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/pydantic_i18n/main.py", line 28, in <listcomp>
    api2_1             |     "msg": self.source.gettext(error["msg"], locale),
    api2_1             |   File "/usr/local/lib/python3.8/site-packages/pydantic_i18n/loaders.py", line 29, in gettext
    api2_1             |     return data[key]
    api2_1             | KeyError: "value is not a valid enumeration member; permitted: '9_to_12', '12_to_15', '14_to_18'"
    

    The KeyError is to be expected, because i'm not getting anything similar when I ask for the full dict of possible translations. I've linted this response for ease of reading, otherwise it's as is from the method call:

    >>> print(PydanticI18n.get_pydantic_messages())
    {
          'field required': 'field required',
          'extra fields not permitted': 'extra fields not permitted',
          'none is not an allowed value': 'none is not an allowed value',
          'value is not none': 'value is not none',
          'value is not None': 'value is not None',
          'value could not be parsed to a boolean': 'value could not be parsed to a boolean',
          'byte type expected': 'byte type expected',
          'value is not a valid dict': 'value is not a valid dict',
          'value is not a valid email address': 'value is not a valid email address',
          'invalid or missing URL scheme': 'invalid or missing URL scheme',
          'URL scheme not permitted': 'URL scheme not permitted',
          'userinfo required in URL but missing': 'userinfo required in URL but missing',
          'URL host invalid': 'URL host invalid',
          'URL host invalid, top level domain required': 'URL host invalid, top level domain required',
          'URL port invalid, port cannot exceed 65535': 'URL port invalid, port cannot exceed 65535',
          'URL invalid, extra characters found after valid URL: {extra!r}': 'URL invalid, extra characters found after valid URL: {extra!r}',
          '{value} is not a valid Enum instance': '{value} is not a valid Enum instance',
          '{value} is not a valid IntEnum instance': '{value} is not a valid IntEnum instance',
          'value is not a valid integer': 'value is not a valid integer',
          'value is not a valid float': 'value is not a valid float',
          'value is not a valid path': 'value is not a valid path',
          'file or directory at path "{path}" does not exist': 'file or directory at path "{path}" does not exist',
          'path "{path}" does not point to a file': 'path "{path}" does not point to a file',
          'path "{path}" does not point to a directory': 'path "{path}" does not point to a directory',
          'ensure this value contains valid import path or valid callable: {error_message}': 'ensure this value contains valid import path or valid callable: {error_message}',
          'value is not a valid sequence': 'value is not a valid sequence',
          'value is not a valid list': 'value is not a valid list',
          'value is not a valid set': 'value is not a valid set',
          'value is not a valid frozenset': 'value is not a valid frozenset',
          'value is not a valid tuple': 'value is not a valid tuple',
          'wrong tuple length {actual_length}, expected {expected_length}': 'wrong tuple length {actual_length}, expected {expected_length}',
          'ensure this value has at least {limit_value} items': 'ensure this value has at least {limit_value} items',
          'ensure this value has at most {limit_value} items': 'ensure this value has at most {limit_value} items',
          'ensure this value has at least {limit_value} characters': 'ensure this value has at least {limit_value} characters',
          'ensure this value has at most {limit_value} characters': 'ensure this value has at most {limit_value} characters',
          'str type expected': 'str type expected',
          'string does not match regex "{pattern}"': 'string does not match regex "{pattern}"',
          'ensure this value is greater than {limit_value}': 'ensure this value is greater than {limit_value}',
          'ensure this value is greater than or equal to {limit_value}': 'ensure this value is greater than or equal to {limit_value}',
          'ensure this value is less than {limit_value}': 'ensure this value is less than {limit_value}',
          'ensure this value is less than or equal to {limit_value}': 'ensure this value is less than or equal to {limit_value}',
          'ensure this value is a multiple of {multiple_of}': 'ensure this value is a multiple of {multiple_of}',
          'value is not a valid decimal': 'value is not a valid decimal',
          'ensure that there are no more than {max_digits} digits in total': 'ensure that there are no more than {max_digits} digits in total',
          'ensure that there are no more than {decimal_places} decimal places': 'ensure that there are no more than {decimal_places} decimal places',
          'ensure that there are no more than {whole_digits} digits before the decimal point': 'ensure that there are no more than {whole_digits} digits before the decimal point',
          'invalid datetime format': 'invalid datetime format',
          'invalid date format': 'invalid date format',
          'invalid time format': 'invalid time format',
          'invalid duration format': 'invalid duration format',
          'value is not a valid hashable': 'value is not a valid hashable',
          'value is not a valid uuid': 'value is not a valid uuid',
          'uuid version {required_version} expected': 'uuid version {required_version} expected',
          'instance of {expected_arbitrary_type} expected': 'instance of {expected_arbitrary_type} expected',
          'a class is expected': 'a class is expected',
          'subclass of {expected_class} expected': 'subclass of {expected_class} expected',
          'Invalid JSON': 'Invalid JSON',
          'JSON object must be str, bytes or bytearray': 'JSON object must be str, bytes or bytearray',
          'Invalid regular expression': 'Invalid regular expression',
          'instance of {class_name}, tuple or dict expected': 'instance of {class_name}, tuple or dict expected',
          '{value} is not callable': '{value} is not callable',
          'value is not a valid IPv4 or IPv6 address': 'value is not a valid IPv4 or IPv6 address',
          'value is not a valid IPv4 or IPv6 interface': 'value is not a valid IPv4 or IPv6 interface',
          'value is not a valid IPv4 or IPv6 network': 'value is not a valid IPv4 or IPv6 network',
          'value is not a valid IPv4 address': 'value is not a valid IPv4 address',
          'value is not a valid IPv6 address': 'value is not a valid IPv6 address',
          'value is not a valid IPv4 network': 'value is not a valid IPv4 network',
          'value is not a valid IPv6 network': 'value is not a valid IPv6 network',
          'value is not a valid IPv4 interface': 'value is not a valid IPv4 interface',
          'value is not a valid IPv6 interface': 'value is not a valid IPv6 interface',
          'value is not a valid color: {reason}': 'value is not a valid color: {reason}',
          'value is not a valid boolean': 'value is not a valid boolean',
          'card number is not all digits': 'card number is not all digits',
          'card number is not luhn valid': 'card number is not luhn valid',
          'Length for a {brand} card must be {required_length}': 'Length for a {brand} card must be {required_length}',
          'could not parse value and unit from byte string': 'could not parse value and unit from byte string',
          'could not interpret byte unit: {unit}': 'could not interpret byte unit: {unit}'
    }
    

    I've tried adding a line in the spirit of "value is not a valid enumeration member; permitted: {permitted}": "value is not a valid enumeration member; permitted: {permitted}", both in my english and my translation dict, but that didn't work either. I hope I'm missing something silly in my config, because this package looks really handy for what we're doing! 😄

    To Reproduce

    Here's a little script that reproduces the issue:

    from enum import Enum
    from pydantic import BaseModel, ValidationError
    from pydantic_i18n import PydanticI18n
    
    class ACoolEnum(Enum):
        NINE_TO_TWELVE = "9_to_12"
        TWELVE_TO_FIFTEEN = "12_to_15"
        FOURTEEN_TO_EIGHTEEN = "14_to_18"
    
    class CoolSchema(BaseModel):
        enum_field: ACoolEnum
    
    
    translations = {
        "en_US": {
          "value is not a valid enumeration member; permitted: {permitted}": "value is not a valid enumeration member; permitted: {permitted}",
        },
        "es_AR": {
            "value is not a valid enumeration member; permitted: {permitted}": "el valor no es uno de los valores permitidos, que son: {permitted}",
        },
    }
    
    tr = PydanticI18n(translations)
    CoolSchema(enum_field="9_to_12")
    print("passed a valid value just fine!")
    
    try:
        CoolSchema(enum_field="super invalid value")
    except ValidationError as e:
        translated_errors = tr.translate(e.errors(), locale="es_AR")
    
    

    Environment

    • OS: macOS
    • pydantic-i18n version: 0.1.1
    • Python version: 3.8.2
    bug 
    opened by pyritewolf 4
  • ⬆ Bump isort from 5.11.2 to 5.11.3

    ⬆ Bump isort from 5.11.2 to 5.11.3

    Bumps isort from 5.11.2 to 5.11.3.

    Release notes

    Sourced from isort's releases.

    5.11.3

    Changes

    :beetle: Fixes

    :construction_worker: Continuous Integration

    v5.11.3

    Changes

    :beetle: Fixes

    :construction_worker: Continuous Integration

    Changelog

    Sourced from isort's changelog.

    5.11.3 December 16 2022

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 3
  • ⬆ Bump isort from 5.10.1 to 5.11.1

    ⬆ Bump isort from 5.10.1 to 5.11.1

    Bumps isort from 5.10.1 to 5.11.1.

    Release notes

    Sourced from isort's releases.

    5.11.1

    Changes December 12 2022

    :beetle: Fixes

    5.11.0

    Changes December 12 2022

    :construction_worker: Continuous Integration

    :package: Dependencies

    Changelog

    Sourced from isort's changelog.

    5.11.1 December 12 2022

    5.11.0 December 12 2022

    Commits
    • f8146c5 Merge pull request #2033 from PyCQA/hotfix/5.11.1
    • dd01cfe Hotfix 5.11.1
    • 68f0a25 Merge pull request #2032 from tomaarsen/hotfix/colorama_nameerror
    • c752a6c Only call colorama.init if colorama is available
    • 6525008 Merge pull request #2030 from PyCQA/example/update-formatting-pluging-isort-5...
    • 6c5a36c Bump formatting plugin to 0.1.1
    • 657ed81 Merge pull request #2029 from PyCQA/example/update-formatting-pluging-isort-5...
    • 84e3687 Update isort on formatting pluging to 5.11.0
    • 3e99c22 Merge pull request #2028 from PyCQA/prepare-release-5.11.0
    • 8af078c Upgrade poetry to 1.3.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 3
  • ⬆ Bump dawidd6/action-download-artifact from 2.17.0 to 2.24.0

    ⬆ Bump dawidd6/action-download-artifact from 2.17.0 to 2.24.0

    Bumps dawidd6/action-download-artifact from 2.17.0 to 2.24.0.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 3
  • ⬆ Bump codecov/codecov-action from 2.1.0 to 3.1.1

    ⬆ Bump codecov/codecov-action from 2.1.0 to 3.1.1

    Bumps codecov/codecov-action from 2.1.0 to 3.1.1.

    Release notes

    Sourced from codecov/codecov-action's releases.

    3.1.1

    What's Changed

    New Contributors

    Full Changelog: https://github.com/codecov/codecov-action/compare/v3.1.0...v3.1.1

    v3.1.0

    3.1.0

    Features

    ... (truncated)

    Changelog

    Sourced from codecov/codecov-action's changelog.

    3.1.1

    Fixes

    • #661 Update deprecation warning
    • #593 Create codeql-analysis.yml
    • #712 README: fix typo
    • #725 fix: Remove a blank row
    • #726 Update README.md with correct badge version
    • #633 Create scorecards-analysis.yml
    • #747 fix: add more verbosity to validation
    • #750 Regenerate scorecards-analysis.yml
    • #774 Switch to v3
    • #783 Fix network entry in table
    • #791 Trim arguments after splitting them
    • #769 Plumb failCi into verification function.

    Dependencies

    • #713 build(deps-dev): bump typescript from 4.6.3 to 4.6.4
    • #714 build(deps): bump node-fetch from 3.2.3 to 3.2.4
    • #724 build(deps): bump github/codeql-action from 1 to 2
    • #717 build(deps-dev): bump @​types/jest from 27.4.1 to 27.5.0
    • #729 build(deps-dev): bump @​types/node from 17.0.25 to 17.0.33
    • #734 build(deps-dev): downgrade @​types/node to 16.11.35
    • #723 build(deps): bump actions/checkout from 2 to 3
    • #733 build(deps): bump @​actions/github from 5.0.1 to 5.0.3
    • #732 build(deps): bump @​actions/core from 1.6.0 to 1.8.2
    • #737 build(deps-dev): bump @​types/node from 16.11.35 to 16.11.36
    • #749 build(deps): bump ossf/scorecard-action from 1.0.1 to 1.1.0
    • #755 build(deps-dev): bump typescript from 4.6.4 to 4.7.3
    • #759 build(deps-dev): bump @​types/node from 16.11.36 to 16.11.39
    • #762 build(deps-dev): bump @​types/node from 16.11.39 to 16.11.40
    • #746 build(deps-dev): bump @​vercel/ncc from 0.33.4 to 0.34.0
    • #757 build(deps): bump ossf/scorecard-action from 1.1.0 to 1.1.1
    • #760 build(deps): bump openpgp from 5.2.1 to 5.3.0
    • #748 build(deps): bump actions/upload-artifact from 2.3.1 to 3.1.0
    • #766 build(deps-dev): bump typescript from 4.7.3 to 4.7.4
    • #799 build(deps): bump openpgp from 5.3.0 to 5.4.0
    • #798 build(deps): bump @​actions/core from 1.8.2 to 1.9.1

    3.1.0

    Features

    • #699 Incorporate xcode arguments for the Codecov uploader

    Dependencies

    • #694 build(deps-dev): bump @​vercel/ncc from 0.33.3 to 0.33.4
    • #696 build(deps-dev): bump @​types/node from 17.0.23 to 17.0.25
    • #698 build(deps-dev): bump jest-junit from 13.0.0 to 13.2.0

    3.0.0

    Breaking Changes

    • #689 Bump to node16 and small fixes

    ... (truncated)

    Commits
    • d9f34f8 release: update changelog and version to 3.1.1 (#828)
    • 0e9e7b4 Plumb failCi into verification function. (#769)
    • 7f20bd4 build(deps): bump @​actions/core from 1.8.2 to 1.9.1 (#798)
    • 13bc253 build(deps): bump openpgp from 5.3.0 to 5.4.0 (#799)
    • 5c0da1b Trim arguments after splitting them (#791)
    • 68d5f6d Fix network entry in table (#783)
    • 2a829b9 Switch to v3 (#774)
    • 8e09eaf build(deps-dev): bump typescript from 4.7.3 to 4.7.4 (#766)
    • 39e2229 build(deps): bump actions/upload-artifact from 2.3.1 to 3.1.0 (#748)
    • b2b7703 build(deps): bump openpgp from 5.2.1 to 5.3.0 (#760)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 3
  • Babel is not optional

    Babel is not optional

    When you ignore babel dependency - whole project startup will fail.

    This line will try to import babel loader https://github.com/boardpack/pydantic-i18n/blob/master/pydantic_i18n/init.py#L7

    This line will burn application: https://github.com/boardpack/pydantic-i18n/blob/master/pydantic_i18n/loaders.py#L5

    Please do not mark dependencies as optional, while they are not!

    bug 
    opened by tigrus 3
  • ⬆ Bump dawidd6/action-download-artifact from 2.24.2 to 2.24.3

    ⬆ Bump dawidd6/action-download-artifact from 2.24.2 to 2.24.3

    Bumps dawidd6/action-download-artifact from 2.24.2 to 2.24.3.

    Commits
    • bd10f38 Merge pull request #218 from dawidd6/dependabot-npm_and_yarn-adm-zip-0.5.10
    • 61a654a build(deps): bump adm-zip from 0.5.9 to 0.5.10
    • dcadc4b Merge pull request #211 from koplo199/master
    • ceeb280 Remove unnecessary semicolon
    • 806bb52 Catch 'Artifact has expired' error
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies github_actions 
    opened by dependabot[bot] 1
  • ⬆ Bump mkdocs-material from 8.5.11 to 9.0.2

    ⬆ Bump mkdocs-material from 8.5.11 to 9.0.2

    Bumps mkdocs-material from 8.5.11 to 9.0.2.

    Release notes

    Sourced from mkdocs-material's releases.

    mkdocs-material-9.0.2

    • Fixed #4823: Improved contrast ratio in footer to meet WCAG guidelines
    • Fixed #4819: Social plugin crashes when card generation is disabled
    • Fixed #4817: Search plugin crashes on numeric page titles in nav

    mkdocs-material-9.0.1

    • Removed pipdeptree dependency for built-in info plugin
    • Fixed appearance of linked tags when hovered (9.0.0 regression)
    • Fixed #4810: Abbreviations run out of screen on touch devices
    • Fixed #4813: View source and edit button links are the same

    mkdocs-material-9.0.0

    Additions and improvements

    • Added support for rich search previews
    • Added support for tokenizer lookahead
    • Added support for better search highlighting
    • Added support for excluding content from search
    • Added support for configurable search pipeline
    • Added support for offline search via offline plugin
    • Added support for multiple instances of built-in tags plugin
    • Added support for removing copy-to-clipboard button
    • Added support for removing footer navigation
    • Added support for button to view the source of a page
    • Improved readability of query string for search sharing
    • Improved stability of search plugin when using --dirtyreload
    • Improved search result group button, now sticky and stable
    • Updated Norwegian translations
    • Updated MkDocs to 1.4.2

    Removals

    • Removed deprecated alternative admonition qualifiers
    • Removed :is() selectors (in output) for easier overriding
    • Removed .title suffix on translations
    • Removed legacy method for providing page title in feedback URL
    • Removed support for indexing only titles in search
    • Removed support for custom search transforms
    • Removed support for custom search workers
    • Removed temporary snow feature (easter egg)

    Fixes

    • Fixed Norwegian and Korean language code
    • Fixed detection of composition events in search interface
    • Fixed search plugin not using title set via front matter
    • Fixed search highlighting of tags
    • Fixed search sharing URL using post transformed string
    • Fixed theme-color meta tag getting out-of-sync with palette toggle
    • Fixed prev/next page keyboard navigation when footer is not present

    ... (truncated)

    Changelog

    Sourced from mkdocs-material's changelog.

    mkdocs-material-9.0.2 (2022-01-04)

    • Fixed #4823: Improved contrast ratio in footer to meet WCAG guidelines
    • Fixed #4819: Social plugin crashes when card generation is disabled
    • Fixed #4817: Search plugin crashes on numeric page titles in nav

    mkdocs-material-9.0.1 (2022-01-03)

    • Removed pipdeptree dependency for built-in info plugin
    • Fixed appearance of linked tags when hovered (9.0.0 regression)
    • Fixed #4810: Abbreviations run out of screen on touch devices
    • Fixed #4813: View source and edit button links are the same

    mkdocs-material-9.0.0 (2023-01-02)

    Additions and improvements

    • Added support for rich search previews
    • Added support for tokenizer lookahead
    • Added support for better search highlighting
    • Added support for excluding content from search
    • Added support for configurable search pipeline
    • Added support for offline search via offline plugin
    • Added support for multiple instances of built-in tags plugin
    • Added support for removing copy-to-clipboard button
    • Added support for removing footer navigation
    • Added support for button to view the source of a page
    • Improved readability of query string for search sharing
    • Improved stability of search plugin when using --dirtyreload
    • Improved search result group button, now sticky and stable
    • Updated Norwegian translations
    • Updated MkDocs to 1.4.2

    Removals

    • Removed deprecated alternative admonition qualifiers
    • Removed :is() selectors (in output) for easier overriding
    • Removed .title suffix on translations
    • Removed legacy method for providing page title in feedback URL
    • Removed support for indexing only titles in search
    • Removed support for custom search transforms
    • Removed support for custom search workers
    • Removed temporary snow feature (easter egg)

    Fixes

    • Fixed Norwegian and Korean language code
    • Fixed detection of composition events in search interface
    • Fixed search plugin not using title set via front matter
    • Fixed search highlighting of tags

    ... (truncated)

    Upgrade guide

    Sourced from mkdocs-material's upgrade guide.

    How to upgrade

    Upgrade to the latest version with:

    pip install --upgrade --force-reinstall mkdocs-material
    

    Show the currently installed version with:

    pip show mkdocs-material
    

    Upgrading from 8.x to 9.x

    This major release includes a brand new search implementation that is faster and allows for rich previews, advanced tokenization and better highlighting. It was available as part of Insiders for over a year, and now that the funding goal was hit, makes its way into the community edition.

    Changes to mkdocs.yml

    content.code.copy

    The copy-to-clipboard buttons are now opt-in and can be enabled or disabled per block. If you wish to enable them for all code blocks, add the following lines to mkdocs.yml:

    theme:
      features:
        - content.code.copy
    

    content.action.*

    A "view source" button can be shown next to the "edit this page" button, both of which must now be explicitly enabled. Add the following lines to mkdocs.yml:

    theme:
      features:
        - content.action.edit
        - content.action.view
    

    navigation.footer

    ... (truncated)

    Commits
    • 9df1bee Merge pull request #4826 from squidfunk/dependabot/npm_and_yarn/json5-1.0.2
    • 7ca35b9 Bump json5 from 1.0.1 to 1.0.2
    • f8a3e83 Prepare 9.0.2 release
    • 157b4f2 Updated distribution files
    • bc8a070 Merge branch 'master' of github.com:squidfunk/mkdocs-material
    • 38e2914 Improved contrast ratio in footer to meet WCAG guidelines
    • b007fbb Documentation (#4825)
    • c8fb426 Fixed crashing of social plugin when cards are disabled
    • 491bd0a Fixed wrong content.action.* feature flags
    • 4548afb Fixed search plugin crashing on page titles
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 0
Releases(0.3.0)
Owner
Boardpack
Dashboard pack: forms validation and rendering, dashboard generation, tutorials, and more.
Boardpack
Vector space based Information Retrieval System for Text Processing - Information retrieval

Information Retrieval: Text Processing Group 13 Sequence of operations Install Requirements Add given wikipedia files to the corpus directory. Downloa

1 Jan 01, 2022
A Python library that provides an easy way to identify devices like mobile phones, tablets and their capabilities by parsing (browser) user agent strings.

Python User Agents user_agents is a Python library that provides an easy way to identify/detect devices like mobile phones, tablets and their capabili

Selwin Ong 1.3k Dec 22, 2022
Convert text to morse code and play morse code sound.

Convert text(english) to morse codes and play morse sound!

Mohammad Dori 5 Jul 15, 2022
Making simplex testing clean and simple

Making Simplex Project Testing - Clean and Simple What does this repo do? It organizes the python stack for the coding project What do I need to do in

Mohit Mahajan 1 Jan 30, 2022
The Scary Story - A Text Adventure

This is a text adventure which I made in python 3. This is one of my first big projects so any feedback would be greatly appreciated.

2 Feb 20, 2022
The app gets your sutitle.srt and proccess it to extract sentences

DubbingAssistants This app gets your sutitle.srt and proccess it to extract sentences, and also find Start time and End time of them. Step 1: install

Ali Booresh 1 Jan 04, 2022
Open-source linguistic ethnography tool for framing public opinion in mediatized groups.

Open-source linguistic ethnography tool for framing public opinion in mediatized groups. Table of Contents Installing Quickstart Links Installing Pyth

Qualichat 7 Jun 02, 2022
utoken is a multilingual tokenizer that divides text into words, punctuation and special tokens such as numbers, URLs, XML tags, email-addresses and hashtags.

utoken utoken is a multilingual tokenizer that divides text into words, punctuation and special tokens such as numbers, URLs, XML tags, email-addresse

Ulf Hermjakob 11 Jan 05, 2023
Python port of Google's libphonenumber

phonenumbers Python Library This is a Python port of Google's libphonenumber library It supports Python 2.5-2.7 and Python 3.x (in the same codebase,

David Drysdale 3.1k Dec 29, 2022
Code Jam for creating a text-based adventure game engine and custom worlds

Text Based Adventure Jam Author: Devin McIntyre Our goal is two-fold: Create a text based adventure game engine that can parse a standard file format

HTTPChat 4 Dec 26, 2021
Format Covid values to ASCII-Table (Only for Germany and Austria)

Covid-19-Formatter (Only for Germany and Austria) Dieses Script speichert die gemeldeten Daten des RKIs / BMSGPK und formatiert diese zu einer Asci Ta

56 Jan 22, 2022
A simple Python module for parsing human names into their individual components

Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff

Derek Gulbranson 574 Dec 20, 2022
A Python app which can convert normal text to Handwritten text.

Text to HandWritten Text ✍️ Converter Watch Tutorial for this project Usage:- Clone my repository. Open CMD in working directory. Run following comman

Kushal Bhavsar 5 Dec 11, 2022
strbind - lapidary text converter for translate an text file to the C-style string

strbind strbind - lapidary text converter for translate an text file to the C-style string. My motivation is fast adding large text chunks to the C co

Mihail Zaytsev 1 Oct 22, 2021
Simple python program to auto credit your code, text, book, whatever!

Credit Simple python program to auto credit your code, text, book, whatever! Setup First change credit_text to whatever text you would like to credit

Hashm 1 Jan 29, 2022
A neat little program to read the text from the "All Ten Fingers" program, and write them back.

ATFTyper A neat little program to read the text from the "All Ten Fingers" program, and write them back. How does it work? This program uses the Pillo

1 Nov 26, 2021
Goblin-sim - Procedural fantasy world generator

goblin-sim This project is an attempt to create a procedural goblin fantasy worl

3 May 18, 2022
The Levenshtein Python C extension module contains functions for fast computation of Levenshtein distance and string similarity

Contents Maintainer wanted Introduction Installation Documentation License History Source code Authors Maintainer wanted I am looking for a new mainta

Antti Haapala 1.2k Dec 16, 2022
Add your new words to a text file and get them randomly.

Memorize-New-Words In this very very very little project, I've wrote a code to memorize new english words. Therefore you can add the words and their m

Mostafa 2 Jul 04, 2022
A minimal python script for generating multiple onetime use bip39 seed phrases

seed_signer_ontimes WARNING This project has mainly been used for local development, and creation should be ran on a air-gapped machine. A minimal pyt

CypherToad 4 Sep 12, 2022