diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..43b19213 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + lint_docs: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v1 + + - name: Install dependencies + run: python3 -m pip install -r docs/requirements.txt + + - name: Run files generation tests + run: pre-commit run --all-files && [[ -z "$(git status -s)" ]] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..9ab3919c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: +- repo: local + hooks: + - id: preprocess-py + name: preprocess-py + entry: python3 docs/examples/preprocess.py + language: python + pass_filenames: false diff --git a/docs/examples/data/hf/README.rst b/docs/examples/data/hf/README.rst index d051b892..4a25cc74 100644 --- a/docs/examples/data/hf/README.rst +++ b/docs/examples/data/hf/README.rst @@ -4,12 +4,15 @@ Hugging Face Dataset **Prerequisites** -Make sure to read the following sections of the documentation before using this example: +Make sure to read the following sections of the documentation before using this +example: * :ref:`pytorch_setup` * :ref:`001 - Single GPU Job` -The full source code for this example is available on `the mila-docs GitHub repository. `_ +The full source code for this example is available on `the mila-docs GitHub +repository. +`_ **job.sh** diff --git a/docs/examples/data/hf/_index.rst b/docs/examples/data/hf/_index.rst index d33c71ce..3ffbba3f 100644 --- a/docs/examples/data/hf/_index.rst +++ b/docs/examples/data/hf/_index.rst @@ -4,12 +4,15 @@ Hugging Face Dataset **Prerequisites** -Make sure to read the following sections of the documentation before using this example: +Make sure to read the following sections of the documentation before using this +example: * :ref:`pytorch_setup` * :ref:`001 - Single GPU Job` -The full source code for this example is available on `the mila-docs GitHub repository. `_ +The full source code for this example is available on `the mila-docs GitHub +repository. +`_ **job.sh** diff --git a/docs/examples/data/torchvision/README.rst b/docs/examples/data/torchvision/README.rst index c2be7b81..68b93c24 100644 --- a/docs/examples/data/torchvision/README.rst +++ b/docs/examples/data/torchvision/README.rst @@ -4,12 +4,15 @@ Torchvision **Prerequisites** -Make sure to read the following sections of the documentation before using this example: +Make sure to read the following sections of the documentation before using this +example: * :ref:`pytorch_setup` * :ref:`001 - Single GPU Job` -The full source code for this example is available on `the mila-docs GitHub repository. `_ +The full source code for this example is available on `the mila-docs GitHub +repository. +`_ **job.sh** @@ -242,7 +245,7 @@ The full source code for this example is available on `the mila-docs GitHub repo val_split_seed: int = 42, ): - """Returns the training, validation, and test splits for CIFAR10. - + """Returns the training, validation, and test splits for ImageNet. + + """Returns the training, validation, and test splits for iNat. NOTE: We don't use image transforms here for simplicity. Having different transformations for train and validation would complicate things a bit. diff --git a/docs/examples/data/torchvision/_index.rst b/docs/examples/data/torchvision/_index.rst index 77ab7445..37eed0d5 100644 --- a/docs/examples/data/torchvision/_index.rst +++ b/docs/examples/data/torchvision/_index.rst @@ -4,12 +4,15 @@ Torchvision **Prerequisites** -Make sure to read the following sections of the documentation before using this example: +Make sure to read the following sections of the documentation before using this +example: * :ref:`pytorch_setup` * :ref:`001 - Single GPU Job` -The full source code for this example is available on `the mila-docs GitHub repository. `_ +The full source code for this example is available on `the mila-docs GitHub +repository. +`_ **job.sh** diff --git a/docs/examples/data/torchvision/main.py b/docs/examples/data/torchvision/main.py index 015394e0..0c1ba6b3 100644 --- a/docs/examples/data/torchvision/main.py +++ b/docs/examples/data/torchvision/main.py @@ -143,7 +143,7 @@ def make_datasets( val_split: float = 0.1, val_split_seed: int = 42, ): - """Returns the training, validation, and test splits for ImageNet. + """Returns the training, validation, and test splits for iNat. NOTE: We don't use image transforms here for simplicity. Having different transformations for train and validation would complicate things a bit. diff --git a/docs/examples/distributed/001_single_gpu/README.rst b/docs/examples/distributed/001_single_gpu/README.rst index 06630177..bb3c7344 100644 --- a/docs/examples/distributed/001_single_gpu/README.rst +++ b/docs/examples/distributed/001_single_gpu/README.rst @@ -3,11 +3,14 @@ **Prerequisites** -Make sure to read the following sections of the documentation before using this example: +Make sure to read the following sections of the documentation before using this +example: * :ref:`pytorch_setup` -The full source code for this example is available on `the mila-docs GitHub repository. `_ +The full source code for this example is available on `the mila-docs GitHub +repository. +`_ **job.sh** diff --git a/docs/examples/distributed/001_single_gpu/_index.rst b/docs/examples/distributed/001_single_gpu/_index.rst index d009b08f..e6ea26f0 100644 --- a/docs/examples/distributed/001_single_gpu/_index.rst +++ b/docs/examples/distributed/001_single_gpu/_index.rst @@ -3,11 +3,14 @@ **Prerequisites** -Make sure to read the following sections of the documentation before using this example: +Make sure to read the following sections of the documentation before using this +example: * :ref:`pytorch_setup` -The full source code for this example is available on `the mila-docs GitHub repository. `_ +The full source code for this example is available on `the mila-docs GitHub +repository. +`_ **job.sh** diff --git a/docs/requirements.txt b/docs/requirements.txt index 5241fa09..7c4887f1 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ # Python Packages +pre-commit sphinx>=4.0.2 # Sphinx Extensions