{"id":14958072,"url":"https://github.com/pytorch/pytorch_sphinx_theme","last_synced_at":"2025-06-28T01:34:43.020Z","repository":{"id":39778595,"uuid":"149312823","full_name":"pytorch/pytorch_sphinx_theme","owner":"pytorch","description":"PyTorch Sphinx Theme","archived":false,"fork":false,"pushed_at":"2025-06-24T20:21:48.000Z","size":20776,"stargazers_count":100,"open_issues_count":30,"forks_count":141,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-27T00:22:57.064Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pytorch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-09-18T15:41:35.000Z","updated_at":"2025-06-15T14:57:28.000Z","dependencies_parsed_at":"2023-02-09T11:01:19.524Z","dependency_job_id":"c3591782-331d-4e6e-9bee-02b21e6ec18e","html_url":"https://github.com/pytorch/pytorch_sphinx_theme","commit_stats":{"total_commits":288,"total_committers":28,"mean_commits":"10.285714285714286","dds":0.7430555555555556,"last_synced_commit":"05ee809ecf4c396cce8f44a172484f2946eb255a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pytorch/pytorch_sphinx_theme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fpytorch_sphinx_theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fpytorch_sphinx_theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fpytorch_sphinx_theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fpytorch_sphinx_theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pytorch","download_url":"https://codeload.github.com/pytorch/pytorch_sphinx_theme/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytorch%2Fpytorch_sphinx_theme/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262361601,"owners_count":23299084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:16:09.934Z","updated_at":"2025-06-28T01:34:42.992Z","avatar_url":"https://github.com/pytorch.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTorch Sphinx Theme\n\nSphinx theme for [PyTorch Docs](https://pytorch.org/docs/master/torch.html) and [PyTorch Tutorials](https://pytorch.org/tutorials) based on the [Read the Docs Sphinx Theme](https://sphinx-rtd-theme.readthedocs.io/en/latest).\n\n## Local Development\n\nInstall PyTorch Sphinx Theme:\n\n```\ngit clone https://github.com/pytorch/pytorch_sphinx_theme\npip install -r docs/requirements.txt\npip install -e .\n```\n\nIn the root directory, install the dependencies using either yarn using `yarn install` OR npm using `npm install` (not both):\n\nCreate an empty `.env.json` file in the root directory and build the site with live reloading\n\n```bash\necho '{}' \u003e .env.json\ngrunt build\n```\n\nIf you want to specify the project folder (docs or tutorial for which\nyou want to see docs generated) then you need to specify it into `.env.json`\nfile:\n\n```json\n{\n    \"DOCS_DIR\": \"docs/\",\n    \"TUTORIALS_DIR\": \"path/to/tutorial/directory\"\n}\n```\n\n## Testing your changes and submitting a PR\n\nWhen you are ready to submit a PR with your changes you can first test that your changes have been applied correctly against either the PyTorch Docs or Tutorials repo:\n\n1. Run the `grunt build` task on your branch and commit the build to Github.\n2. In your local docs or tutorials repo, remove any existing `pytorch_sphinx_theme` packages in the `src` folder (there should be a `pip-delete-this-directory.txt` file there)\n3. Clone the repo locally `git clone https://github.com/pytorch/pytorch_sphinx_theme`\n4. Install `pytorch_sphinx_theme` by running `pip install -e pytorch_sphinx_theme`\n5. Install the requirements `pip install -r requirements.txt`\n6. Remove the current build. In the docs this is `make clean`, tutorials is `make clean-cache`\n7. Build the static site. In the docs this is `make html`, tutorials is `make html-noplot`\n8. Open the site and look around. In the docs open `docs/build/html/index.html`, in the tutorials open `_build/html.index.html`\n\nIf your changes have been applied successfully, remove the build commit from your branch and submit your PR.\n\n## Publishing the theme\n\nBefore the new changes are visible in the theme the maintainer will need to run the build process:\n\n```bash\ngrunt build\n```\n\nOnce that is successful commit the change to Github.\n\n### Developing locally against PyTorch Docs and Tutorials\n\nTo be able to modify and preview the theme locally against the PyTorch Docs and/or the PyTorch Tutorials first clone the repositories:\n\n```bash\ngit clone https://github.com/pytorch/pytorch\ngit clone https://github.com/pytorch/tutorials\n```\n\nThen follow the instructions in each repository to make the docs.\n\nOnce the docs have been successfully generated you should be able to run the following to create an html build.\n\n#### pytorch/pytorch/docs\n\n```bash\ncd pytorch/docs\nmake html\n```\n\n#### Tutorials\n\n```bash\ncd tutorials\nmake html\n```\n\nOnce these are successful, navigate to the `conf.py` file in each project. In the Docs these are at `./docs/source`. The Tutorials one can be found in the root directory.\n\nIn `conf.py` change the html theme to `pytorch_sphinx_theme` and point the html theme path to this repo's local folder, which will end up looking something like:\n\n```\nhtml_theme = 'pytorch_sphinx_theme'\nhtml_theme_path = [\"../../../pytorch_sphinx_theme\"]\n```\n\nNext create a file `.env.json` in the root of this repo with some keys/values referencing the local folders of the Docs and Tutorials repos:\n\n```json\n{\n  \"TUTORIALS_DIR\": \"../tutorials\",\n  \"DOCS_DIR\": \"../pytorch/docs/source\"\n}\n```\n\nYou can then build the Docs or Tutorials by running\n\n```bash\ngrunt --project=docs\n```\nor\n\n```bash\ngrunt --project=tutorials\n```\n\nThese will generate a live-reloaded local build for the respective projects available at `localhost:1919`.\n\nNote that while live reloading works these two projects are hefty and will take a few seconds to build and reload, especially the Docs.\n\n### Built-in Stylesheets and Fonts\n\nThere are a couple of stylesheets and fonts inside the Docs and Tutorials repos themselves meant to override the existing theme. To ensure the most accurate styles we should comment out those files until the maintainers of those repos remove them:\n\n#### pytorch/pytorch/docs\n\n```python\n# ./docs/source/conf.py\n\nhtml_context = {\n    # 'css_files': [\n    #     'https://fonts.googleapis.com/css?family=Lato',\n    #     '_static/css/pytorch_theme.css'\n    # ],\n}\n```\n\n#### pytorch/tutorials\n\n```python\n# ./conf.py\n\n# app.add_stylesheet('css/pytorch_theme.css')\n# app.add_stylesheet('https://fonts.googleapis.com/css?family=Lato')\n```\n\n### Top/Mobile Navigation\n\nThe top navigation and mobile menu expect an \"active\" state for one of the menu items. To ensure that either \"Docs\" or \"Tutorials\" is marked as active, set the following config value in the respective `conf.py`, where `{project}` is either `\"docs\"` or `\"tutorials\"`.\n\n```\nhtml_theme_options = {\n  ...\n  'pytorch_project': {project}\n  ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytorch%2Fpytorch_sphinx_theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpytorch%2Fpytorch_sphinx_theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytorch%2Fpytorch_sphinx_theme/lists"}