Skip to content

Commit a743c56

Browse files
scbeddlmazuel
andauthored
Upgrade Sphinx (Azure#32066)
* updates to test sever, removing a couple of the pins from test_tools and ci_tools.txt * remove bad readme_renderer requirement * simplifying requirements. fixing requirement file for invoking analyze * repair issues with pypy39 due to twine installation * exclude azure-core-tracing-opencensus from sphinx build * eliminate pytoml dependency * Update Sphinx to v6.x * safe import of tomli on <py311. import tomllib on >=py311. always pull in toml-w Co-authored-by: Laurent Mazuel <[email protected]>
1 parent 7ff8b6e commit a743c56

File tree

17 files changed

+95
-95
lines changed

17 files changed

+95
-95
lines changed

doc/sphinx/conf.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,12 @@
5555
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5656
# ones.
5757
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.doctest',
58-
'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', 'sphinx.ext.napoleon']
58+
'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', 'sphinx.ext.napoleon',
59+
'myst_parser']
5960

6061
intersphinx_mapping = {
6162
# Dependencies
62-
'python': ('https://docs.python.org/3.8', ('/usr/share/doc/python3-doc/html/objects.inv', None)),
63-
'msrestazure': ('http://msrestazure.readthedocs.io/en/latest/', None),
64-
'msrest': ('http://msrest.readthedocs.io/en/latest/', None),
63+
'python': ('https://docs.python.org/3.11', ('/usr/share/doc/python3-doc/html/objects.inv', None)),
6564
'requests': ('https://requests.kennethreitz.org/en/master/', None),
6665
'aiohttp': ('https://aiohttp.readthedocs.io/en/stable/', None),
6766
'trio': ('https://trio.readthedocs.io/en/stable/', None),
@@ -76,9 +75,6 @@
7675
# Add any paths that contain templates here, relative to this directory.
7776
templates_path = ['_templates']
7877

79-
source_parsers = {
80-
'.md': 'recommonmark.parser.CommonMarkParser',
81-
}
8278

8379
# The suffix of source filenames.
8480
source_suffix = ['.rst', '.md']

doc/sphinx/individual_build_conf.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@
5353
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5454
# ones.
5555
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.doctest',
56-
'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', 'sphinx.ext.napoleon']
56+
'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', 'sphinx.ext.napoleon',
57+
'myst_parser']
5758

