nextpyp-client 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. nextpyp_client-2.2.0/.gitignore +10 -0
  2. nextpyp_client-2.2.0/.gitlab-ci.yml +82 -0
  3. nextpyp_client-2.2.0/LICENSE +26 -0
  4. nextpyp_client-2.2.0/PKG-INFO +104 -0
  5. nextpyp_client-2.2.0/README.md +49 -0
  6. nextpyp_client-2.2.0/doc/src/_ext/rst_roles.py +13 -0
  7. nextpyp_client-2.2.0/doc/src/_static/style.css +4 -0
  8. nextpyp_client-2.2.0/doc/src/_templates/custom-class-template.rst +37 -0
  9. nextpyp_client-2.2.0/doc/src/_templates/custom-module-template.rst +68 -0
  10. nextpyp_client-2.2.0/doc/src/api.rst +18 -0
  11. nextpyp_client-2.2.0/doc/src/conf.py +74 -0
  12. nextpyp_client-2.2.0/doc/src/contributing.rst +6 -0
  13. nextpyp_client-2.2.0/doc/src/docutils.conf +3 -0
  14. nextpyp_client-2.2.0/doc/src/getting-started.rst +308 -0
  15. nextpyp_client-2.2.0/doc/src/index.rst +17 -0
  16. nextpyp_client-2.2.0/pyproject.toml +67 -0
  17. nextpyp_client-2.2.0/src/nextpyp/__init__.py +0 -0
  18. nextpyp_client-2.2.0/src/nextpyp/client/__init__.py +178 -0
  19. nextpyp_client-2.2.0/src/nextpyp/client/args.py +659 -0
  20. nextpyp_client-2.2.0/src/nextpyp/client/credentials.py +9 -0
  21. nextpyp_client-2.2.0/src/nextpyp/client/gen.py +12020 -0
  22. nextpyp_client-2.2.0/src/nextpyp/client/ids.py +6 -0
  23. nextpyp_client-2.2.0/src/nextpyp/client/jsonrpc.py +104 -0
  24. nextpyp_client-2.2.0/src/nextpyp/client/py.typed +0 -0
  25. nextpyp_client-2.2.0/src/nextpyp/client/pyp_config.toml +15461 -0
  26. nextpyp_client-2.2.0/src/nextpyp/client/realtime.py +130 -0
  27. nextpyp_client-2.2.0/tests/nextpyp/client/__init__.py +2 -0
  28. nextpyp_client-2.2.0/tests/nextpyp/client/realtime_services/test_project.py +177 -0
  29. nextpyp_client-2.2.0/tests/nextpyp/client/realtime_services/test_sessions.py +845 -0
  30. nextpyp_client-2.2.0/tests/nextpyp/client/services/test_apps.py +55 -0
  31. nextpyp_client-2.2.0/tests/nextpyp/client/services/test_projects.py +100 -0
  32. nextpyp_client-2.2.0/tests/nextpyp/client/services/test_sessions.py +1270 -0
  33. nextpyp_client-2.2.0/tests/nextpyp/client/test_gen_maps.py +9 -0
  34. nextpyp_client-2.2.0/tests/nextpyp/client/test_jsonrpc.py +120 -0
  35. nextpyp_client-2.2.0/tests/nextpyp/client/test_version.py +21 -0
  36. nextpyp_client-2.2.0/tests/testlib/__init__.py +81 -0
  37. nextpyp_client-2.2.0/tests/testlib/__main__.py +110 -0
  38. nextpyp_client-2.2.0/tests/testlib/py.typed +0 -0
  39. nextpyp_client-2.2.0/tox.ini +51 -0
