Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ mmif/vocabulary
./VERSION*
.hypothesis


# sphinx/autodoc files
documentation/_build/

/VERSION
_issues

# Documentation build artifacts
documentation/cli_help.rst
documentation/whatsnew.rst
docs-test
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing to mmif-python

## Documentation

The documentation for `mmif-python` is built using Sphinx and published to the [CLAMS documentation hub](https://github.com/clamsproject/website-test).

### Building Documentation Locally

To build the documentation for the current checkout:

```bash
make doc
# OR
python3 build-tools/docs.py
```

The output will be in `documentation/_build/html`.

### Building Documentation for Old Versions

To build documentation for a specific historical version (e.g., `v1.0.0`):

```bash
make doc-version
# OR
python3 build-tools/docs.py --build-ver v1.0.0
```

This runs the build in a sandboxed temporary directory. The output will be in `docs-test/<version>`.

### Troubleshooting Old Version Builds

**Important:** The build script (`build-tools/docs.py`) uses a "Modern Environment, Legacy Source" strategy. It checks out the old source code but installs **modern** build dependencies (Sphinx 7.x, Furo) to ensure the build works on current systems (including Python 3.13).

If an old version fails to build because a dependency is missing (e.g., it was removed from `requirements.txt` in later versions but the old `setup.py` needs it), **do not try to fix the old `setup.py`**.

Instead, manually add the missing dependency to the `run_pip` call in `build-tools/docs.py`:

```python
# In build-tools/docs.py
def build_versioned_docs(...):
# ...
# Add the missing dependency here
env.run_pip("install", "jsonschema", "requests", "pyyaml", "deepdiff<7", "YOUR_MISSING_DEP", cwd=source_path)
```

This "overlay" strategy ensures we can build old docs without modifying historical git tags.
25 changes: 12 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ publish: distclean version package test

$(generatedcode): dist/$(sdistname)*.tar.gz

docs: latest := $(shell git tag | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr | head -n 1)
docs: VERSION $(generatedcode)
rm -rf docs
pip install --upgrade -r requirements.txt
pip install --upgrade -r requirements.old
sphinx-multiversion documentation docs -b html -a
touch docs/.nojekyll
ln -sf $(latest) docs/latest
echo "<!DOCTYPE html> <html> <head> <title>Redirect to latest version</title> <meta charset=\"utf-8\"> <meta http-equiv=\"refresh\" content=\"0; url=./latest/index.html\"> </head> </html>" > docs/index.html

doc: VERSION $(generatedcode) # for single version sphinx - only use when developing
rm -rf docs
sphinx-build documentation docs -b html -a
docs:
@echo "WARNING: The 'docs' target is deprecated and will be removed."
@echo "The 'docs' directory is no longer used. Documentation is now hosted in the central CLAMS documentation hub."
@echo "Use 'make doc' for local builds or 'make doc-version' for specific versions."
@echo "Nothing is done."

doc: # for single version sphinx - builds current source
python3 build-tools/docs.py

doc-version: # interactive build for specific version
@read -p "Enter version/tag to build (e.g., v1.0.0): " ver; \
[ -n "$$ver" ] && python3 build-tools/docs.py --build-ver $$ver

package: VERSION dist/$(sdistname)*.tar.gz

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ including ;
* [Version history and patch notes](https://github.com/clamsproject/mmif-python/blob/main/CHANGELOG.md)
* [MMIF Python API documentation](https://clamsproject.github.io/mmif-python)
* [MMIF JSON specification and schema](https://clamsproject.github.io/mmif)

## For devs ...
* Build documentation: `python build-tools/docs.py --help`
Loading
Loading