Skip to content

Commit 597a18a

Browse files
authored
Add sphinx.ext.intersphinx (#22)
1 parent 815b433 commit 597a18a

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
# -- General configuration ---------------------------------------------------
1414
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1515

16-
extensions = ['sphinx.ext.autodoc']
16+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
1717

1818
templates_path = ['_templates']
1919
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
2020

21-
21+
intersphinx_mapping = {
22+
"gufe": ("https://gufe.openfree.energy/en/stable", None),
23+
}
2224

2325
# -- Options for HTML output -------------------------------------------------
2426
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

docs/getting_started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Verify the installation was successful in a Python interpreter
2121
3. Quick-start example
2222
~~~~~~~~~~~~~~~~~~~~~~
2323

24-
You can calculate transformation weights for an ``AlchemicalNetwork``, ``alchem_network`` by calling a strategy's ``propose`` method.
24+
You can calculate transformation weights for an :external+gufe:py:class:`~gufe.network.AlchemicalNetwork`, ``alchem_network`` by calling a strategy's ``propose`` method.
2525

2626

2727
.. code:: python
@@ -36,10 +36,10 @@ You can calculate transformation weights for an ``AlchemicalNetwork``, ``alchem_
3636
strategy_result: StrategyResult = strategy.propose(alchem_network, previous_results)
3737
3838
39-
This returns a ``StrategyResult`` object, which is a mapping between the transformations in an ``AlchemicalNetwork`` and the weights determined by the strategy.
40-
``None`` weights are a terminating case: a transformation with a ``None`` weight won't be proposed again and a ``StrategyResult`` with only ``None`` weights is "complete".
39+
This returns a :py:class:`~stratocaster.base.strategy.StrategyResult` object, which is a mapping between the transformations in an :external+gufe:py:class:`~gufe.network.AlchemicalNetwork` and the weights determined by the strategy.
40+
``None`` weights are a terminating case: a transformation with a ``None`` weight won't be proposed again and a :py:class:`~stratocaster.base.strategy.StrategyResult` with only ``None`` weights is "complete".
4141

42-
Calls to ``propose`` are deterministic and guaranteed to reach a terminating condition if the resulting weights are used to update the ``ProtocolResult`` objects in ``previous_results``.
42+
Calls to ``propose`` are deterministic and guaranteed to reach a terminating condition if the resulting weights are used to update the :external+gufe:py:class:`~gufe.protocols.protocol.ProtocolResult` objects in ``previous_results``.
4343
See the :ref:`user guide<user-guide-label>` for an example of this process.
4444

4545
Other resources

docs/user_guide.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
User Guide
44
==========
55

6-
A ``Strategy`` is an algorithm that assists in traversing the execution path of transformations within ``gufe`` ``AlchemicalNetwork`` objects.
6+
A :py:class:`~stratocaster.base.strategy.Strategy` is an algorithm that assists in traversing the execution path of transformations within ``gufe`` :external+gufe:py:class:`~gufe.network.AlchemicalNetwork` objects.
77
It removes the burden for an individual or execution engine to determine which transformations in a network must be performed and how important one transformation is relative to another given results that have already been collected.
88
For instance, transformations with many previously calculated repeats might have a lower priority compared to transformations that haven't been performed at all.
9-
This prioritization is encoded by transformation weights, which are presented for an ``AlchemicalNetwork`` given a set of previously computed results.
9+
This prioritization is encoded by transformation weights, which are presented for an :external+gufe:py:class:`~gufe.network.AlchemicalNetwork` given a set of previously computed results.
1010
As results are accumulated, the strategy must eventually reach a terminating condition where no weights are presented.
11+
1112
Valid strategies are deterministic, i.e. networks with a fixed set of previous results always return the same weights.
1213
While the details of selecting and running a transformation from the weights is out of scope for ``stratocaster``, the following code demonstrates where a strategy might fit in an iterative execution workflow.
1314

@@ -16,27 +17,27 @@ While the details of selecting and running a transformation from the weights is
1617
A ``None`` weight for a transformation means the transformation should not be performed again as more results are added.
1718
This differs from a zero weight, which could mean the transformation will eventually be proposed again with more results.
1819
Note that before ``resolve`` (which returns a normalized set of weights) is called, the magnitudes of the weights are arbitrary and may reflect the underlying logic behind the specific strategy implementation.
19-
For example, the ``ConnectivityStrategy`` weights are, before correcting for repeated calculations, the average number of connections of the transformations' end states.
20-
Therefore, the pre-normalization weights directly report properties of the many subgraphs in the ``AlchemicalNetwork``.
20+
For example, the :py:class:`~stratocaster.strategies.ConnectivityStrategy` weights are, before correcting for repeated calculations, the average number of connections of the transformations' end states.
21+
Therefore, the pre-normalization weights directly report properties of the many subgraphs in the :py:class:`~gufe.network.AlchemicalNetwork`.
2122

2223
Defining a new ``Strategy``
2324
---------------------------
2425

25-
A new ``Strategy`` implementation requires definitions of a new ``Strategy`` subclass along with a ``StrategySettings`` subclass specific to the new strategy.
26+
A new :py:class:`~stratocaster.base.strategy.Strategy` implementation requires definitions of a new :py:class:`~stratocaster.base.strategy.Strategy` subclass along with a :py:class:`~stratocaster.base.models.StrategySettings` subclass specific to the new strategy.
2627

27-
The new ``StrategySettings`` is the mechanism by which a user will alter behavior of the new ``Strategy``.
28-
As such, it should define the relevant variables on which the ``Strategy`` will depend.
28+
The new ``StrategySettings`` is the mechanism by which a user will alter behavior of the new :py:class:`~stratocaster.base.strategy.Strategy`.
29+
As such, it should define the relevant variables on which the :py:class:`~stratocaster.base.strategy.Strategy` will depend.
2930
In the below example, we include only a ``max_runs`` setting, which is usually enough to guarantee that the strategy reaches a termination condition.
3031

31-
The new ``Strategy`` implementation involves three main steps: 1) linking the strategy to its settings class, 2) defining the ``_default_settings`` class method, and 3) defining the ``_propose`` method.
32+
The new :py:class:`~stratocaster.base.strategy.Strategy` implementation involves three main steps: 1) linking the strategy to its settings class, 2) defining the ``_default_settings`` class method, and 3) defining the ``_propose`` method.
3233

