Skip to content

Commit 4033173

Browse files
authored
Merge pull request #154 from OpenProteinAI/feat/autosummary_api_reference
Python Client Documentation Improvements
2 parents 0d5073a + 187f7bd commit 4033173

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3659
-2222
lines changed

flake.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
devShells.default = pkgs.mkShell {
1919
packages = with pkgs; [
2020
bashInteractive
21-
python313Packages.jupytext
21+
dprint
2222
];
23+
shellHook = ''
24+
eval $(pixi shell-hook)
25+
'';
2326
};
2427
}
2528
);

pixi.lock

Lines changed: 1122 additions & 776 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name = "openprotein-docs"
33
version = "0.1.0"
44
description = "Documentation for OpenProtein"
55
readme = "README.md"
6-
requires-python = ">=3.8"
6+
requires-python = ">=3.8,<3.13"
77
classifiers = [
88
"Programming Language :: Python :: 3",
99
"License :: OSI Approved :: MIT License",
1010
"Operating System :: OS Independent",
1111
]
1212
dependencies = [
13-
"sphinx>=7.3.0,<7.4.0",
13+
"sphinx>=7,<10",
1414
"pydata-sphinx-theme>=0.16.1,<0.17.0",
1515
"recommonmark>=0.7.0,<0.8.0",
1616
"nbsphinx>=0.9.0,<0.10.0",
@@ -19,13 +19,13 @@ dependencies = [
1919
"sphinx-togglebutton>=0.3.0,<0.4.0",
2020
"sphinx-copybutton>=0.5.0,<0.6.0",
2121
"sphinxcontrib-bibtex>=2.6.0,<2.7.0",
22-
"swagger_plugin_for_sphinx>=3.5.0,<3.6.0",
2322
"sphinxcontrib-httpdomain>=1.8.0,<1.9.0",
2423
"sphinx-new-tab-link>=0.4.0,<0.5.0",
2524
"sphinx-notfound-page>=1.1.0,<1.2.0",
26-
"sphinx-panels>=0.4.1,<0.5.0",
25+
"sphinx-design>=0.6.1,<0.7",
2726
# autodoc
28-
"openprotein-python==0.8.12",
27+
"openprotein-python==0.9.0",
28+
"ipython>=9.8.0,<10",
2929
]
3030

3131
[build-system]
@@ -42,7 +42,7 @@ build = "sphinx-build source build"
4242
[tool.pixi.feature.dev.tasks]
4343
# install dev version of the client
4444
dev = "sphinx-autobuild source build --port 5001"
45-
devinstall = "pip install --no-build-isolation --no-deps --disable-pip-version-check -e ../openprotein-python-private"
45+
devinstall = "pip install -e ../openprotein-python-private"
4646

4747
[dependency-groups]
4848
dev = [
@@ -52,6 +52,7 @@ dev = [
5252
"hatchling>=1.26.1",
5353
"hatch-vcs>=0.5.0,<1",
5454
"editables>=0.5,<0.6",
55+
"jupytext>=1.18.1,<2",
5556
]
5657

5758
[tool.pixi.environments]

source/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,24 @@
1616
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1717

1818
extensions = [
19-
"sphinx.ext.autodoc",
20-
"sphinx.ext.napoleon",
19+
"sphinx.ext.autodoc", # auto pull docstrings
20+
"sphinx.ext.napoleon", # handles numpy/google-style docstrings
2121
"sphinx.ext.viewcode",
2222
"recommonmark",
2323
"sphinx_markdown_tables",
2424
"sphinx_markdown_builder",
25-
"nbsphinx",
25+
"nbsphinx", # renders notebooks
2626
"sphinx.ext.duration",
2727
"sphinx.ext.doctest",
28-
"sphinx.ext.autosummary",
29-
"sphinx.ext.intersphinx",
30-
"sphinx.ext.todo",
28+
"sphinx.ext.autosummary", # generate api reference summary
29+
# "sphinx.ext.todo",
3130
"sphinx_togglebutton",
3231
"sphinx_copybutton",
3332
"sphinxcontrib.bibtex",
34-
"swagger_plugin_for_sphinx",
3533
"sphinxcontrib.httpdomain",
3634
"sphinx_new_tab_link",
3735
"notfound.extension",
38-
"sphinx_panels",
36+
"sphinx_design",
3937
]
4038

4139
# -- Options for autodoc ----------------------------------------------------
@@ -46,6 +44,8 @@
4644
# descriptions of the relevant function/method.
4745
autodoc_typehints = "description"
4846

47+
autodoc_typehints_description_target = "documented"
48+
4949
# Don't show class signature with the class' name.
5050
autodoc_class_signature = "mixed"
5151

@@ -88,7 +88,7 @@
8888
"header_links_before_dropdown": 6,
8989
"show_prev_next": False,
9090
"use_edit_page_button": False,
91-
"show_nav_level": 0,
91+
# "show_nav_level": 0,
9292
"navbar_align": "left",
9393
"navbar_persistent": [
9494
"search-button",

source/getting-started/account-page.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Logging into your account
66

77
Log in to the `web platform <https://app.openprotein.ai>`_ with your username and password.
88

9-
.. image:: ../../_static/getting-started/login.png
9+
.. image:: /_static/getting-started/login.png
1010
:width: 500
1111
:align: center
1212

1313
You can also log in from our `home page <https://openprotein.ai>`_.
1414

15-
.. image:: ../../_static/getting-started/acct-login-homepage.png
15+
.. image:: /_static/getting-started/acct-login-homepage.png
1616
:width: 500
1717
:align: center
1818

@@ -26,6 +26,6 @@ Resetting your password
2626

2727
To change your password, navigate to the account icon on the top right corner of the page, and select **Change password**.
2828

29-
.. image:: ../../_static/getting-started/change-password.png
29+
.. image:: /_static/getting-started/change-password.png
3030
:width: 700
3131
:align: center

source/getting-started/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
.. include:: ./get-started-with-no-code.rst
1+
.. include:: quickstart-web.rst
22

33
.. toctree::
44
:hidden:
55
:maxdepth: 2
66

7-
Get started with no code <get-started-with-no-code>
8-
Get started with our API <get-started-with-our-api>
9-
Account information <account-page>
7+
quickstart-web
8+
quickstart-api
9+
account-page

source/getting-started/get-started-with-our-api.rst renamed to source/getting-started/quickstart-api.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Step 1: Request `early access <https://openprotein-ai.webflow.io/early-access-fo
3535
Use your username and password credentials generated at sign-up to authenticate your connection to OpenProtein.AI's backend.
3636

3737
.. code-block:: python
38+
3839
import openprotein
3940
4041
with open('secrets.config', 'r') as f:
@@ -83,7 +84,7 @@ Do you want to...
8384

8485
<div class="row mb-3">
8586
<div class="col-md-2 get-started-img">
86-
<img src="../_static/getting-started/poet-icon.png" height="60px">
87+
<img src="/_static/getting-started/poet-icon.png" height="60px">
8788
</div>
8889
<div class="col-md-10">
8990
<b>Make sequence predictions or designs without using any data?</b><br/>
@@ -92,7 +93,7 @@ Do you want to...
9293
</div>
9394
<div class="row mb-3">
9495
<div class="col-md-2 get-started-img">
95-
<img src="../_static/getting-started/bar-chart.png" height="60px">
96+
<img src="/_static/getting-started/bar-chart.png" height="60px">
9697
</div>
9798
<div class="col-md-10">
9899
<b>Analyze your experimental data for library design?</b><br/>
@@ -102,7 +103,7 @@ Do you want to...
102103
</div>
103104
<div class="row mb-3">
104105
<div class="col-md-2 get-started-img">
105-
<img src="../_static/getting-started/dna-broken.png" height="60px">
106+
<img src="/_static/getting-started/dna-broken.png" height="60px">
106107
</div>
107108
<div class="col-md-10">
108109
<b>Explore your protein's structure?</b><br/>
@@ -111,7 +112,7 @@ Do you want to...
111112
</div>
112113
<div class="row">
113114
<div class="col-md-2 get-started-img">
114-
<img src="../_static/getting-started/embeddings.svg" height="60px">
115+
<img src="/_static/getting-started/embeddings.svg" height="60px">
115116
</div>
116117
<div class="col-md-10">
117118
<b>Obtain embeddings from protein language models?</b><br/>

source/getting-started/get-started-with-no-code.rst renamed to source/getting-started/quickstart-web.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Quick start tips
1717

1818
Once you log in, you'll see your home view and can navigate to get started with our tools.
1919

20-
.. image:: ../../_static/getting-started/tips.png
20+
.. image:: /_static/getting-started/tips.png
2121
:width: 80%
2222
:align: center
2323

@@ -27,7 +27,7 @@ Do you want to...
2727

2828
<div class="row mb-3">
2929
<div class="col-md-2 get-started-img">
30-
<img src="../_static/getting-started/poet-icon.png" height="60px">
30+
<img src="/_static/getting-started/poet-icon.png" height="60px">
3131
</div>
3232
<div class="col-md-10">
3333
<b>Make sequence predictions or designs without using any data?</b><br/>
@@ -36,7 +36,7 @@ Do you want to...
3636
</div>
3737
<div class="row mb-3">
3838
<div class="col-md-2 get-started-img">
39-
<img src="../_static/getting-started/bar-chart.png" height="60px">
39+
<img src="/_static/getting-started/bar-chart.png" height="60px">
4040
</div>
4141
<div class="col-md-10">
4242
<b>Analyze your experimental data for library design?</b><br/>
@@ -46,7 +46,7 @@ Do you want to...
4646
</div>
4747
<div class="row">
4848
<div class="col-md-2 get-started-img">
49-
<img src="../_static/getting-started/dna-broken.png" height="60px">
49+
<img src="/_static/getting-started/dna-broken.png" height="60px">
5050
</div>
5151
<div class="col-md-10">
5252
<b>Explore your protein's structure?</b><br/>

source/python-api/api-reference/basics.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

source/python-api/api-reference/embedding.rst

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ openprotein.embeddings
33

44
Create embeddings for your protein sequences using open-source and proprietary models!
55

6-
Note that for PoET Models, you will also need to utilize our :doc:`align <align>` workflow.
6+
Note that for PoET Models, you will also need to supply a :py:class:`~openprotein.prompt.Prompt`.
77

88
Interface
99
---------
@@ -30,17 +30,44 @@ Models
3030
:members:
3131
:inherited-members:
3232

33-
Transform models
33+
These embedding models inherit from a base :py:class:`~openprotein.embeddings.EmbeddingModel`, due to their shared functionality in providing the :py:meth:`~openprotein.embeddings.EmbeddingModel.embed` method. These can also be used to fit the :ref:`transform-models`.
34+
35+
.. autoclass:: openprotein.embeddings.EmbeddingModel
36+
:members:
37+
38+
.. _transform-models:
39+
40+
Transform Models
3441
^^^^^^^^^^^^^^^^
3542

36-
These models are overlaid on top of the base embeddings models to produce reduced/transformed embeddings. Refer to their detailed documentation in `openprotein.svd <./svd.rst#openprotein.svd.SVDModel>`_ and `openprotein.umap <./umap.rst#openprtein.umap.UMAPModel>`_.
43+
These models are overlaid on top of the base embeddings models to produce reduced/transformed embeddings.
44+
45+
:py:class:`~openprotein.svd.SVDModel` represents an SVD model which is suitable to reduce the high-dimensional embeddings returned by base embedding models, whilst maintaining semantic information, fitted on your :py:class:`~openprotein.data.AssayDataset`. You can fit your own SVD from any model's :py:meth:`~openprotein.embeddings.EmbeddingModel.fit_svd`.
3746

3847
.. autoclass:: openprotein.svd.SVDModel
48+
:members:
49+
:inherited-members:
50+
51+
:py:class:`~openprotein.umap.UMAPModel` represents a UMAP model which is suitable to project the high-dimensional embeddings into a lower dimension (usually 2) for visualization, to understand the semantic grouping within your :py:class:`~openprotein.data.AssayDataset`. You can fit your own UMAP from any model's :py:meth:`~openprotein.embeddings.EmbeddingModel.fit_umap`.
3952

4053
.. autoclass:: openprotein.umap.UMAPModel
54+
:members:
55+
:inherited-members:
56+
57+
Reduction methods
58+
^^^^^^^^^^^^^^^^^
59+
60+
Foundational embedding models also take an optional reduction to use simple pooling methods:
61+
62+
.. autoclass:: openprotein.common.ReductionType()
63+
:members:
64+
65+
.. note::
66+
67+
By default, the :py:meth:`~openprotein.embeddings.EmbeddingModel.embed` method uses the :py:attr:`~openprotein.common.ReductionType.MEAN` reduction to reduce network load. You have to explicitly pass ``reduction=None`` to get full-sized embeddings.
4168

4269
Results
43-
---------
70+
-------
4471

4572
.. autoclass:: openprotein.embeddings.EmbeddingsResultFuture
4673
:members:
@@ -54,9 +81,3 @@ Results
5481
:members:
5582
:inherited-members:
5683

57-
Base model
58-
----------
59-
60-
The base embedding model is the base class of all the embedding models.
61-
62-
.. autoclass:: openprotein.embeddings.EmbeddingModel

0 commit comments

Comments
 (0)