Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Gets rid of all doc gen warnings for Python 3.7 (#188)
Browse files Browse the repository at this point in the history
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 a362374
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Expand Up @@ -44,15 +44,15 @@ jobs:
destination: coverage destination: coverage
build_docs: build_docs:
docker: docker:
- image: circleci/python:3.6 - image: circleci/python:3.7
steps: steps:
- checkout - checkout
- run: - run:
name: setup name: setup
command: source .circleci/setup_circleimg.sh command: source .circleci/setup_circleimg.sh
- run: - run:
name: install_pytorch 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: - run:
name: install docs build deps name: install docs build deps
command: sudo pip install -r pytext/docs/requirements.txt command: sudo pip install -r pytext/docs/requirements.txt
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -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 (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 ## License
By contributing to PyText, you agree that your contributions will be licensed By contributing to PyText, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree. under the LICENSE file in the root directory of this source tree.
2 changes: 1 addition & 1 deletion pytext/docs/Makefile
Expand Up @@ -2,7 +2,7 @@
# #


# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXOPTS = "-j=auto" SPHINXOPTS = -j=auto -W
SPHINXBUILD = sphinx-build SPHINXBUILD = sphinx-build
SPHINXPROJ = PyText SPHINXPROJ = PyText
SOURCEDIR = source SOURCEDIR = source
Expand Down
5 changes: 4 additions & 1 deletion pytext/docs/make_config_docs.py
Expand Up @@ -85,7 +85,10 @@ def marked_up_type_name(arg_type):
return f"Union[{', '.join(options)}]" return f"Union[{', '.join(options)}]"
elif hasattr(arg_type, "__args__"): elif hasattr(arg_type, "__args__"):
options = [marked_up_type_name(t) for t in 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: elif arg_type is typing.Any:
return f"Any" return f"Any"
elif issubclass(arg_type, ConfigBase): elif issubclass(arg_type, ConfigBase):
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Expand Up @@ -2,7 +2,7 @@ build:
image: latest image: latest


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

0 comments on commit a362374

Please sign in to comment.