Permalink
Browse files

Gets rid of all doc gen warnings for Python 3.7 (#188)

Summary:
This fixes the error that was preventing doc generation in Python 3.7. Note that doc generation will still throw a warning for 3.6, but a lot of time has been spent trying to fix that by Chris and me and moving ahead is the best approach anyway. Therefore, this commit also updates doc generation on CircleCI and ReadTheDocs to Python 3.7. Finally, enabling failures on warning for Sphinx doc gen so we lock this down for good.

Tested by building docs locally without errors

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Pull Request resolved: #188

Reviewed By: hikushalhere

Differential Revision: D13582311

Pulled By: snisarg

fbshipit-source-id: e415d0740f9131ac875ab45183dceab90babb9df
  • Loading branch information...
snisarg authored and facebook-github-bot committed Jan 8, 2019
1 parent e05811c commit a3623749d4d4ea8169945bdc10b80b11d3b8bc0a
Showing with 11 additions and 5 deletions.
  1. +2 −2 .circleci/config.yml
  2. +3 −0 CONTRIBUTING.md
  3. +1 −1 pytext/docs/Makefile
  4. +4 −1 pytext/docs/make_config_docs.py
  5. +1 −1 readthedocs.yml
@@ -44,15 +44,15 @@ jobs:
destination: coverage
build_docs:
docker:
- image: circleci/python:3.6
- image: circleci/python:3.7
steps:
- checkout
- run:
name: setup
command: source .circleci/setup_circleimg.sh
- run:
name: install_pytorch
command: sudo pip install --progress-bar off http://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl
command: sudo pip install --progress-bar off http://download.pytorch.org/whl/cpu/torch-1.0.0-cp37-cp37m-linux_x86_64.whl
- run:
name: install docs build deps
command: sudo pip install -r pytext/docs/requirements.txt
@@ -35,6 +35,9 @@ We use isort and black to format our code, you can use the following commands to
(pytext_venv) $ isort pytext --recursive --multi-line 3 --trailing-comma --force-grid-wrap 0 --line-width 88 --lines-after-imports 2 --combine-as --section-default THIRDPARTY
```

## Updates to Docs
The documentation build process work with Python 3.7 and above.

## License
By contributing to PyText, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
@@ -2,7 +2,7 @@
#

# You can set these variables from the command line.
SPHINXOPTS = "-j=auto"
SPHINXOPTS = -j=auto -W
SPHINXBUILD = sphinx-build
SPHINXPROJ = PyText
SOURCEDIR = source
@@ -85,7 +85,10 @@ def marked_up_type_name(arg_type):
return f"Union[{', '.join(options)}]"
elif hasattr(arg_type, "__args__"):
options = [marked_up_type_name(t) for t in arg_type.__args__]
return f"{arg_type.__name__}[{', '.join(options)}]"
type_name = (
arg_type.__origin__.__name__ if arg_type.__origin__ else arg_type.__name__
)
return f"{type_name}[{', '.join(options)}]"
elif arg_type is typing.Any:
return f"Any"
elif issubclass(arg_type, ConfigBase):
@@ -2,7 +2,7 @@ build:
image: latest

python:
version: 3.6
version: 3.7
setup_py_install: true
use_system_site_packages: true
requirements_file: docs_requirements.txt

0 comments on commit a362374

Please sign in to comment.