From a48225aeb8b95faf60a5f51e207428b0de2a3bb8 Mon Sep 17 00:00:00 2001 From: Abdou Seck Date: Fri, 29 Dec 2023 15:47:06 -0500 Subject: [PATCH] docs: Use the sphinx_material theme for html docs --- docs/source/conf.py | 25 ++++++++++++++++++++++++- pyproject.toml | 4 ++-- requirements_dev.txt | 1 + setup.py | 4 ++-- simeon/download/logs.py | 2 +- simeon/scripts/simeon.py | 12 +++--------- simeon/scripts/youtube.py | 4 +--- simeon/tests/test_download_utilities.py | 4 +--- 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index bc78c2f..57b713a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -46,9 +46,32 @@ # 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_material" # 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"] + +# Material theme options (see theme.conf for more information) +html_theme_options = { + # Set the name of the project to appear in the navigation. + "nav_title": "simeon", + # Set you GA account ID to enable tracking + # 'google_analytics_account': 'UA-XXXXX', + # Specify a base_url used to generate sitemap.xml. If not + # specified, then no sitemap will be built. + "base_url": "https://mit-it.github.io/simeon", + # Set the color and the accent color + "color_primary": "blue", + "color_accent": "light-blue", + # Set the repo location to get a badge with stats + "repo_url": "https://github.com/MIT-IR/simeon/", + "repo_name": "simeon", + # Visible levels of the global TOC; -1 means unlimited + "globaltoc_depth": 3, + # If False, expand all TOC entries + "globaltoc_collapse": False, + # If True, show hidden TOC entries + "globaltoc_includehidden": False, +} diff --git a/pyproject.toml b/pyproject.toml index 73c22f1..8516623 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,8 +40,8 @@ dynamic = ["version"] [project.optional-dependencies] geoip = ["geoip2"] -test = ["black", "isort", "pip-tools", "sphinx", "tox"] -dev = ["black", "isort", "pip-tools", "sphinx", "tox"] +test = ["black", "isort", "pip-tools", "sphinx", "sphinx-material", "tox"] +dev = ["black", "isort", "pip-tools", "sphinx", "sphinx-material", "tox"] [tool.setuptools.package-data] "simeon.upload" = ["schemas/*.json"] diff --git a/requirements_dev.txt b/requirements_dev.txt index 8e8d6ee..b49c914 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,5 @@ black isort Sphinx>=3.4.3 +sphinx-material tox>=3.21.2 diff --git a/setup.py b/setup.py index 87573f8..d60353c 100644 --- a/setup.py +++ b/setup.py @@ -40,8 +40,8 @@ ], extras_require={ "geoip": ["geoip2"], - "test": ["black", "isort", "pip-tools", "sphinx", "tox"], - "dev": ["black", "isort", "pip-tools", "sphinx", "tox"], + "test": ["black", "isort", "pip-tools", "sphinx", "sphinx-material", "tox"], + "dev": ["black", "isort", "pip-tools", "sphinx", "sphinx-material", "tox"], }, package_data={ "simeon.upload": ["schemas/*.json"], diff --git a/simeon/download/logs.py b/simeon/download/logs.py index 2df1784..c41b77b 100644 --- a/simeon/download/logs.py +++ b/simeon/download/logs.py @@ -121,7 +121,7 @@ def process_line( try: date = parse_date(record.get("time", "")) outfile = utils.make_tracklog_path(course_id, date.strftime("%Y-%m-%d"), is_gzip) - except Exception as e: + except Exception: ext = ".gz" if is_gzip else "" outfile = os.path.join( course_id.replace(".", "_").replace("/", "__") or "dead_letters", diff --git a/simeon/scripts/simeon.py b/simeon/scripts/simeon.py index b52ee6c..912894c 100644 --- a/simeon/scripts/simeon.py +++ b/simeon/scripts/simeon.py @@ -1423,9 +1423,7 @@ def main(): cpgroup.add_argument( "--no-courses", "-V", - help=( - "DO NOT try to limit the loaded files to only some course IDs. Therefore, simeon will push everything." - ), + help=("DO NOT try to limit the loaded files to only some course IDs. Therefore, simeon will push everything."), action="store_true", ) cpgroup.add_argument( @@ -1536,17 +1534,13 @@ def main(): reporter.add_argument( "--wait-for-loads", "-w", - help=( - "Wait for asynchronous BigQuery query jobs to finish. Otherwise, simeon creates query jobs and exits." - ), + help=("Wait for asynchronous BigQuery query jobs to finish. Otherwise, simeon creates query jobs and exits."), action="store_true", ) reporter.add_argument( "--in-files", "-i", - help=( - "Whether the provided course ID arguments are text files that contain the course IDs. One ID per line" - ), + help=("Whether the provided course ID arguments are text files that contain the course IDs. One ID per line"), action="store_true", ) reporter.add_argument( diff --git a/simeon/scripts/youtube.py b/simeon/scripts/youtube.py index f2a71c4..04529f9 100644 --- a/simeon/scripts/youtube.py +++ b/simeon/scripts/youtube.py @@ -360,9 +360,7 @@ def main(): merger = subparsers.add_parser( "merge", help="Merge the data file generated from simeon-youtube extract to the given target BigQuery table.", - description=( - "Merge the data file generated from simeon-youtube extract to the given target BigQuery table." - ), + description=("Merge the data file generated from simeon-youtube extract to the given target BigQuery table."), allow_abbrev=False, ) merger.add_argument("youtube_file", help="A .json.gz file generated from the extract command") diff --git a/simeon/tests/test_download_utilities.py b/simeon/tests/test_download_utilities.py index 72e9b4e..61c1ad9 100644 --- a/simeon/tests/test_download_utilities.py +++ b/simeon/tests/test_download_utilities.py @@ -95,9 +95,7 @@ def setUp(self): { "event": {}, "event_type": "", - "context": { - "path": "/courses/course-v1:ORGx+Course1x+4T2099/xblock/block-v1:a+a+a+type@foo+block@bar" - }, + "context": {"path": "/courses/course-v1:ORGx+Course1x+4T2099/xblock/block-v1:a+a+a+type@foo+block@bar"}, }, { "event": {"id": "block-v1:ORGx+Course1x+4T2099+type@foo+block@bar"},