Skip to content

Commit 5b15a2f

Browse files
cpuhrschfmassa
authored andcommitted
[fbsync] Remove hardcoded dependency version for sphinx (#3660)
Summary: * Try using the pyortch theme * directly embed script in layout.html instead * use more mordern script Reviewed By: NicolasHug Differential Revision: D28169165 fbshipit-source-id: 564c5babbc3a96fc32fc9ada891dc2bdd339eb74 Co-authored-by: Francisco Massa <[email protected]>
1 parent 09c40ac commit 5b15a2f

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS = -W # turn warnings into errors
5+
SPHINXOPTS = # -W # turn warnings into errors
66
SPHINXBUILD = sphinx-build
77
SPHINXPROJ = torchvision
88
SOURCEDIR = source

docs/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
sphinx==1.7.3
2-
sphinxcontrib-googleanalytics
1+
sphinx
32
-e git+git://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme

docs/source/_templates/layout.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{% extends "!layout.html" %}
22

3+
{%- block extrahead %}
4+
<!-- Google Analytics -->
5+
<script>
6+
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
7+
ga('create', 'UA-90545585-1', 'auto');
8+
ga('send', 'pageview');
9+
</script>
10+
<script async src='https://www.google-analytics.com/analytics.js'></script>
11+
<!-- End Google Analytics -->
12+
{{ super() }}
13+
{% endblock %}
14+
315
{% block sidebartitle %}
416
<div class="version">
517
<a href='https://pytorch.org/vision/versions.html'>{{ version }} &#x25BC</a>

docs/source/conf.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,8 @@
2323
import torch
2424
import torchvision
2525
import pytorch_sphinx_theme
26-
from sphinxcontrib import googleanalytics
2726

2827

29-
# Wrap sphinxcontrib-googleanalytics setup() function to avoid a Sphinx warning:
30-
# "WARNING: extension ‘sphinxcontrib.googleanalytics’ returned an unsupported
31-
# object from its setup() function; it should return None or a metadata
32-
# dictionary"
33-
_googleanalytics_setup_original = googleanalytics.setup
34-
35-
36-
def _googleanalytics_setup_wrapper(app):
37-
_googleanalytics_setup_original(app)
38-
return {"version": "0.1"}
39-
40-
41-
googleanalytics.setup = _googleanalytics_setup_wrapper
42-
4328
# -- General configuration ------------------------------------------------
4429

4530
# If your documentation needs a minimal Sphinx version, state it here.
@@ -59,16 +44,12 @@ def _googleanalytics_setup_wrapper(app):
5944
'sphinx.ext.mathjax',
6045
'sphinx.ext.napoleon',
6146
'sphinx.ext.viewcode',
62-
'sphinxcontrib.googleanalytics',
6347
]
6448

6549
napoleon_use_ivar = True
6650
napoleon_numpy_docstring = False
6751
napoleon_google_docstring = True
6852

69-
googleanalytics_id = 'UA-90545585-1'
70-
googleanalytics_enabled = True
71-
7253
# Add any paths that contain templates here, relative to this directory.
7354
templates_path = ['_templates']
7455

0 commit comments

Comments
 (0)