Skip to content

Commit

Permalink
🚀 RELEASE: v2.0.0 (#5488)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Apr 27, 2022
1 parent 9a5aadb commit 8ac2ab4
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 12 deletions.
196 changes: 196 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,201 @@
# Changelog

## v2.0.0 - 2022-04-27

[Full changelog](https://github.com/aiidateam/aiida-core/compare/v2.0.0b1...v2.0.0)

This release finalises the [v2.0.0b1 changes](release/2.0.0b1).

### Node namespace restructuring ♻️

:::{note}
The restructuring is fully back-compatible, and existing methods/attributes will continue to work, until aiida-core `v3.0`.

Deprecations warnings are also currently turned **off** by default.
To identify these deprecations in your code base (for example when running unit tests), activate the `AIIDA_WARN_v3` environmental variable:

```bash
export AIIDA_WARN_v3=1
```

:::

The `Node` class (and thus its subclasses) has many methods and attributes in its public namespace.
This has been noted [as being a problem](https://github.com/aiidateam/aiida-core/issues/4976) for those using auto-completion,
since it makes it difficult to select suitable methods and attributes.

These methods/attributes have now been partitioned into "sub-namespaces" for specific purposes:

`Node.base.attributes`
: Interface to the attributes of a node instance.

`Node.base.caching`
: Interface to control caching of a node instance.

`Node.base.comments`
: Interface for comments of a node instance.

`Node.base.extras`
: Interface to the extras of a node instance.

`Node.base.links`
: Interface for links of a node instance.

`Node.base.repository`
: Interface to the file repository of a node instance.

:::{dropdown} Full list of re-naming

| Current name | New name |
| --------------------------- | ----------------------------------------------- |
| `Collection` | Deprecated, use `NodeCollection` directly |
| `add_comment` | `Node.base.comments.add` |
| `add_incoming` | `Node.base.links.add_incoming` |
| `attributes` | `Node.base.attributes.all` |
| `attributes_items` | `Node.base.attributes.items` |
| `attributes_keys` | `Node.base.attributes.keys` |
| `check_mutability` | `Node._check_mutability_attributes` |
| `clear_attributes` | `Node.base.attributes.clear` |
| `clear_extras` | `Node.base.extras.clear` |
| `clear_hash` | `Node.base.caching.clear_hash` |
| `copy_tree` | `Node.base.repository.copy_tree` |
| `delete_attribute` | `Node.base.attributes.delete` |
| `delete_attribute_many` | `Node.base.attributes.delete_many` |
| `delete_extra` | `Node.base.extras.delete` |
| `delete_extra_many` | `Node.base.extras.delete_many` |
| `delete_object` | `Node.base.repository.delete_object` |
| `erase` | `Node.base.repository.erase` |
| `extras` | `Node.base.extras.all` |
| `extras_items` | `Node.base.extras.items` |
| `extras_keys` | `Node.base.extras.keys` |
| `get` | Deprecated, use `Node.objects.get` |
| `get_all_same_nodes` | `Node.base.caching.get_all_same_nodes` |
| `get_attribute` | `Node.base.attributes.get` |
| `get_attribute_many` | `Node.base.attributes.get_many` |
| `get_cache_source` | `Node.base.caching.get_cache_source` |
| `get_comment` | `Node.base.comments.get` |
| `get_comments` | `Node.base.comments.all` |
| `get_extra` | `Node.base.extras.get` |
| `get_extra_many` | `Node.base.extras.get_many` |
| `get_hash` | `Node.base.caching.get_hash` |
| `get_incoming` | `Node.base.links.get_incoming` |
| `get_object` | `Node.base.repository.get_object` |
| `get_object_content` | `Node.base.repository.get_object_content` |
| `get_outgoing` | `Node.base.links.get_outgoing` |
| `get_stored_link_triples` | `Node.base.links.get_stored_link_triples` |
| `glob` | `Node.base.repository.glob` |
| `has_cached_links` | `Node.base.caching.has_cached_links` |
| `id` | Deprecated, use `pk` |
| `is_created_from_cache` | `Node.base.caching.is_created_from_cache` |
| `is_valid_cache` | `Node.base.caching.is_valid_cache` |
| `list_object_names` | `Node.base.repository.list_object_names` |
| `list_objects` | `Node.base.repository.list_objects` |
| `objects` | `collection` |
| `open` | `Node.base.repository.open` |
| `put_object_from_file` | `Node.base.repository.put_object_from_file` |
| `put_object_from_filelike` | `Node.base.repository.put_object_from_filelike` |
| `put_object_from_tree` | `Node.base.repository.put_object_from_tree` |
| `rehash` | `Node.base.caching.rehash` |
| `remove_comment` | `Node.base.comments.remove` |
| `repository_metadata` | `Node.base.repository.metadata` |
| `repository_serialize` | `Node.base.repository.serialize` |
| `reset_attributes` | `Node.base.attributes.reset` |
| `reset_extras` | `Node.base.extras.reset` |
| `set_attribute` | `Node.base.attributes.set` |
| `set_attribute_many` | `Node.base.attributes.set_many` |
| `set_extra` | `Node.base.extras.set` |
| `set_extra_many` | `Node.base.extras.set_many` |
| `update_comment` | `Node.base.comments.update` |
| `validate_incoming` | `Node.base.links.validate_incoming` |
| `validate_outgoing` | `Node.base.links.validate_outgoing` |
| `validate_storability` | `Node._validate_storability` |
| `verify_are_parents_stored` | `Node._verify_are_parents_stored` |
| `walk` | `Node.base.repository.walk` |

:::

### IPython integration improvements 👌

The `aiida` [IPython magic commands](https://ipython.readthedocs.io/en/stable/interactive/magics.html) are now available to load via:

```ipython
%load_ext aiida
```

As well as the previous `%aiida` magic command, to load a profile,
one can also use the `%verdi` magic command.
This command runs the `verdi` CLI using the currently loaded profile of the IPython/Jupyter session.

```ipython
%verdi status
```

See the [Basic Tutorial](docs/source/intro/tutorial.md) for example usage.

### New `SqliteTempBackend`

The `SqliteTempBackend` utilises an in-memory SQLite database to store data, allowing it to be transiently created/destroyed within a single Python session, without the need for Postgresql.

As such, it is useful for demonstrations and testing purposes, whereby no persistent storage is required.

To load a temporary profile, you can use the following code:

```python
from aiida import load_profile
from aiida.storage.sqlite_temp import SqliteTempBackend

profile = load_profile(
SqliteTempBackend.create_profile(
'myprofile',
sandbox_path='_sandbox',
options={
'runner.poll.interval': 1
},
debug=False
),
)
```

See the [Basic Tutorial](docs/source/intro/tutorial.md) for example usage.

### Key Pull Requests

Below is a list of some key pull requests that have been merged into version 2.0.0:

- Node namespace re-structuring:
- 🔧 MAINTAIN: Add `warn_deprecation` function, `Node.base`, and move `NodeRepositoryMixin -> NodeRepository` by @chrisjsewell in [#5472](https://github.com/aiidateam/aiida-core/pull/5472)
- ♻️ REFACTOR: `EntityAttributesMixin` -> `NodeAttributes` by @chrisjsewell in [#5442](https://github.com/aiidateam/aiida-core/pull/5442)
- ♻️ REFACTOR: Move methods to `Node.comments` by @chrisjsewell in [#5446](https://github.com/aiidateam/aiida-core/pull/5446)
- ♻️ REFACTOR: `EntityExtrasMixin` -> `EntityExtras` by @chrisjsewell in [#5445](https://github.com/aiidateam/aiida-core/pull/5445)
- ♻️ REFACTOR: Move link related methods to `Node.base.links` by @sphuber in [#5480](https://github.com/aiidateam/aiida-core/pull/5480)
- ♻️ REFACTOR: Move caching related methods to `Node.base.caching` by @sphuber in [#5483](https://github.com/aiidateam/aiida-core/pull/5483)

- Storage:
- ✨ NEW: Add SqliteTempBackend by @chrisjsewell in [#5448](https://github.com/aiidateam/aiida-core/pull/5448)
- 👌 IMPROVE: Move default user caching to `StorageBackend` by @chrisjsewell in [#5460](https://github.com/aiidateam/aiida-core/pull/5460)
- 👌 IMPROVE: Add JSON filtering for SQLite backends by @chrisjsewell in [#5448](https://github.com/aiidateam/aiida-core/pull/5448)

- ORM:
- 👌 IMPROVE: `StructureData`: allow to be initialised without a specified cell by @ltalirz in [#5341](https://github.com/aiidateam/aiida-core/pull/5341)

- Processing:
- 👌 IMPROVE: Allow `engine.run` to work without RabbitMQ by @chrisjsewell in [#5448](https://github.com/aiidateam/aiida-core/pull/5448)
- 👌 IMPROVE: `JobTemplate`: change `CodeInfo` to `JobTemplateCodeInfo` in `codes_info` by @unkcpz in [#5350](https://github.com/aiidateam/aiida-core/pull/5350)
- This is required for a containerized code implementation
- 👌 IMPROVE: Add option to use double quotes for `Code` and `Computer` CLI arguments by @unkcpz in [#5478](https://github.com/aiidateam/aiida-core/pull/5478)

- Transport and Scheduler:
- 👌 IMPROVE: `SlurmScheduler`: Parse out-of-walltime and out-of-memory errors from `stderr` by @sphuber in [#5458](https://github.com/aiidateam/aiida-core/pull/5458)
- 👌 IMPROVE: `CalcJob`: always call `Scheduler.parse_output` by @sphuber in [#5458](https://github.com/aiidateam/aiida-core/pull/5458)
- 👌 IMPROVE: `Computer`: fallback on transport for `get_minimum_job_poll_interval` default by @sphuber in [#5457](https://github.com/aiidateam/aiida-core/pull/5457)

- IPython:
- ✨ NEW: Add `%verdi` IPython magic by @chrisjsewell in [#5448](https://github.com/aiidateam/aiida-core/pull/5448)

- Dependencies:
- ♻️ REFACTOR: drop the `python-dateutil` library by @sphuber

(release/2.0.0b1)=
## v2.0.0b1 - 2022-03-15

[Full changelog](https://github.com/aiidateam/aiida-core/compare/v1.6.7...v2.0.0b1)
Expand Down
2 changes: 1 addition & 1 deletion aiida/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'For further information please visit http://www.aiida.net/. All rights reserved.'
)
__license__ = 'MIT license, see LICENSE.txt file.'
__version__ = '2.0.0.post0'
__version__ = '2.0.0'
__authors__ = 'The AiiDA team.'
__paper__ = (
'S. P. Huber et al., "AiiDA 1.0, a scalable computational infrastructure for automated reproducible workflows and '
Expand Down
1 change: 1 addition & 0 deletions docs/source/howto/interact.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ The same can be accomplished using the following magic statement:

.. code-block:: ipython
%load_ext aiida
%aiida
This magic line will replicate the same environment as :ref:`the interactive shell <how-to:interact-shell>` provided by ``verdi shell``.
Expand Down
25 changes: 14 additions & 11 deletions docs/source/intro/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,8 @@ Using AiiDA in Jupyter

1. Install the AiiDA ``notebook`` extra **inside** the AiiDA python environment, e.g. by running ``pip install aiida-core[notebook]``.

2. (optional) Register the ``%aiida`` IPython magic for loading the same environment as in the ``verdi shell``:

Copy the following code snippet into ``<home_folder>/.ipython/profile_default/startup/aiida_magic_register.py``

.. literalinclude:: ../../../aiida/tools/ipython/aiida_magic_register.py
:start-after: # DOCUMENTATION MARKER

.. note:: Use ``ipython locate profile`` if you're unsure about the location of your ipython profile folder.


With this setup, you're ready to use AiiDA in Jupyter notebeooks.
With this setup, you're ready to use AiiDA in Jupyter notebooks.

Start a Jupyter notebook server:

Expand All @@ -269,7 +260,13 @@ Start a Jupyter notebook server:
This will open a tab in your browser. Click on ``New -> Python``.

If you registered the ``%aiida`` IPython magic, simply run:
To load the `aiida` magics extension, simply run:

.. code-block:: ipython
%load_ext aiida
Now you can load a profile (the default unless specified) by:

.. code-block:: ipython
Expand All @@ -284,3 +281,9 @@ Otherwise, you can load the profile manually as you would in a Python script:
load_profile()
qb = orm.QueryBuilder()
# ...
You can also run `verdi` CLI commands, using the currently loaded profile, by:

.. code-block:: ipython
%verdi status

0 comments on commit 8ac2ab4

Please sign in to comment.