Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rabbull/aiida-core into bulk-update…
Browse files Browse the repository at this point in the history
…-json
  • Loading branch information
rabbull committed Dec 17, 2024
2 parents 568e4b9 + c532b34 commit 500df32
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 10 deletions.
36 changes: 27 additions & 9 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,39 +114,56 @@

To the topics

.. grid-item-card:: :fa:`cogs;mr-1` API Reference
.. grid-item-card:: :fa:`sitemap;mr-1` Internal Architecture
:text-align: center
:shadow: md

Comprehensive documentation of CLI, Python API and REST API.
Detailed information on AiiDA's design and architecture.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-ref:: reference/index
.. button-ref:: internals/index
:ref-type: doc
:click-parent:
:expand:
:color: primary
:outline:

To the reference guide
To the architecture guide

.. grid-item-card:: :fa:`sitemap;mr-1` Internal Architecture
.. grid-item-card:: :fa:`puzzle-piece;mr-1` Core plugins
:text-align: center
:shadow: md

Detailed information on AiiDA's design and architecture.
Commonly used AiiDA plugins to extend core functionality

+++++++++++++++++++++++++++++++++++++++++++++

.. button-ref:: internals/index
.. button-ref:: reference/core_plugins
:ref-type: doc
:click-parent:
:expand:
:color: primary
:outline:

To the architecture guide
To the plugin overview

.. grid-item-card:: :fa:`cogs;mr-1` API Reference
:text-align: center
:shadow: md

Comprehensive documentation of CLI, Python API and REST API.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-ref:: reference/index
:ref-type: doc
:click-parent:
:expand:
:color: primary
:outline:

To the reference guide

------------------------------

Expand All @@ -172,8 +189,9 @@
tutorials/index
howto/index
topics/index
reference/index
internals/index
reference/core_plugins
reference/index

===========
How to cite
Expand Down
135 changes: 135 additions & 0 deletions docs/source/reference/core_plugins.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
.. _reference:core_plugins:

============
Core plugins
============

This page lists common AiiDA plugins which are not specific to any research domain, but extend the core functionality:

.. grid:: 1 2 2 4
:gutter: 3

.. grid-item-card:: AiiDA WorkGraph
:text-align: center
:shadow: md

Efficiently design and manage flexible workflows with AiiDA.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-workgraph
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA shell
:text-align: center
:shadow: md

Plugin that makes running shell commands easy.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/sphuber/aiida-shell
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA submission controller
:text-align: center
:shadow: md

Classes to help managing large numbers of submissions.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-submission-controller/
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA hyperqueue
:text-align: center
:shadow: md

Plugin for the HyperQueue metascheduler enabling sub-node jobs.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-hyperqueue
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA project
:text-align: center
:shadow: md

AiiDA project manager with custom Python environments and isolated project directories.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-project
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA code registry
:text-align: center
:shadow: md

Registry of simulation codes and computers for easy setup in AiiDA.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-code-registry
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA plugin cutter
:text-align: center
:shadow: md

Cookie cutter recipe for AiiDA plugins.

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-plugin-cutter
:color: primary
:outline:

Go to GitHub

.. grid-item-card:: AiiDA PythonJob
:text-align: center
:shadow: md

Run non-AiiDA Python functions on a remote computer (pre-alpha).

+++++++++++++++++++++++++++++++++++++++++++++

.. button-link:: https://github.com/aiidateam/aiida-pythonjob
:color: primary
:outline:

Go to GitHub


Honorable mentions
===================

- `aiida-firecrest <https://github.com/aiidateam/aiida-firecrest>`_: Transport/Scheduler plugins for interfacing with
FirecREST (RESTful services gateway and interface for managing HPC resources).
- `aiida-resource-registry <https://github.com/aiidateam/aiida-resource-registry>`_: Registry of simulation codes and computers for easy setup in AiiDAlab.
- `aiida-restapi <https://github.com/aiidateam/aiida-restapi>`_: RESTful AiiDA Web API for data queries and workflow management.
- `aiida-diff <https://github.com/aiidateam/aiida-diff>`_: AiiDA demo plugin that computes the difference between two
files.

The full list of available plugins can be found on the `AiiDA plugin registry <https://aiidateam.github.io/aiida-registry/>`_.
1 change: 1 addition & 0 deletions docs/source/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Reference
api/index
rest_api
cheatsheet
core_plugins
_changelog.md
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ dependencies:
- sqlalchemy~=2.0
- tabulate<0.10.0,>=0.8.0
- tqdm~=4.45
- typing-extensions~=4.0
- upf_to_json~=0.9.2
- wrapt~=1.11
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies = [
'sqlalchemy~=2.0',
'tabulate>=0.8.0,<0.10.0',
'tqdm~=4.45',
'typing-extensions~=4.0;python_version<"3.10"',
'upf_to_json~=0.9.2',
'wrapt~=1.11'
]
Expand Down
11 changes: 11 additions & 0 deletions src/aiida/orm/nodes/data/singlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ def from_string(cls, content: str, filename: str | pathlib.Path | None = None, *
"""
return cls(io.StringIO(content), filename, **kwargs)

@classmethod
def from_bytes(
cls, content: bytes, filename: str | pathlib.Path | None = None, **kwargs: t.Any
) -> 'SinglefileData':
"""Construct a new instance and set ``content`` as its contents.
:param content: The content as bytes.
:param filename: Specify filename to use (defaults to ``file.txt``).
"""
return cls(io.BytesIO(content), filename, **kwargs)

def __init__(
self, file: str | pathlib.Path | t.IO, filename: str | pathlib.Path | None = None, **kwargs: t.Any
) -> None:
Expand Down
24 changes: 23 additions & 1 deletion tests/orm/nodes/data/test_singlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,40 @@ def test_from_string():
content = 'some\ncontent'
node = SinglefileData.from_string(content).store()
assert node.get_content() == content
assert node.get_content('rb') == content.encode()
assert node.filename == SinglefileData.DEFAULT_FILENAME

content = 'some\ncontent'
filename = 'custom_filename.dat'
node = SinglefileData.from_string(content, filename).store()
assert node.get_content() == content
assert node.get_content('rb') == content.encode()
assert node.filename == filename


def test_from_bytes():
"""Test the :meth:`aiida.orm.nodes.data.singlefile.SinglefileData.from_bytes` classmethod."""
content = b'some\ncontent'
node = SinglefileData.from_bytes(content).store()
assert node.get_content(mode='rb') == content
assert node.get_content(mode='r') == content.decode('utf-8')
assert node.filename == SinglefileData.DEFAULT_FILENAME

content = b'some\ncontent'
filename = 'custom_filename.dat'
node = SinglefileData.from_bytes(content, filename).store()
assert node.get_content(mode='rb') == content
assert node.get_content(mode='r') == content.decode('utf-8')
assert node.filename == filename


def test_get_content():
"""Test the :meth:`aiida.orm.nodes.data.singlefile.SinglefileData.get_content` method."""
content = 'some\ncontent'
node = SinglefileData.from_string(content).store()
assert node.get_content() == content
assert node.get_content('rb') == content.encode()
content = b'some\ncontent'
node = SinglefileData.from_string(content.decode('utf-8')).store()
node = SinglefileData.from_bytes(content).store()
assert node.get_content() == content.decode('utf-8')
assert node.get_content('rb') == content
7 changes: 7 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 500df32

Please sign in to comment.