Skip to content

Commit

Permalink
Fixes to docs and an example (#73)
Browse files Browse the repository at this point in the history
* Switch to Forge DGL in examples and docs environments

* Update train-gnn-notebook.ipynb with new version argument

* Fix API docs and upgrade to Sphinx 6

* Fix notebook in train-multi-objective-gnn

"No... There is another" - Yoda
  • Loading branch information
Yoshanuikabundi authored Mar 21, 2024
1 parent ffce46e commit 9c6258a
Show file tree
Hide file tree
Showing 15 changed files with 296 additions and 1,083 deletions.
5 changes: 2 additions & 3 deletions devtools/conda-envs/docs_env.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: openff-nagl-docs
channels:
- dglteam
- openeye
- conda-forge
- defaults
Expand All @@ -26,7 +25,7 @@ dependencies:
- pyarrow

# gcn
- dglteam::dgl >=0.7
- dgl >=1.0
- pytorch
- pytorch-lightning

Expand All @@ -43,7 +42,7 @@ dependencies:
- myst-nb
- myst-parser>=0.16
- docutils
- sphinx<5
- sphinx=6
- sphinx-notfound-page
- autodoc-pydantic
- sphinx-click
Expand Down
4 changes: 2 additions & 2 deletions devtools/conda-envs/examples_env.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: openff-nagl-test
channels:
- dglteam
- openeye
- conda-forge
- defaults
Expand All @@ -23,6 +22,7 @@ dependencies:
# chemistry
- openff-toolkit >=0.11.1
- openff-units
- openff-recharge
- pydantic <3
- rdkit
- openeye-toolkits
Expand All @@ -31,7 +31,7 @@ dependencies:
- pyarrow

# gcn
- dglteam::dgl >=1.0
- dgl >=1.0
- pytorch
- pytorch-lightning
- tensorboard
Expand Down
21 changes: 17 additions & 4 deletions docs/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,30 @@
.. automodule:: {{ fullname }}

{% block modules %}
{% if modules %}

{%- set doc_modules = [] -%}
{%- for item in all_modules -%}
{%- if item.startswith(fullname) -%}
{%- set item = item[fullname | length+1:] -%}
{%- endif -%}
{%- if not (
item.startswith('_')
or item in exclude_modules
or fullname + "." + item in exclude_modules
) -%}
{%- set _ = doc_modules.append(item) -%}
{%- endif -%}
{%- endfor %}

{% if doc_modules %}
.. rubric:: Modules

.. autosummary::
:caption: Modules
:toctree:
:recursive:
{% for item in modules %}
{%- if item not in exclude_modules %}
{% for item in doc_modules %}
~{{ item }}
{% endif -%}
{%- endfor %}

{% endif %}
Expand Down
6 changes: 4 additions & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
:::{eval-rst}
# CLI Reference

```{eval-rst}
.. click:: openff.nagl._cli:cli
:prog: openff-nagl
:nested: full
:::
```
4 changes: 2 additions & 2 deletions docs/designing.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ bond_features:

```

And then loaded with the [`GNNModel.from_yaml_file()`] method:
And then loaded with the [`GNNModel.from_yaml()`] method:

```python
from openff.nagl import GNNModel

model = GNNModel.from_yaml_file("model.yml")
model = GNNModel.from_yaml("model.yml")
```

Here we'll go through each option, what it means, and where to find the available choices.
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ cli.md
The autosummary directive renders to rST,
so we must use eval-rst here
-->
:::{eval-rst}
```{eval-rst}
.. raw:: html
<div style="display: None">
Expand All @@ -107,4 +107,4 @@ so we must use eval-rst here
.. raw:: html
</div>
:::
```
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mamba create -n nagl -c conda-forge openff-nagl
conda activate nagl
```

If you do not have Conda or Mamba installed, see the [OpenFF installation documentation](openff.docs:install).
If you do not have Conda or Mamba installed, see the [OpenFF installation documentation](inv:openff.docs#install).

We recommend keeping environments minimal, and only installing packages you use together. Environments can be safely discarded when you no longer need them. This avoids dependency conflicts common to large Python environments. If you prefer, NAGL may be installed into the current environment:

Expand All @@ -30,7 +30,7 @@ conda config --env --set channel_priority strict

In environments with this configuration, the `-c conda-forge` switch is unnecessary. Other channels, like `psi4` and `bioconda`, can still be used in the usual way.

More information on installing OpenFF packages can be found in the [OpenFF installation documentation](openff.docs:install).
More information on installing OpenFF packages can be found in the [OpenFF installation documentation](inv:openff.docs#install).

## Installation from source

Expand Down
4 changes: 2 additions & 2 deletions docs/theory.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ Molecular graphs are provided to NAGL via the [`Molecule`] class of the [OpenFF
[`Molecule`]: openff.toolkit.topology.Molecule
[SMILES string]: openff.toolkit.topology.Molecule.from_smiles
[.SDF file]: openff.toolkit.topology.Molecule.from_file
[OpenFF Toolkit]: openff.toolkit:index
[variety of ways]: openff.toolkit:users/molecule_cookbook
[OpenFF Toolkit]: inv:openff.toolkit#index
[variety of ways]: inv:openff.toolkit#users/molecule_cookbook
[`GNNModel.compute_property()`]: openff.nagl.GNNModel.compute_property
[`MoleculeRecord.from_openff()`]: openff.nagl.storage.record.MoleculeRecord.from_openff
[`MoleculeRecord.from_precomputed_openff()`]: openff.nagl.storage.record.MoleculeRecord.from_precomputed_openff
Expand Down
2 changes: 1 addition & 1 deletion docs/training.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ trainer.test(model, data_module)
model.save("model.pt")
```

[`Trainer`]: pytorch_lightning:common/trainer
[`Trainer`]: inv:pytorch_lightning#common/trainer
Binary file not shown.
Loading

0 comments on commit 9c6258a

Please sign in to comment.