This repository contains the source for comprehensive technical reference documentation for the DataJoint framework.
All DataJoint documentations are presented at DataJoint documentation website. Documentation is generated using Sphinx with custom rendering theme largely based on the Read The Doc theme.
It is recommended to use any of the 2 available docker environments for developing: build
and dev
. Ensure that you have Docker and Docker Compose installed following the specific instructions for your operating system. For details regarding each environment, see the respective *.docker-compose.yaml
files which contain a header comment at the top which indicate:
- The recommended command to run the environment.
- The intended usage for the environment along with other important notes.
Read on for more details on running the docs natively and writing style guidelines.
With the current GitHub Actions code pipeline, all that is needed to make a release is to git tag
a version locally and push with git push upstream vX.X.X
. This will automatically run build, tests, and publish steps. To see the specifics, have a look in .github/workflows/development.yaml
and to run the steps manually, see Notes on Tagging
section below.
The documentation can be distributed for free use under the Creative Commons Attribution-ShareAlike 4.0 International Public License. Any copy or derivation of the documentation must include attribution to "DataJoint contributors" and include the URL reference https://docs.datajoint.org
- Clone the repository to your local machine.
- The default setting will build using
datajoint/datajoint-docs.git
,datajoint/datajoint-matlab.git
anddatajoint/datajoint-python.git
repo. If you'd like to change the repo that the build points to, modify the content of thebuild_config_template.py
and rename the file tobuild_config.py
(follow the instruction inside the template file for further instructions) - Build the website by running
python build-all.py
. This will build and generate the static website in thefull_site
directory.
- Note for Windows users: Please manually remove the
build-all
folder before runningpython build-all.py
for building second time and on...
- Move inside the
full_site
folder and run the following command to launch a local web server:This should launch a HTTP server locally serving files from the$ python3 -m http.server
full_site
directory. - Finally open up a web browser and navigate to
http://localhost:8000
- you should see the built documentation page. The port (i.e. the number after the colon:
) may differ - refer to the output of the command from the step above for the actual port to use. - If you made changes to the documentation source but you're not seeing the changes reflected, that is because this command builds from contents that are already pushed and tagged in the git repository. Please build locally to test, and then push with updated version numbers to see the changes in the full_site building.
- To stop the server, hit
Ctrl+C
in the terminal window that's running the server.
- Fork and clone the repository to your local machine. Note: datajoint-docs now only contains the common documentions. If you are writing for a specific language, you also need to clone the datajoint-matlab or datajoint-python repository and make sure they are placed on the same level as the datajoint-docs folder.
- If you have the Python/MATLAB repository for local development/building and the folders aren't named
datajoint-python
/datajoint-matlab
or have them somewhere other than on the same level as thedatajoint-docs
folder, open thebuild_config_template.py
and set the new path inside, then rename the config file tobuild_config.py
(follow the instruction inside the template file for further instructions) - Build the website by running
python build-local.py
. This will build and generate the static website in theloc_built_site
directory.
- Note for Windows users: Please manually remove the
build-local
folder before runningpython build-local.py
for building second time and on... - Note 1:
python build-local.py
defaults to building the most updated local common documentation. If you have bothdatajoint-matlab
ordatajoint-python
folder locally on the same level, then this will build using those local folders (check and edit thebuild-config.py
to make sure the local language folders are correctly placed). If you don't have a local language-specific folder, then it will still build using the most current lang-specific documentation on its respective git repository. - Note 2: If you want to test-build a specific language version locally, then add
python/matlab_tag=(version)
after thepython build-local.py
. For example,python build-local.py matlab_tag=v3.2.5
orpython build-local.py python_tag=v0.9.4
and this should automatically grab the matching common version for building. Make sure you are specifying the full version tag (and not the abbreviated v3.2 in this case). Note 3: If for some reason, you don't want to build using the local common version, you can also build using the most updated common version on the git repository by runningpython build-local.py False
orpython build-local.py loc_comm=False
. This is mostly likely not going to work well if you already have a pre-existing local language-specific folder.
- Move inside the
loc_built_site
folder and run the following command to launch a local web server:This should launch a HTTP server locally serving files from the$ python3 -m http.server
loc_built_site
directory. - Finally open up a web browser and navigate to
http://localhost:8000
- you should see the built documentation page. The port (i.e. the number after the colon:
) may differ - refer to the output of the command from the step above for the actual port to use. - To stop the server, hit
Ctrl+C
in the terminal window that's running the server.
- Before you tag anything, please
git tag
to make sure you see the current tag status. - In the
datajoint-docs
folder,build-version.json
specifies which language versions to build in the build-all/full-build-mode. If you specify v3.2 in matlab, then the site will be built using the most recent tag (ex. v3.2.5 will be used to build, not v3.2.4). - In the language-specific folder, all documentation contents are inside the
/docs-parts
directory. Inside, you will see a_version_common.json
file, which should only contain one corresponding common version tag for this language folder to be build alongside. This file specifies the version (ex. v0.0) for the common version. Similar to the build process described above, if v0.0 is specified in the_version_common.json
, then the most recent tag, for example v0.0.5 instead of v0.0.4 will be grabbed for the build. -
- to add a doc specific tag to
datajoint-python
ordatajoint-matlab
repo, make sure to add the-doc#
ending:git tag -a v3.2.5-doc1 -m "some message"
. The # should be an integer. - to add a common doc tag to
datajoint-docs
repo, no special ending is necessary:git tag -a v0.0.1 -m "some message
- to delete local tag:
git tag -d v3.2.5-doc1
- to delete already-pushed tag:
git push origin :refs/tags/v3.2.5-doc1
- to push with tag
git push origin v0.0.3
- to add a doc specific tag to
-
For inserting a SQL code-block, be sure to use
.. code-block:: mysql
(and NOTSQL
) -
For inserting an image, make sure to put the image inside the
contents/_static/img
folder and refer to it using theimage
directive:.. image:: ../_static/img/pipeline.png :width: 250px :align: center :alt: A data pipeline
Alternatively you can also use
figure
directive. For more information, refer to the documentation of image and/or figure directives. -
For referring to a language-specific content, use
.. include:: [FILENAME OF COMMON]_lang[#].rst
-
For example, if you are editing the RST file
01-autopopulate.rst
inside ofcontents/computation
then you would refer to language specific parts with.. include:: 01-autopopulate_lang1.rst
and.. include:: 01-autopopulate_lang2.rst
if you have 2 sections. -
Then inside the language specific contents inside
docs-parts
folder indatajoint-matlab
/datajoint-python
, make sure to add a RST file with the same format as[FILENAME OF COMMON]_lang[#].rst
. Following the previous example - inside ofdatajoint-matlab/docs-parts
folder, you should put01-autopopulate_lang1.rst
and01-autopopulate_lang2.rst
inside the computation folder and do the same in inside thedatajoint-python
. For organization purposes, if one language has more includes than the other, it is recommended that you still keep an empty rst file as a placeholder inside the language that has less includes.
-