-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sphinx-quickstart * update .gitignore * add structure * iterate on docs * iterate on docs * generate CLI reference * use rtd theme * syntax * add hatch dependency
- Loading branch information
Showing
7 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
from subprocess import PIPE, Popen, run | ||
|
||
|
||
project = "catleg" | ||
copyright = "2023, the catala contributors" | ||
author = "the catala contributors" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = ["myst_parser"] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = "sphinx_rtd_theme" | ||
html_static_path = ["_static"] | ||
|
||
# version | ||
pipe = Popen("hatch version", stdout=PIPE, shell=True) | ||
version = pipe.stdout.read().decode("utf8") | ||
|
||
# generate CLI reference | ||
# (this command implies that `make html` is executed from the `docs` | ||
# directory -- this could be made more robust?) | ||
run( | ||
[ | ||
"typer", | ||
"../src/catleg/catleg.py", | ||
"utils", | ||
"docs", | ||
"--name", | ||
"catleg", | ||
"--output", | ||
"cli_reference.md", | ||
], | ||
check=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
================= | ||
catleg |version| | ||
================= | ||
|
||
*A library of helper tools for catala programming in the context of French legislative texts.* | ||
|
||
|PyPI| |CI| |License| | ||
|
||
.. |PyPI| image:: https://img.shields.io/pypi/v/catleg.svg | ||
:target: https://pypi.org/project/catleg/ | ||
.. |CI| image:: https://github.com/CatalaLang/catleg/workflows/check/badge.svg | ||
:target: https://github.com/CatalaLang/catleg/actions | ||
.. |License| image:: https://img.shields.io/badge/license-Apache%202.0-blue.svg | ||
:target: https://github.com/CatalaLang/catleg/blob/main/LICENSE | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
:caption: Contents: | ||
|
||
installation | ||
cli_reference.md | ||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.. _installation: | ||
|
||
============== | ||
Installation | ||
============== | ||
|
||
``catleg`` is tested on Linux, macOS and Windows. | ||
|
||
.. _installation_homebrew: | ||
|
||
|
||
Using pip | ||
========= | ||
|
||
The `catleg package <https://pypi.org/project/catleg/>`__ can be installed using ``pip`` like so:: | ||
|
||
pip install catleg | ||
|
||
.. _installation_pipx: | ||
|
||
Using pipx | ||
========== | ||
|
||
`pipx <https://pypi.org/project/pipx/>`__ is a tool for installing Python command-line applications in their own isolated environments. You can use ``pipx`` to install the ``catleg`` command-line tool like this:: | ||
|
||
pipx install catleg | ||
|
||
Providing Legifrance credentials | ||
================================ | ||
|
||
``catleg`` uses the Legifrance API to access French legislative texts. | ||
|
||
This API is authenticated and requires credentials, which may be obtained by registering on `the Piste portal <https://piste.gouv.fr/>`__. | ||
|
||
To provide credentials to catleg, create a ``.catleg_secrets.toml`` file like so:: | ||
|
||
lf_client_id = "your_client_id" | ||
lf_client_secret = "your_client_secret" | ||
|
||
Alternatively, you may define the environment variables ``CATLEG_LF_CLIENT_ID`` and ``CATLEG_LF_CLIENT_SECRET``. | ||
|
||
.. note:: | ||
Legifrance authentication requires **oauth** credentials, not an API key. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters