-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from NNPDF/remove_pymodules
Use PyO3 functionality to remove Python files
- Loading branch information
Showing
39 changed files
with
608 additions
and
1,349 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,174 +1,65 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
import pathlib | ||
import os | ||
import sys | ||
|
||
here = pathlib.Path(__file__).absolute().parent | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = "pineappl" | ||
copyright = "2020-2021, the PineAPPL team" | ||
author = "the PineAPPL team" | ||
import pineappl | ||
import sys | ||
import pathlib | ||
|
||
project = 'pineappl' | ||
copyright = '2020–2024, the PineAPPL team' | ||
author = 'the PineAPPL team' | ||
release = pineappl.version | ||
version = release | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.doctest", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.todo", | ||
"sphinx.ext.coverage", | ||
"sphinx.ext.mathjax", | ||
"sphinx.ext.ifconfig", | ||
"sphinx.ext.viewcode", | ||
"sphinx.ext.autosectionlabel", | ||
"sphinx.ext.napoleon", | ||
"sphinxcontrib.bibtex", | ||
"sphinx.ext.graphviz", | ||
"sphinx.ext.extlinks", | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.autosectionlabel', | ||
'sphinx.ext.extlinks', | ||
'sphinx.ext.inheritance_diagram', | ||
'sphinx.ext.intersphinx', | ||
'sphinx.ext.napoleon', | ||
'sphinx.ext.todo', | ||
'sphinx_rtd_theme', | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ["_templates"] | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
# | ||
source_suffix = { | ||
".rst": "restructuredtext", | ||
".txt": "restructuredtext", | ||
} | ||
|
||
autosectionlabel_prefix_document = True | ||
# autosectionlabel_maxdepth = 10 | ||
# Allow to embed rst syntax in markdown files. | ||
enable_eval_rst = True | ||
|
||
# The master toctree document. | ||
master_doc = "index" | ||
bibtex_bibfiles = ["refs.bib"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ["shared/*"] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = None | ||
|
||
# A string to be included at the beginning of all files | ||
shared = here / "shared" | ||
rst_prolog = "\n".join([open(x).read() for x in os.scandir(shared)]) | ||
|
||
extlinks = { | ||
"yadism": ("https://nnpdf.github.io/yadism/%s", "yadism - %s"), | ||
"rustdoc": ("https://docs.rs/pineappl/latest/pineappl/%s", "PineAPPL - %s"), | ||
"pineko": ("https://github.com/NNPDF/pineko/%s", "pineko - %s"), | ||
} | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = [] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "sphinx_rtd_theme" | ||
html_theme = 'sphinx_rtd_theme' | ||
html_static_path = ['_static'] | ||
|
||
# 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, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ["_static"] | ||
|
||
# -- Extension configuration ------------------------------------------------- | ||
# TODO: find a way to reactivate apidoc, which doesn't seem to work for the moment. | ||
|
||
# -- Options for intersphinx extension --------------------------------------- | ||
# here = pathlib.Path(__file__).absolute().parent | ||
# # https://github.com/readthedocs/readthedocs.org/issues/1139#issuecomment-312626491 | ||
# def run_apidoc(_): | ||
# from sphinx.ext.apidoc import main # pylint: disable=import-outside-toplevel | ||
|
||
# sys.path.append(str(here.parent)) | ||
# # analyse 'pineappl' | ||
# docs_dest = here / "modules" | ||
# import pineappl # pylint: disable=import-outside-toplevel | ||
|
||
# # note that we can NOT point to the local directory (`here.parents[1] / "pineappl"`) | ||
# # but we need the package built by `maturin` and installed by `pip` | ||
# package = pathlib.Path(pineappl.__file__).parent / "pineappl" | ||
# main(["--module-first", "--no-toc", "-o", str(docs_dest), str(package)]) | ||
|
||
# Example configuration for intersphinx: refer to the Python standard library. | ||
# Thanks https://github.com/bskinn/sphobjinv | ||
intersphinx_mapping = { | ||
"python": ("https://docs.python.org/3/", None), | ||
"scipy": ("https://docs.scipy.org/doc/scipy/", None), | ||
"numpy": ("https://numpy.org/doc/stable", None), | ||
} | ||
# -- Options for todo extension ---------------------------------------------- | ||
|
||
# If true, `todo` and `todoList` produce output, else they produce nothing. | ||
todo_include_todos = True | ||
|
||
mathjax3_config = { | ||
"tex": { | ||
"macros": { | ||
# fncs | ||
# "atan": [r"\text{atan}", 0], | ||
# "span": [r"\text{span}", 0], | ||
} | ||
} | ||
} | ||
|
||
# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv | ||
def get_base_prefix_compat(): | ||
"""Get base/real prefix, or sys.prefix if there is none.""" | ||
return ( | ||
getattr(sys, "base_prefix", None) | ||
or getattr(sys, "real_prefix", None) | ||
or sys.prefix | ||
) | ||
|
||
|
||
def in_virtualenv(): | ||
return get_base_prefix_compat() != sys.prefix | ||
|
||
|
||
# https://github.com/readthedocs/readthedocs.org/issues/1139#issuecomment-312626491 | ||
def run_apidoc(_): | ||
import subprocess # pylint: disable=import-outside-toplevel | ||
|
||
from sphinx.ext.apidoc import main # pylint: disable=import-outside-toplevel | ||
|
||
sys.path.append(str(here.parent)) | ||
# run maturin to have the latest stuff | ||
pkg_root = here.parents[1] | ||
# if in_virtualenv(): # in local repos we're always in a virtualenv | ||
# subprocess.run(["maturin", "develop"], cwd=pkg_root) | ||
# else: # on RTD we can't (for some reason we're not inside the virtualenv - or maybe only the subshell isn't) | ||
# subprocess.run(["maturin", "build"], cwd=pkg_root) | ||
# # On RTD we were already installing before, but of course this was fake | ||
# # as it only had the raw Python stuff, so let's do it again | ||
# subprocess.run(["pip", "uninstall", "pineappl", "-y"], cwd=pkg_root) | ||
# wheels = list((pkg_root / "target" / "wheels").glob("pineappl*.whl")) | ||
# # In case there are several wheels (as on RTD) find the one matching (and let the others happily fail) | ||
# for wheel in wheels: | ||
# subprocess.run(["pip", "install", str(wheel.absolute())], cwd=pkg_root) | ||
|
||
# analyse 'pineappl' | ||
docs_dest = here / "modules" / "pineappl" | ||
import pineappl | ||
|
||
# note that we can NOT point to the local directory (`here.parents[1] / "pineappl"`) | ||
# but we need the package built by `maturin` and installed by `pip` | ||
package = pathlib.Path(pineappl.__file__).parent | ||
main(["--module-first", "-o", str(docs_dest), str(package)]) | ||
(docs_dest / "modules.rst").unlink() | ||
|
||
|
||
def setup(app): | ||
app.connect("builder-inited", run_apidoc) | ||
# def setup(app): | ||
# app.connect("builder-inited", run_apidoc) |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.