5859
intersphinx_mapping = {
5960
# Dependencies
60-
'python': ('https://docs.python.org/3.8', None),
61-
'msrestazure': ('http://msrestazure.readthedocs.io/en/latest/', None),
62-
'msrest': ('http://msrest.readthedocs.io/en/latest/', None),
61+
'python': ('https://docs.python.org/3.11', None),
6362
'requests': ('https://requests.kennethreitz.org/en/master/', None),
6463
'aiohttp': ('https://aiohttp.readthedocs.io/en/stable/', None),
6564
'trio': ('https://trio.readthedocs.io/en/stable/', None),
@@ -74,10 +73,6 @@
7473
# Add any paths that contain templates here, relative to this directory.
7574
templates_path = ['_templates']
7675

77-
source_parsers = {
78-
'.md': 'recommonmark.parser.CommonMarkParser',
79-
}
80-
8176
# The suffix of source filenames.
8277
source_suffix = ['.rst', '.md']
8378

doc/sphinx/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
sphinx
22
sphinx_rtd_theme
3-
recommonmark
3+
myst-parser

eng/ci_tools.txt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,37 @@
22
setuptools==67.6.0; python_version >= '3.5'
33
virtualenv==20.23.0
44
wheel==0.37.0
5-
Jinja2==2.11.2
65
packaging==23.1
6+
wheel==0.37.0
77
tox==4.5.0
8-
twine==3.1.1; python_version >= '3.6'
98
pathlib2==2.3.5
109
doc-warden==0.7.2
1110
beautifulsoup4==4.9.1
12-
pkginfo==1.5.0.1
11+
pkginfo==1.9.6
1312
pip==20.3.3
1413
wrapt==1.12.1; python_version <= '3.10'
15-
wrapt==1.14.1; python_version >= '3.11'
16-
markupsafe==2.0.1
14+
wrapt==1.15.0; python_version >= '3.11'
1715
typing-extensions<=4.6.3
1816

17+
# requirements leveraged for testing
18+
pytest==7.3.1
19+
pytest-cov==4.0.0
20+
coverage==7.2.5
21+
1922
# locking packages defined as deps from azure-sdk-tools or azure-devtools
20-
pytoml==0.1.21
21-
pyOpenSSL==23.2.0
23+
Jinja2==3.1.2
24+
MarkupSafe==2.1.3
2225
json-delta==2.0
26+
readme_renderer==37.3; python_version <= '3.7'
27+
readme_renderer==42.0; python_version > '3.7'
28+
pyopenssl==23.2.0
29+
python-dotenv==0.21.1; python_version <= '3.7'
30+
python-dotenv==1.0.0; python_version > '3.7'
31+
pyyaml==6.0.1
32+
urllib3==1.26.16
33+
PyGithub==1.59.1
2334
ConfigArgParse==1.2.3
2435
six==1.14.0
25-
pyyaml==5.3.1
26-
pytest==7.3.1
27-
pytest-cov==4.0.0
28-
coverage==7.2.5
29-
pyproject-api<1.6.0
3036

3137
# local dev packages
3238
./tools/azure-devtools

eng/pipelines/templates/steps/build-package-artifacts.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ steps:
6666
condition: succeededOrFailed()
6767
6868
- script: |
69+
pip install twine==4.0.2
6970
twine check $(Build.ArtifactStagingDirectory)/**/*.whl
7071
twine check $(Build.ArtifactStagingDirectory)/**/*.tar.gz
7172
displayName: 'Verify Readme'

eng/regression_test_tools.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ ConfigArgParse==1.2.3
2121
six==1.14.0
2222
pyyaml==5.3.1
2323
packaging==23.1
24-
Jinja2==2.11.2
25-
markupsafe==2.0.1; python_version > '2.7'
26-
markupsafe==1.1.1; python_version == '2.7'
24+
Jinja2==3.1.2
25+
MarkupSafe==2.1.3
2726
wrapt==1.12.1; python_version <= '3.10'
2827
wrapt==1.14.1; python_version >= '3.11'
2928

eng/regression_tools.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setuptools==67.6.0; python_version >= '3.5'
33
virtualenv==20.23.0
44
wheel==0.37.0
5-
Jinja2==2.11.2
5+
Jinja2==3.1.2
66
packaging==23.1
77
tox==4.5.0
88
twine==3.1.1; python_version >= '3.6'
@@ -13,7 +13,7 @@ pkginfo==1.5.0.1
1313
pip==20.3.3
1414
wrapt==1.12.1; python_version <= '3.10'
1515
wrapt==1.14.1; python_version >= '3.11'
16-
markupsafe==2.0.1
16+
MarkupSafe==2.1.3
1717
typing-extensions<=4.6.3
1818

1919
# locking packages defined as deps from azure-sdk-tools or azure-devtools

eng/test_tools.txt

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,18 @@ pytest-xdist==3.2.1
77
coverage==7.2.5
88
bandit==1.6.2
99
protobuf==3.17.3; python_version == '2.7'
10-
chardet>=2.0,<5.0
11-
cmarkgfm<0.7.0
12-
typing-extensions<=4.6.3
1310

1411
# locking packages defined as deps from azure-sdk-tools or azure-devtools
15-
pytoml==0.1.21
16-
readme-renderer[md]==25.0
17-
pyOpenSSL==23.2.0
12+
Jinja2==3.1.2
13+
MarkupSafe==2.1.3
1814
json-delta==2.0
15+
readme_renderer==37.3; python_version <= '3.7'
16+
readme_renderer==42.0; python_version > '3.7'
17+
pyopenssl==23.2.0
18+
python-dotenv==0.21.1; python_version <= '3.7'
19+
python-dotenv==1.0.0; python_version > '3.7'
20+
pyyaml==6.0.1
21+
urllib3==1.26.16
22+
PyGithub==1.59.1
1923
ConfigArgParse==1.2.3
2024
six==1.14.0
21-
pyyaml==5.3.1
22-
packaging==23.1
23-
Jinja2==2.11.2
24-
markupsafe==2.0.1; python_version > '2.7'
25-
markupsafe==1.1.1; python_version == '2.7'
26-
wrapt==1.12.1; python_version <= '3.10'
27-
wrapt==1.14.1; python_version >= '3.11'
28-
pyproject-api<1.6.0
29-
30-
# Locking pylint and required packages
31-
pylint==1.8.4; python_version < '3.4'
32-
pylint==2.9.3; python_version >= '3.6' and python_version <= '3.10'
33-
pylint==2.14.5; python_version >= '3.11'
34-
35-
# python-dotenv
36-
python-dotenv==0.15.0

eng/tox/prep_sphinx_env.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# This script is intended to be executed from within a tox script. It takes care of of unzipping
99
# an package sdist and prepping for a sphinx execution.
1010

11-
from m2r import parse_from_file
12-
1311
import glob
1412
import logging
1513
import shutil
@@ -30,34 +28,34 @@
3028

3129
RST_EXTENSION_FOR_INDEX = """
3230
33-
Indices and tables
34-
------------------
31+
## Indices and tables
32+
33+
- {{ref}}`genindex`
34+
- {{ref}}`modindex`
35+
- {{ref}}`search`
36+
37+
```{{toctree}}
38+
:caption: Developer Documentation
39+
:glob: true
40+
:maxdepth: 5
3541
36-
* :ref:`genindex`
37-
* :ref:`modindex`
38-
* :ref:`search`
42+
{}
3943
40-
.. toctree::
41-
:maxdepth: 5
42-
:glob:
43-
:caption: Developer Documentation
44+
```
4445
45-
{}
4646
"""
4747

4848
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))
4949
sphinx_conf = os.path.join(root_dir, "doc", "sphinx", "individual_build_conf.py")
5050

