Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[build-system]
requires = [
"setuptools>=64",
"setuptools-scm>=8",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
name = "starterkit_ci"
dynamic = ["version"]

description = "Helpers for Starterkit Continuous Integration"
readme = "README.md"
requires-python = ">=3.8"

license = { file = "LICENSE.md" }

authors = [
{ name = "LHCb Starterkit" },
]

keywords = ["Starterkit"]

classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

dependencies = [
"sphinx>=7.0",
"sphinx-rtd-theme>=1.3",
"myst-parser[linkify]>=3.0",
"nbsphinx>=0.9",
]

[project.urls]
"Homepage" = "https://github.com/lhcb/starterkit_ci"
"Bug Reports" = "https://github.com/lhcb/starterkit-ci/issues"
"Source" = "https://github.com/lhcb/starterkit-ci"

[project.scripts]
starterkit_ci = "starterkit_ci:parse_args"

[tool.setuptools]
package-dir = {"" = "src"}
zip-safe = false

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
starterkit_ci = [
"sphinx_config/_static/*",
"sphinx_config/_static/**/*",
]

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "node-and-date"

[tool.flake8]
max-line-length = 120

[tool.pytest.ini_options]
addopts = "--cov=cirun --cov-report=term-missing"
59 changes: 0 additions & 59 deletions setup.py

This file was deleted.

112 changes: 50 additions & 62 deletions src/starterkit_ci/sphinx_config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,105 +1,93 @@
import os
from os.path import dirname, join

from sphinx_markdown_parser.parser import MarkdownParser
from recommonmark.parser import CommonMarkParser
from sphinx_markdown_parser.transform import AutoStructify

from . import panels
from . import fix_markdown_file_downloads

from . import fix_markdown_file_downloads, panels

extensions = [
'sphinx_rtd_theme',
'sphinx_markdown_parser',
'sphinx.ext.mathjax',
'nbsphinx',
"sphinx_rtd_theme",
"myst_parser",
"sphinx.ext.mathjax",
"nbsphinx",
]


templates_path = [
'_templates',
"_templates",
]

html_theme = 'sphinx_rtd_theme'

html_theme = "sphinx_rtd_theme"
html_show_sourcelink = True
html_theme_options = {
'collapse_navigation': False,
"collapse_navigation": False,
}


exclude_patterns = [
'**.ipynb_checkpoints',
"**.ipynb_checkpoints",
]


html_context = {
'display_github': True,
'github_user': 'lhcb',
'github_repo': 'starterkit-lessons',
'github_version': 'master',
'conf_py_path': '/source/',
"display_github": True,
"github_user": "lhcb",
"github_repo": "starterkit-lessons",
"github_version": "master",
"conf_py_path": "/source/",
}
highlight_language = 'none'


highlight_language = "none"


html_static_path = [
f'{dirname(__file__)}/_static',
f"{dirname(__file__)}/_static",
]


linkcheck_ignore = [
# Expect certificate errors
r'https://lhcb-portal-dirac\.cern\.ch/DIRAC/',
r'https://lhcb-nightlies\.cern\.ch.*',
# 404 if not logged in
r'https://gitlab\.cern\.ch/.*/merge_requests/new',
# Anchors to specific lines are generated with Javascript
r'https://gitlab\.cern\.ch/lhcb/Stripping/blob/.*',
# Seems to be unreliable?
r'http://pdg.*\.lbl\.gov/.*',
# 403 if not logged in
r'https://groups\.cern\.ch/group/lhcb-distributed-analysis/default\.aspx',
# FIXME: The URLs have changed
r'https://research\.cs\.wisc\.edu/htcondor/.*',
r"https://lhcb-portal-dirac\.cern\.ch/DIRAC/",
r"https://lhcb-nightlies\.cern\.ch.*",
r"https://gitlab\.cern\.ch/.*/merge_requests/new",
r"https://lhcb\.cern\.ch/lhcb/Stripping/blob/.*",
r"http://pdg.*\.lbl\.gov/.*",
r"https://groups\.cern\.ch/group/lhcb-distributed-analysis/default\.aspx",
r"https://research\.cs\.wisc\.edu/htcondor/.*",
]


linkcheck_workers = 32


starterkit_ci_redirects = {}


source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}


myst_enable_extensions = [
"dollarmath",
"amsmath",
"linkify",
"substitution",
]


def setup(app):
# Workaround for https://github.com/readthedocs/recommonmark/issues/177
class CustomCommonMarkParser(CommonMarkParser):
def visit_document(self, node):
pass

app.add_source_suffix('.md', 'markdown')
#app.add_source_parser(MarkdownParser)
app.add_source_parser(CustomCommonMarkParser)
app.add_config_value('markdown_parser_config', {
'auto_toc_tree_section': 'Content',
'enable_auto_toc_tree': True,
'enable_eval_rst': True,
'extensions': [
'extra',
'nl2br',
'sane_lists',
'smarty',
'toc',
'wikilinks',
'pymdownx.arithmatex',
],
}, True)
app.add_transform(AutoStructify)
fix_markdown_file_downloads.configure_app(app)
panels.configure_app(app)
for extra_setup_func in setup.extra_setup_funcs:
extra_setup_func(app)

# Create redirects
for origin, target in starterkit_ci_redirects.items():
# import pdb
# pdb.set_trace()
origin = join(app.outdir, origin)
print('Creating redirect from', origin, 'to', target)
print("Creating redirect from", origin, "to", target)
os.makedirs(dirname(origin), exist_ok=True)
with open(origin, 'wt') as fp:
with open(origin, "wt") as fp:
fp.write(f'<meta http-equiv="refresh" content="0; url={target}">\n')
fp.write(f'<link rel="canonical" href="{target}" />\n')

Expand Down