# AiiDAlab transport plugins

**URL:** <https://aiida.discourse.group/t/aiidalab-transport-plugins/51>\
**Category:** Ideas\
**Tags:** discussion\
**Created:** [July 18, 2023, 2:16pm UTC](https://aiida.discourse.group/t/aiidalab-transport-plugins/51 "2023-07-18T14:16:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakutovicha](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/yakutovicha/32/18_2.png) [@yakutovicha](https://aiida.discourse.group/u/yakutovicha)\
**Post date:** [July 18, 2023, 2:16pm UTC](https://aiida.discourse.group/t/aiidalab-transport-plugins/51/1 "2023-07-18T14:16:19Z")

</div>

In this topic, I would like to collect some thoughts on how to improve the transport plugins. While working on the [`ssh_light`](https://github.com/aiidateam/aiida-core/pull/6083) transport plugin, I realised that a few things could be improved. I will add them as follow-up comments to keep this message short.

---

<div class="post-metadata">

**Author:** ![yakutovicha](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/yakutovicha/32/18_2.png) [@yakutovicha](https://aiida.discourse.group/u/yakutovicha)\
**Post date:** [July 18, 2023, 2:21pm UTC](https://aiida.discourse.group/t/aiidalab-transport-plugins/51/2 "2023-07-18T14:21:14Z")

</div>

# `chdir` and `getcwd` methods

I would argue, that those methods are not needed at all. AFAIK, the place where you get landed is specific to the implementation, why depend on that?

I would even go further, and require providing _only_ absolute paths to the methods of the `Transport` plugin.

---

<div class="post-metadata">

**Author:** ![yakutovicha](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/yakutovicha/32/18_2.png) [@yakutovicha](https://aiida.discourse.group/u/yakutovicha)\
**Post date:** [July 18, 2023, 2:26pm UTC](https://aiida.discourse.group/t/aiidalab-transport-plugins/51/3 "2023-07-18T14:26:28Z")

</div>

# Use `pathlib`

I think the implementation of the transport classes can be further streamlined if we force all path-like arguments to be of `pathlib.Path` type.

---

<div class="post-metadata">

**Author:** ![chrisjsewell](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/chrisjsewell/32/24_2.png) [@chrisjsewell](https://aiida.discourse.group/u/chrisjsewell)\
**Post date:** [July 18, 2023, 2:41pm UTC](https://aiida.discourse.group/t/aiidalab-transport-plugins/51/4 "2023-07-18T14:41:06Z")

</div>

It’s important to note that `pathlib.Path` is dependent on the local system (see [pathlib — Object-oriented filesystem paths — Python 3.11.4 documentation](https://docs.python.org/3/library/pathlib.html)), and so this should not be used to reference remote paths. This is important if you need to distinguish between Posix and Windows.

There is a specific base class for paths: [os — Miscellaneous operating system interfaces — Python 3.11.4 documentation](https://docs.python.org/3/library/os.html#os.PathLike)

You may also be interested in two implementations of the Path API I have implemented:

- [GitHub - aiidateam/archive-path: A package to provide pathlib like access to zip & tar archives](https://github.com/aiidateam/archive-path), used in aiida-core for the archive storage
- [https://github.com/aiidateam/aiida-firecrest/blob/main/aiida\_firecrest/remote\_path.py](https://github.com/aiidateam/aiida-firecrest/blob/main/aiida_firecrest/remote_path.py)