@@ -0,0 +1,10 @@
1
+
2
+ /.idea
3
+ /.tox
4
+ /.mypy_cache
5
+ __pycache__
6
+ /doc/build
7
+ /doc/src/_autosummary
8
+ /todo.txt
9
+ /dist
10
+ /out
@@ -0,0 +1,82 @@
1
+ image: python:3.10
2
+
3
+ stages:
4
+ - test
5
+ - build
6
+ - publish
7
+
8
+ # a release is a tag like v2.2.0, matching the version in pyproject.toml
9
+ .release-tag: &release-tag
10
+ if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/
11
+
12
+ test:
13
+ stage: test
14
+ script:
15
+ - pip install tox
16
+ - tox run -e py310
17
+ rules:
18
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
19
+ - if: $CI_COMMIT_BRANCH
20
+ - *release-tag
21
+
22
+ docs:
23
+ stage: test
24
+ script:
25
+ - pip install tox
26
+ - tox run -e doc
27
+ - mv doc/build/html public
28
+ artifacts:
29
+ paths:
30
+ - public
31
+ only:
32
+ # only run this CI pipeline on main
33
+ refs:
34
+ - main
35
+
36
+ build:
37
+ stage: build
38
+ rules:
39
+ - *release-tag
40
+ script:
41
+ - pip install build twine toml
42
+ - VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
43
+ - |
44
+ if [ "v$VERSION" != "$CI_COMMIT_TAG" ]; then
45
+ echo "tag $CI_COMMIT_TAG doesn't match the version in pyproject.toml ($VERSION)"
46
+ exit 1
47
+ fi
48
+ - python -m build
49
+ - twine check --strict dist/*
50
+ artifacts:
51
+ paths:
52
+ - dist/
53
+
54
+ # Uploads need a person to press the button in the pipeline: TestPyPI first, check it, then PyPI.
55
+ # TEST_PYPI_TOKEN and PYPI_TOKEN are masked, protected CI/CD variables (project-scoped PyPI API tokens),
56
+ # and v* tags are protected, so only maintainers can run these.
57
+
58
+ publish-testpypi:
59
+ stage: publish
60
+ needs: [build]
61
+ rules:
62
+ - <<: *release-tag
63
+ when: manual
64
+ variables:
65
+ TWINE_USERNAME: __token__
66
+ TWINE_PASSWORD: $TEST_PYPI_TOKEN
67
+ script:
68
+ - pip install twine
69
+ - twine upload --non-interactive --repository-url https://test.pypi.org/legacy/ dist/*
70
+
71
+ publish-pypi:
72
+ stage: publish
73
+ needs: [build]
74
+ rules:
75
+ - <<: *release-tag
76
+ when: manual
77
+ variables:
78
+ TWINE_USERNAME: __token__
79
+ TWINE_PASSWORD: $PYPI_TOKEN
80
+ script:
81
+ - pip install twine
82
+ - twine upload --non-interactive dist/*
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2023, Bartesaghi Lab
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its
14
+ contributors may be used to endorse or promote products derived from
15
+ this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.5
2
+ Name: nextpyp-client
3
+ Version: 2.2.0
4
+ Summary: Python client for the nextPYP cryo-EM/ET website: projects, sessions, and real-time updates.
5
+ Project-URL: Homepage, https://nextpyp.app
6
+ Project-URL: Documentation, https://nextpyp.app/nextpyp-client
7
+ Project-URL: Source, https://gitlab.cs.duke.edu/nextpyp/nextpyp-client
8
+ Project-URL: Mirror, https://github.com/nextpyp/nextpyp-client
9
+ Author-email: Jeff Martin <jeff@cuchazinteractive.com>
10
+ Maintainer-email: Alberto Bartesaghi <alberto.bartesaghi@duke.edu>
11
+ License: Copyright (c) 2023, Bartesaghi Lab
12
+
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ 1. Redistributions of source code must retain the above copyright notice, this
17
+ list of conditions and the following disclaimer.
18
+
19
+ 2. Redistributions in binary form must reproduce the above copyright notice,
20
+ this list of conditions and the following disclaimer in the documentation
21
+ and/or other materials provided with the distribution.
22
+
23
+ 3. Neither the name of the copyright holder nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
31
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
+ License-File: LICENSE
38
+ Keywords: api-client,cryo-em,cryo-et,nextpyp
39
+ Classifier: Development Status :: 3 - Alpha
40
+ Classifier: Intended Audience :: Science/Research
41
+ Classifier: License :: OSI Approved :: BSD License
42
+ Classifier: Operating System :: OS Independent
43
+ Classifier: Programming Language :: Python :: 3
44
+ Classifier: Programming Language :: Python :: 3.10
45
+ Classifier: Programming Language :: Python :: 3.11
46
+ Classifier: Programming Language :: Python :: 3.12
47
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
48
+ Classifier: Typing :: Typed
49
+ Requires-Python: >=3.10
50
+ Requires-Dist: requests~=2.31
51
+ Requires-Dist: semver~=3.0.2
52
+ Requires-Dist: toml~=0.10.2
53
+ Requires-Dist: websockets~=12.0
54
+ Description-Content-Type: text/markdown
55
+
56
+
57
+ # NextPYP Client
58
+
59
+ A Python client for the NextPYP website.
60
+
61
+ The NextPYP Python Client allows you to connect to and exchange data with the NextPYP website using the very
62
+ same APIs that NextPYP uses internally. These APIs allow accessing every function of the website available
63
+ to browser clients, including listening to real-time updates from the server.
64
+
65
+
66
+ ## Install
67
+
68
+ ```shell
69
+ pip install nextpyp-client
70
+ ```
71
+
72
+ Then see [Getting Started](https://nextpyp.app/nextpyp-client) to request an app token and make your first calls.
73
+
74
+
75
+ ## Versions
76
+
77
+ The client's version matches the NextPYP API version it speaks: client `2.2.x` works with NextPYP websites
78
+ whose API is `2.2` or newer, up to the next major version. `Client.is_compatible()` checks a website for you.
79
+
80
+
81
+ ## Source code
82
+
83
+ - GitHub: https://github.com/nextpyp/nextpyp-client
84
+ - GitLab (where development happens): https://gitlab.cs.duke.edu/nextpyp/nextpyp-client
85
+
86
+ Related: [nextpyp-mcp](https://github.com/nextpyp/nextpyp-mcp), an MCP server that lets AI assistants such
87
+ as Cursor and Claude use this client to work with NextPYP.
88
+
89
+
90
+ ## Documentation
91
+
92
+ The newest version of the documentation is available online at:
93
+
94
+ https://nextpyp.app/nextpyp-client
95
+
96
+ Documentation sources are available in the `doc/src` folder.
97
+
98
+ You can build the documentation with the command:
99
+ ```shell
100
+ tox run -e doc
101
+ ```
102
+ Then the full HTML documentation will appear at `doc/build/html/index.html`
103
+
104
+ Building the documentation requires the [tox](https://tox.wiki) tool.
@@ -0,0 +1,49 @@
1
+
2
+ # NextPYP Client
3
+
4
+ A Python client for the NextPYP website.
5
+
6
+ The NextPYP Python Client allows you to connect to and exchange data with the NextPYP website using the very
7
+ same APIs that NextPYP uses internally. These APIs allow accessing every function of the website available
8
+ to browser clients, including listening to real-time updates from the server.
9
+
10
+
11
+ ## Install
12
+
13
+ ```shell
14
+ pip install nextpyp-client
15
+ ```
16
+
17
+ Then see [Getting Started](https://nextpyp.app/nextpyp-client) to request an app token and make your first calls.
18
+
19
+
20
+ ## Versions
21
+
22
+ The client's version matches the NextPYP API version it speaks: client `2.2.x` works with NextPYP websites
23
+ whose API is `2.2` or newer, up to the next major version. `Client.is_compatible()` checks a website for you.
24
+
25
+
26
+ ## Source code
27
+
28
+ - GitHub: https://github.com/nextpyp/nextpyp-client
29
+ - GitLab (where development happens): https://gitlab.cs.duke.edu/nextpyp/nextpyp-client
30
+
31
+ Related: [nextpyp-mcp](https://github.com/nextpyp/nextpyp-mcp), an MCP server that lets AI assistants such
32
+ as Cursor and Claude use this client to work with NextPYP.
33
+
34
+
35
+ ## Documentation
36
+
37
+ The newest version of the documentation is available online at:
38
+
39
+ https://nextpyp.app/nextpyp-client
40
+
41
+ Documentation sources are available in the `doc/src` folder.
42
+
43
+ You can build the documentation with the command:
44
+ ```shell
45
+ tox run -e doc
46
+ ```
47
+ Then the full HTML documentation will appear at `doc/build/html/index.html`
48
+
49
+ Building the documentation requires the [tox](https://tox.wiki) tool.
@@ -0,0 +1,13 @@
1
+
2
+ from docutils.parsers.rst import roles
3
+ from docutils import nodes
4
+
5
+
6
+ # USAGE :strikethrough:`text`
7
+ def role_strikethrough(role, rawtext, text, lineno, inliner, options={}, content=[]):
8
+ node = nodes.inline(rawtext, text, **{'classes': ['strike']})
9
+ return [node], []
10
+
11
+
12
+ def setup(app):
13
+ roles.register_canonical_role('strikethrough', role_strikethrough)
@@ -0,0 +1,4 @@
1
+
2
+ .strike {
3
+ text-decoration: line-through;
4
+ }
@@ -0,0 +1,37 @@
1
+ {{ fullname | escape | underline}}
2
+
3
+ .. currentmodule:: {{ module }}
4
+
5
+ .. autoclass:: {{ objname }}
6
+ :members:
7
+ :show-inheritance:
8
+ :inherited-members:
9
+
10
+ {% block methods %}
11
+ {% if methods %}
12
+ .. rubric:: {{ _('Methods') }}
13
+
14
+ .. autosummary::
15
+ :nosignatures:
16
+
17
+ ~{{ name }}.__init__
18
+ {% for item in methods %}
19
+ {%- if not item.startswith('_') %}
20
+ ~{{ name }}.{{ item }}
21
+ {%- endif -%}
22
+ {%- endfor %}
23
+ {% endif %}
24
+ {% endblock %}
25
+
26
+ {% block attributes %}
27
+ {% if attributes %}
28
+ .. rubric:: {{ _('Attributes') }}
29
+
30
+ .. autosummary::
31
+ {% for item in attributes %}
32
+ ~{{ name }}.{{ item }}
33
+ {%- endfor %}
34
+ {% endif %}
35
+ {% endblock %}
36
+
37
+ .. rubric:: {{ _('Details') }}
@@ -0,0 +1,68 @@
1
+ {{ fullname | escape | underline}}
2
+
3
+ .. automodule:: {{ fullname }}
4
+
5
+ {% block attributes %}
6
+ {% if attributes %}
7
+ .. rubric:: {{ _('Module Attributes') }}
8
+
9
+ .. autosummary::
10
+ :toctree:
11
+ {% for item in attributes %}
12
+ {{ item }}
13
+ {%- endfor %}
14
+ {% endif %}
15
+ {% endblock %}
16
+
17
+ {% block functions %}
18
+ {% if functions %}
19
+ .. rubric:: {{ _('Functions') }}
20
+
21
+ .. autosummary::
22
+ :toctree:
23
+ :nosignatures:
24
+ {% for item in functions %}
25
+ {{ item }}
26
+ {%- endfor %}
27
+ {% endif %}
28
+ {% endblock %}
29
+
30
+ {% block classes %}
31
+ {% if classes %}
32
+ .. rubric:: {{ _('Classes') }}
33
+
34
+ .. autosummary::
35
+ :toctree:
36
+ :template: custom-class-template.rst
37
+ :nosignatures:
38
+ {% for item in classes %}
39
+ {{ item }}
40
+ {%- endfor %}
41
+ {% endif %}
42
+ {% endblock %}
43
+
44
+ {% block exceptions %}
45
+ {% if exceptions %}
46
+ .. rubric:: {{ _('Exceptions') }}
47
+
48
+ .. autosummary::
49
+ :toctree:
50
+ {% for item in exceptions %}
51
+ {{ item }}
52
+ {%- endfor %}
53
+ {% endif %}
54
+ {% endblock %}
55
+
56
+ {% block modules %}
57
+ {% if modules %}
58
+ .. rubric:: Modules
59
+
60
+ .. autosummary::
61
+ :toctree:
62
+ :template: custom-module-template.rst
63
+ :recursive:
64
+ {% for item in modules %}
65
+ {{ item }}
66
+ {%- endfor %}
67
+ {% endif %}
68
+ {% endblock %}
@@ -0,0 +1,18 @@
1
+
2
+ API Reference
3
+ =============
4
+
5
+ All of the automatically-generated documentation from the API can
6
+ be found here.
7
+
8
+ A good place to start is the :py:class:`nextpyp.client.Client` class.
9
+
10
+
11
+ .. rubric:: Packages
12
+
13
+ .. autosummary::
14
+ :toctree: _autosummary
15
+ :template: custom-module-template.rst
16
+ :recursive:
17
+
18
+ nextpyp.client
@@ -0,0 +1,74 @@
1
+
2
+ # configuration file for Sphinx documentation, see:
3
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
4
+
5
+ # Example config for making it actually look good:
6
+ # https://github.com/JamesALeedham/Sphinx-Autosummary-Recursion
7
+
8
+ # Docstring documentation
9
+ # cross references:
10
+ # https://www.sphinx-doc.org/en/master/usage/referencing.html
11
+ # Python roles:
12
+ # https://www.sphinx-doc.org/en/master/usage/domains/python.html#python-roles
13
+
14
+
15
+ # load local extensions
16
+ import sys
17
+ import os
18
+ sys.path.append(os.path.join(os.path.dirname(__file__), '_ext'))
19
+
20
+ # project info
21
+ project = 'nextpyp-client'
22
+ author = 'Jeff Martin'
23
+
24
+ # general sphinx config
25
+ extensions = [
26
+
27
+ # generate docs from code automatically
28
+ # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
29
+ 'sphinx.ext.autodoc',
30
+
31
+ # generate index pages from code automatically
32
+ # https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html
33
+ 'sphinx.ext.autosummary',
34
+
35
+ # better than the built-in autodoc_typehints = 'description' option
36
+ # https://github.com/tox-dev/sphinx-autodoc-typehints
37
+ 'sphinx_autodoc_typehints',
38
+
39
+ # allow saner docstring formats
40
+ # https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
41
+ # that are actually documented somewhere!
42
+ # https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
43
+ 'sphinx.ext.napoleon',
44
+
45
+ # custom extension to allow additional RST markup
46
+ 'rst_roles'
47
+ ]
48
+ templates_path = ['_templates']
49
+
50
+ # styling
51
+ html_theme = 'pydata_sphinx_theme'
52
+ html_static_path = ['_static']
53
+ html_css_files = ['style.css']
54
+
55
+ # autosummary config
56
+ # https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html#generating-stub-pages-automatically
57
+ autosummary_generate = True
58
+
59
+ # autodoc config
60
+ # https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration
61
+ autoclass_content = "class" # only show the class docstring with the class, not __init__ too
62
+ autodoc_class_signature = 'separated' # show the __init__ method separately from the class itself
63
+ autodoc_typehints = 'description' # write the type hints in the <thing> descriptions, rather than the signature
64
+
65
+ # sphinx_autodoc_typehints config
66
+ # https://github.com/tox-dev/sphinx-autodoc-typehints#options
67
+ # NOTE: don't turn this on, it duplicates method params
68
+ # always_document_param_types = True
69
+ typehints_defaults = 'comma'
70
+
71
+ # napoleon config
72
+ napoleon_numpy_docstring = True
73
+ napoleon_google_docstring = False
74
+ napoleon_attr_annotations = True
@@ -0,0 +1,6 @@
1
+
2
+ ============
3
+ Contributing
4
+ ============
5
+
6
+ # TODO
@@ -0,0 +1,3 @@
1
+
2
+ [restructuredtext parser]
3
+ tab_width: 4