3334
.. literalinclude:: ./code/newstrat.py
3435

3536
A definition of ``_settings_cls`` provides a guardrail by preventing a user of your strategy from supplying an unexpected settings type.
3637
Defining ``_default_settings`` allows a user to get the default settings through ``MyCustomStrategy.default_settings()``.
3738
If your settings provide an exhaustive set of default options, simply return an instance of your settings without providing hard-coded keyword arguments.
3839

39-
Lastly, the ``_propose`` method implementation determines the results of a strategy prediction based on the ``AlchemicalNetwork``, prior results from executing ``Transformation`` protocols, and your settings.
40-
This method should be deterministic: repeated proposals given the same set of results will yield the same ``StrategyResult``.
40+
Lastly, the ``_propose`` method implementation determines the results of a strategy prediction based on the :external+gufe:py:class:`~gufe.network.AlchemicalNetwork`, prior results from executing :external+gufe:py:class:`~gufe.transformations.transformation.Transformation` protocols, and your settings.
41+
This method should be deterministic: repeated proposals given the same set of results will yield the same :py:class:`~stratocaster.base.StrategyResult`.
4142
It should also have a clear termination condition.
42-
If results are accumulated as a result of the recommendations provided by the strategy, the ``StrategyResult`` will eventually return ``None`` weights for all transformations in the network.
43+
If results are accumulated as a result of the recommendations provided by the strategy, the :py:class:`~stratocaster.base.StrategyResult` will eventually return ``None`` weights for all transformations in the network.

0 commit comments

Comments
 (0)