5151

5252
def should_build_docs(package_name):
53-
return not ("nspkg" in package_name or package_name in ["azure", "azure-mgmt", "azure-keyvault", "azure-documentdb", "azure-mgmt-documentdb", "azure-servicemanagement-legacy"])
53+
return not ("nspkg" in package_name or package_name in ["azure", "azure-mgmt", "azure-keyvault", "azure-documentdb", "azure-mgmt-documentdb", "azure-servicemanagement-legacy", "azure-core-tracing-opencensus"])
5454

5555
def create_index_file(readme_location, package_rst):
5656
readme_ext = os.path.splitext(readme_location)[1]
5757

5858
if readme_ext == ".md":
59-
output = parse_from_file(readme_location)
60-
elif readme_ext == ".rst":
6159
with open(readme_location, "r") as file:
6260
output = file.read()
6361
else:
@@ -83,20 +81,17 @@ def create_index(doc_folder, source_location, namespace):
8381
index_content = ""
8482

8583
package_rst = "{}.rst".format(namespace)
86-
content_destination = os.path.join(doc_folder, "index.rst")
84+
content_destination = os.path.join(doc_folder, "index.md")
8785

8886
if not os.path.exists(doc_folder):
8987
os.mkdir(doc_folder)
9088

9189
# grep all content
9290
markdown_readmes = glob.glob(os.path.join(source_location, "README.md"))
93-
rst_readmes = glob.glob(os.path.join(source_location, "README.rst"))
9491

9592
# if markdown, take that, otherwise rst
9693
if markdown_readmes:
9794
index_content = create_index_file(markdown_readmes[0], package_rst)
98-
elif rst_readmes:
99-
index_content = create_index_file(rst_readmes[0], package_rst)
10095
else:
10196
logging.warning("No readmes detected for this namespace {}".format(namespace))
10297
index_content = RST_EXTENSION_FOR_INDEX.format(package_rst)

eng/tox/tox.ini

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ setenv =
8686
{[testenv]setenv}
8787
PROXY_URL=http://localhost:5002
8888
deps =
89-
{[base]deps}
89+
-rdev_requirements.txt
90+
pylint==1.8.4; python_version < '3.4'
91+
pylint==2.9.3; python_version >= '3.6' and python_version <= '3.10'
92+
pylint==2.14.5; python_version >= '3.11'
9093
commands =
9194
python -m pip install pylint=={[testenv:pylint]pylint_version}
9295
python -m pip install azure-pylint-guidelines-checker==0.0.9 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
@@ -108,7 +111,10 @@ setenv =
108111
{[testenv]setenv}
109112
PROXY_URL=http://localhost:5002
110113
deps =
111-
{[base]deps}
114+
-rdev_requirements
115+
pylint==1.8.4; python_version < '3.4'
116+
pylint==2.9.3; python_version >= '3.6' and python_version <= '3.10'
117+
pylint==2.14.5; python_version >= '3.11'
112118
commands =
113119
python -m pip install pylint=={[testenv:next-pylint]pylint_version}
114120
python -m pip install azure-pylint-guidelines-checker==0.1.0 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
@@ -315,11 +321,9 @@ setenv =
315321
PROXY_URL=http://localhost:5007
316322
deps =
317323
{[base]deps}
318-
sphinx==3.5.4
319-
sphinx_rtd_theme==1.0.0
320-
recommonmark==0.6.0
321-
mistune<2.0.0
322-
m2r==0.2.1
324+
sphinx==6.2.1
325+
sphinx_rtd_theme==1.3.0
326+
myst_parser==2.0.0
323327
commands =
324328
python {repository_root}/eng/tox/create_package_and_install.py \
325329
-d {envtmpdir}/dist \

0 commit comments

Comments
 (0)