From b7b0949754ad5f602937767011909a3a20b84f86 Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Fri, 6 Dec 2024 12:50:49 +0100 Subject: [PATCH 1/6] fix: Add warning that best_match is deprecated --- langcodes/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/langcodes/__init__.py b/langcodes/__init__.py index c454df2a..6d952d33 100644 --- a/langcodes/__init__.py +++ b/langcodes/__init__.py @@ -1833,6 +1833,11 @@ def best_match( `min_score` sets the minimum match score. If all languages match with a lower score than that, the result will be 'und' with a score of 0. """ + warnings.warn( + "`best_match` is deprecated and will be removed in a future version. Please " + "use `closest_match` instead.", + DeprecationWarning, + ) max_distance = 100 - min_score supported, distance = closest_match( desired_language, supported_languages, max_distance From 2fca35314927950a47fecb1ba716e8946d8a64a0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 Oct 2025 16:52:11 +0000 Subject: [PATCH 2/6] chore(deps): update dependency python to 3.14 --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d38526e7..3bf8c510 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.13' + python-version: '3.14' - name: Install dependencies run: pip install .[build] - name: Build package From f8bf560fffdd3b07bb2a395748ca4cb41a35165c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:41:09 +0000 Subject: [PATCH 3/6] chore(deps): update actions/upload-artifact action to v5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3baf1feb..ddf0b965 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - name: Run tests run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=language_data --cov-report=xml:junit/coverage-${{ matrix.python-version }}.xml - name: Upload - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: junit-${{ matrix.python-version }} path: junit/* From f712924172d12f703e46df778f1bb8ff9af4d2dd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:10:34 +0000 Subject: [PATCH 4/6] chore(deps): update actions/checkout action to v6 --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3bf8c510..12210d17 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -13,7 +13,7 @@ jobs: permissions: id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddf0b965..a6b89d7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: From 4701cd34cc607c4ffcd2ed675f03b1d6529398da Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 23:32:18 +0000 Subject: [PATCH 5/6] chore(deps): update actions/setup-python action to v6 --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 12210d17..a8babcb2 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6b89d7f..166547ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install From bafc5b1b4ca9d0fc9aac901b96705c43cb677ab6 Mon Sep 17 00:00:00 2001 From: prateek-dagar Date: Fri, 7 Aug 2026 12:34:27 +0530 Subject: [PATCH 6/6] docs: generate and publish API documentation with Sphinx and MyST-Parser --- .github/workflows/ci.yml | 13 ++++++++++ .readthedocs.yaml | 21 ++++++++++++++++ docs/_static/.gitkeep | 1 + docs/conf.py | 8 +++++- docs/index.rst | 12 +++------ docs/requirements.txt | 6 +++-- docs/source/langcodes.rst | 51 ++------------------------------------- docs/source/modules.rst | 7 ------ tox.ini | 12 ++++++++- 9 files changed, 63 insertions(+), 68 deletions(-) create mode 100644 .readthedocs.yaml create mode 100644 docs/_static/.gitkeep delete mode 100644 docs/source/modules.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 166547ad..ec58249d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,3 +25,16 @@ jobs: name: junit-${{ matrix.python-version }} path: junit/* + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install tox + run: pip install tox + - name: Build documentation + run: tox -e docs + diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..4205a005 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,21 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-24.04 + tools: + python: "3.12" + +sphinx: + configuration: docs/conf.py + +python: + install: + - method: pip + path: . + extra_requirements: + - data + - requirements: docs/requirements.txt diff --git a/docs/_static/.gitkeep b/docs/_static/.gitkeep new file mode 100644 index 00000000..c27d459c --- /dev/null +++ b/docs/_static/.gitkeep @@ -0,0 +1 @@ +# Keep docs/_static tracked by git diff --git a/docs/conf.py b/docs/conf.py index b198b773..7f68c3d2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,6 +31,7 @@ 'sphinx.ext.autodoc', # https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html#using-markdown-with-sphinx 'myst_parser', + 'sphinx_copybutton', ] # Add any paths that contain templates here, relative to this directory. @@ -47,7 +48,12 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'sphinx_book_theme' + +html_theme_options = { + "show_navbar_depth": 2, + "show_toc_level": 2, +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/index.rst b/docs/index.rst index 334edfcb..27b3e430 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,16 +1,12 @@ -.. langcodes documentation master file, created by - sphinx-quickstart on Fri Apr 16 21:32:52 2021. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to langcodes's documentation! -===================================== +.. include:: ../README.md + :parser: myst_parser.sphinx_ .. toctree:: :maxdepth: 2 :caption: Contents: - source/modules + self + source/langcodes Indices and tables diff --git a/docs/requirements.txt b/docs/requirements.txt index 37a30b2f..2c7d8dac 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,4 @@ -myst_parser - +sphinx +sphinx-book-theme +myst-parser +sphinx-copybutton diff --git a/docs/source/langcodes.rst b/docs/source/langcodes.rst index ef29e118..e5778988 100644 --- a/docs/source/langcodes.rst +++ b/docs/source/langcodes.rst @@ -1,25 +1,9 @@ -langcodes package +Langcodes package ================= Submodules ---------- -langcodes.build\_data module ----------------------------- - -.. automodule:: langcodes.build_data - :members: - :undoc-members: - :show-inheritance: - -langcodes.data\_dicts module ----------------------------- - -.. automodule:: langcodes.data_dicts - :members: - :undoc-members: - :show-inheritance: - langcodes.language\_distance module ----------------------------------- @@ -28,38 +12,6 @@ langcodes.language\_distance module :undoc-members: :show-inheritance: -langcodes.language\_lists module --------------------------------- - -.. automodule:: langcodes.language_lists - :members: - :undoc-members: - :show-inheritance: - -langcodes.registry\_parser module ---------------------------------- - -.. automodule:: langcodes.registry_parser - :members: - :undoc-members: - :show-inheritance: - -langcodes.tag\_parser module ----------------------------- - -.. automodule:: langcodes.tag_parser - :members: - :undoc-members: - :show-inheritance: - -langcodes.util module ---------------------- - -.. automodule:: langcodes.util - :members: - :undoc-members: - :show-inheritance: - Module contents --------------- @@ -67,3 +19,4 @@ Module contents :members: :undoc-members: :show-inheritance: + :exclude-members: ATTRIBUTES, BROADER_KEYSETS, MATCHABLE_KEYSETS diff --git a/docs/source/modules.rst b/docs/source/modules.rst deleted file mode 100644 index 26c9a30d..00000000 --- a/docs/source/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -langcodes -========= - -.. toctree:: - :maxdepth: 4 - - langcodes diff --git a/tox.ini b/tox.ini index 195a4803..dd4cefa9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36, py37, py38, py39, py310, py311, py312 +envlist = py36, py37, py38, py39, py310, py311, py312, p313 skipsdist = True [testenv] @@ -9,3 +9,13 @@ deps = language_data commands = pip install . pytest + +[testenv:docs] +deps = + sphinx + sphinx-book-theme + myst-parser + sphinx-copybutton + language_data +commands = + sphinx-build -aEWnb html docs docs/build/html