From 84d40cde7295aa1feb4e2bb66dbf31eda9f1441f Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Sat, 23 Mar 2024 19:08:13 +0900 Subject: [PATCH] feat: Initial commit - Create from cookiecutter - Sync local environment --- .editorconfig | 29 ++++++ .github/release-body.md | 3 + .github/workflows/main.yml | 70 ++++++++++++++ .github/workflows/release.yml | 87 +++++++++++++++++ .gitignore | 174 ++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 15 +++ .python-version | 1 + CHANGES.rst | 10 ++ LICENSE | 68 +++++++++++++ README.rst | 12 +++ doc/.ruff.toml | 4 + doc/Makefile | 20 ++++ doc/_static/.gitignore | 2 + doc/_templates/.gitignore | 2 + doc/conf.py | 18 ++++ doc/index.rst | 23 +++++ doc/make.bat | 35 +++++++ pyproject.toml | 62 ++++++++++++ requirements-dev.lock | 68 +++++++++++++ requirements.lock | 58 ++++++++++++ src/atsphinx/mini18n.py | 14 +++ tests/.ruff.toml | 4 + tests/conftest.py | 11 +++ tests/test-root/conf.py | 5 + tests/test-root/index.rst | 2 + tests/test_it.py | 12 +++ 26 files changed, 809 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/release-body.md create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 .python-version create mode 100644 CHANGES.rst create mode 100644 LICENSE create mode 100644 README.rst create mode 100644 doc/.ruff.toml create mode 100644 doc/Makefile create mode 100644 doc/_static/.gitignore create mode 100644 doc/_templates/.gitignore create mode 100644 doc/conf.py create mode 100644 doc/index.rst create mode 100644 doc/make.bat create mode 100644 pyproject.toml create mode 100644 requirements-dev.lock create mode 100644 requirements.lock create mode 100644 src/atsphinx/mini18n.py create mode 100644 tests/.ruff.toml create mode 100644 tests/conftest.py create mode 100644 tests/test-root/conf.py create mode 100644 tests/test-root/index.rst create mode 100644 tests/test_it.py diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e032bd0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = false + +# Windows files +[*.{bat}] +indent_style = space +indent_size = 4 +end_of_line = crlf +charset = sjis + +# 2 space indentation +[*.{yml,js,json,rst,html,css,md}] +indent_size = 2 + +# 4 space indentation +[*.{py,toml}] +indent_size = 4 + +# Tab indentation (no size specified) +[Makefile,*.{cfg}] +indent_style = tab diff --git a/.github/release-body.md b/.github/release-body.md new file mode 100644 index 0000000..4216a62 --- /dev/null +++ b/.github/release-body.md @@ -0,0 +1,3 @@ +Release atsphinx-mini18n v0.0.0 + +- Changelog is https://github.com/atsphinx/mini18n/blob/v0.0.0/CHANGES.rst diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..64b04fc --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,70 @@ +name: 'Run CI jobs' + +on: + push: + branches: + - '**' + tags-ignore: + - '**' + pull_request: + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version-file: '.python-version' + - name: Lint by pre-commit + run: | + pip install pre-commit + pre-commit run --all-files + source-test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Configure venv + run: | + pip install uv + uv venv + uv pip install -r requirements-dev.lock + - name: Run tests + run: | + source .venv/bin/activate + pytest + doc-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version-file: '.python-version' + - name: Configure venv + run: | + pip install uv + uv venv + uv pip install -r requirements-dev.lock + - name: Run tests + run: | + source .venv/bin/activate + make -C doc linkcheck dirhtml + build-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version-file: '.python-version' + - name: Build package + run: | + pip install hatch + hatch build + ls -l dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f8dbea6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,87 @@ +name: 'Release new version' + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version-file: '.python-version' + - name: Build package + run: | + pip install hatch + hatch build + ls -l dist + - uses: actions/upload-artifact@v4 + with: + name: packages-${{ github.ref_name }} + path: dist/ + gh-release: + needs: [build] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: packages-${{ github.ref_name }} + path: dist/ + - uses: ncipollo/release-action@v1 + with: + artifacts: 'dist/*' + bodyFile: '.github/release-body.md' + draft: false + name: Release ${{ github.ref_name }} + tag: ${{ github.ref }} + prerelease: false + publish-pypi: + needs: [build] + runs-on: ubuntu-latest + if: success() && ${{ needs.prepare.outputs.is-release }} + steps: + - uses: actions/download-artifact@v4 + with: + name: packages-${{ github.ref_name }} + path: dist/ + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + deploy-doc: + needs: [build] + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version-file: '.python-version' + - name: Configure venv + run: | + pip install uv + uv venv + uv pip install -r requirements-dev.lock + - name: Run tests + run: | + source .venv/bin/activate + make -C doc dirhtml + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: doc/_build/dirhtml + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8bed057 --- /dev/null +++ b/.gitignore @@ -0,0 +1,174 @@ +### GIGI version 0.1.0 +### command with: python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..65c11db --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.3.0 + hooks: + # Run the linter. + - id: ruff + # Run the formatter. + - id: ruff-format + - repo: https://github.com/PyCQA/doc8 + rev: v1.0.0 + hooks: + - id: doc8 + args: + - --max-line-length=119 diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..cc1923a --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.8 diff --git a/CHANGES.rst b/CHANGES.rst new file mode 100644 index 0000000..29ab530 --- /dev/null +++ b/CHANGES.rst @@ -0,0 +1,10 @@ +=========== +Change logs +=========== + +v0.0.0 +====== + +:date: 2023-05-01 + +Initial commit. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6b8b53b --- /dev/null +++ b/LICENSE @@ -0,0 +1,68 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + You must give any other recipients of the Work or Derivative Works a copy of this License; and + You must cause any modified files to carry prominent notices stating that You changed the files; and + You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..e501155 --- /dev/null +++ b/README.rst @@ -0,0 +1,12 @@ +================ +atsphinx-mini18n +================ + +Sphinx builder for i18n site on single deployment + +Getting started +=============== + +.. code: console + + pip install atsphinx-mini18n diff --git a/doc/.ruff.toml b/doc/.ruff.toml new file mode 100644 index 0000000..d60ab9a --- /dev/null +++ b/doc/.ruff.toml @@ -0,0 +1,4 @@ +extend = "../pyproject.toml" + +[lint] +ignore = ["D100", "D103"] diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/_static/.gitignore b/doc/_static/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/doc/_static/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/doc/_templates/.gitignore b/doc/_templates/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/doc/_templates/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..34d5283 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,18 @@ +from atsphinx.mini18n import __version__ as version + +# -- Project information +project = "atsphinx-mini18n" +copyright = "2023, Kazuya Takei" +author = "Kazuya Takei" +release = version + +# -- General configuration +extensions = [ + "sphinx.ext.todo", +] +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# -- Options for HTML output +html_theme = "alabaster" +html_static_path = ["_static"] diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..e5418d6 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,23 @@ +================ +atsphinx-mini18n +================ + +Overview +======== + +.. todo:: Write it + +Installation +============ + +.. todo:: Write it + +Usage +===== + +.. todo:: Write it + +Configuration +============= + +.. todo:: Write it diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..32bb245 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..68651a5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,62 @@ +[project] +name = "atsphinx-mini18n" +version = "0.0.0" +description = "Sphinx builder for i18n site on single deployment" +authors = [{name = "Kazuya Takei", email = "myself@attakei.net"}] +license = "Apache-2.0" +requires-python = ">= 3.8" +classifiers = [ + "Development Status :: 3 - Alpha", + "Framework :: Sphinx", + "Framework :: Sphinx :: Extension", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Documentation :: Sphinx", + "Topic :: Software Development", + "Topic :: Software Development :: Documentation", + +] +readme = "README.rst" +dependencies = [ + "sphinx", +] + +[project.urls] +Home = "https://github.com/atsphinx/mini18n" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.rye] +managed = true +dev-dependencies = [ + "pytest ==7.*", +] + +[tool.rye.scripts] +setup = {chain = ["setup:sync", "setup:pre-commit"]} +"setup:sync" = "rye sync --no-lock --all-features" +"setup:pre-commit" = "pre-commit install" +doc = "make -C doc" + +[tool.ruff.lint] +select = ["C90", "D", "E", "F", "I", "W"] + +[tool.ruff.lint.pydocstyle] +convention = "pep257" + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/atsphinx"] +only-includes = ["src/atsphinx"] diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..640750f --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,68 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:. +alabaster==0.7.13 + # via sphinx +babel==2.14.0 + # via sphinx +certifi==2024.2.2 + # via requests +charset-normalizer==3.3.2 + # via requests +docutils==0.20.1 + # via sphinx +exceptiongroup==1.2.0 + # via pytest +idna==3.6 + # via requests +imagesize==1.4.1 + # via sphinx +importlib-metadata==7.1.0 + # via sphinx +iniconfig==2.0.0 + # via pytest +jinja2==3.1.3 + # via sphinx +markupsafe==2.1.5 + # via jinja2 +packaging==24.0 + # via pytest + # via sphinx +pluggy==1.4.0 + # via pytest +pygments==2.17.2 + # via sphinx +pytest==7.4.4 +pytz==2024.1 + # via babel +requests==2.31.0 + # via sphinx +snowballstemmer==2.2.0 + # via sphinx +sphinx==7.1.2 + # via atsphinx-mini18n +sphinxcontrib-applehelp==1.0.4 + # via sphinx +sphinxcontrib-devhelp==1.0.2 + # via sphinx +sphinxcontrib-htmlhelp==2.0.1 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==1.0.3 + # via sphinx +sphinxcontrib-serializinghtml==1.1.5 + # via sphinx +tomli==2.0.1 + # via pytest +urllib3==2.2.1 + # via requests +zipp==3.18.1 + # via importlib-metadata diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..cb9bfe2 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,58 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:. +alabaster==0.7.13 + # via sphinx +babel==2.14.0 + # via sphinx +certifi==2024.2.2 + # via requests +charset-normalizer==3.3.2 + # via requests +docutils==0.20.1 + # via sphinx +idna==3.6 + # via requests +imagesize==1.4.1 + # via sphinx +importlib-metadata==7.1.0 + # via sphinx +jinja2==3.1.3 + # via sphinx +markupsafe==2.1.5 + # via jinja2 +packaging==24.0 + # via sphinx +pygments==2.17.2 + # via sphinx +pytz==2024.1 + # via babel +requests==2.31.0 + # via sphinx +snowballstemmer==2.2.0 + # via sphinx +sphinx==7.1.2 + # via atsphinx-mini18n +sphinxcontrib-applehelp==1.0.4 + # via sphinx +sphinxcontrib-devhelp==1.0.2 + # via sphinx +sphinxcontrib-htmlhelp==2.0.1 + # via sphinx +sphinxcontrib-jsmath==1.0.1 + # via sphinx +sphinxcontrib-qthelp==1.0.3 + # via sphinx +sphinxcontrib-serializinghtml==1.1.5 + # via sphinx +urllib3==2.2.1 + # via requests +zipp==3.18.1 + # via importlib-metadata diff --git a/src/atsphinx/mini18n.py b/src/atsphinx/mini18n.py new file mode 100644 index 0000000..b1d3b57 --- /dev/null +++ b/src/atsphinx/mini18n.py @@ -0,0 +1,14 @@ +"""Sphinx builder for i18n site on single deployment.""" + +from sphinx.application import Sphinx + +__version__ = "0.0.0" + + +def setup(app: Sphinx): # noqa: D103 + return { + "version": __version__, + "env_version": 1, + "parallel_read_safe": True, + "parallel_write_safe": True, + } diff --git a/tests/.ruff.toml b/tests/.ruff.toml new file mode 100644 index 0000000..d60ab9a --- /dev/null +++ b/tests/.ruff.toml @@ -0,0 +1,4 @@ +extend = "../pyproject.toml" + +[lint] +ignore = ["D100", "D103"] diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..26e65d8 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,11 @@ +"""Configuration for pytest.""" + +import pytest +from sphinx.testing.path import path + +pytest_plugins = "sphinx.testing.fixtures" + + +@pytest.fixture(scope="session") +def rootdir() -> path: # noqa: D103 + return path(__file__).parent.abspath() diff --git a/tests/test-root/conf.py b/tests/test-root/conf.py new file mode 100644 index 0000000..e3d24cd --- /dev/null +++ b/tests/test-root/conf.py @@ -0,0 +1,5 @@ +# noqa: D100 + +extensions = [ + "atsphinx.mini18n", +] diff --git a/tests/test-root/index.rst b/tests/test-root/index.rst new file mode 100644 index 0000000..139b90e --- /dev/null +++ b/tests/test-root/index.rst @@ -0,0 +1,2 @@ +Test doc for atsphinx-mini18n +============================= diff --git a/tests/test_it.py b/tests/test_it.py new file mode 100644 index 0000000..32151ff --- /dev/null +++ b/tests/test_it.py @@ -0,0 +1,12 @@ +"""Standard tests.""" + +from io import StringIO + +import pytest +from sphinx.testing.util import SphinxTestApp + + +@pytest.mark.sphinx("html") +def test__it(app: SphinxTestApp, status: StringIO, warning: StringIO): + """Test to pass.""" + app.build()