跳转到主要内容

AiiDA环境管理器

项目描述

AiiDA-Project

用于管理AiiDA "项目" 的工具 - 定制的Python环境,具有独立的项目目录。

❗️ 此软件包仍处于开发初期阶段,我们很可能会在新0.X版本中频繁破坏API。在脚本中安装此软件包时,请务必固定版本!

安装

可以使用 pipx 在全局范围内安装此软件包

pipx install aiida-project
  installed package aiida-project 0.4.0, installed using Python 3.9.16
  These apps are now globally available
    - aiida-project
done! ✨ 🌟 ✨

如果您尚未安装 pipx,请参阅pipx 安装说明

用法

安装 aiida-project 后,运行 init 命令开始使用

aiida-project init
👋 Hello there! Which shell are you using? [bash/zsh/fish] (zsh):

✨🚀 AiiDA-project has been initialised! 🚀✨

Info: For the changes to take effect, run the following command:

    source /Users/mbercx/.zshrc

or simply open a new terminal.

这将还将 cda 函数添加到您的shell启动文件中,因此您可以轻松切换项目。请注意,您需要源例如 .zshrc 文件,以便此功能可用!

创建

初始化后,您可以使用 create 命令创建具有自己的虚拟环境和项目目录的新项目。还会自动安装最新版本的 aiida-core,以及您通过 --plugin 选项指定的任何插件

aiida-project create firstproject --plugin aiida-quantumespresso
✨ Creating the project directory and environment using the Python binary:
   /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11
🔧 Adding the AiiDA environment variables to the activate script.
✅ Success: Project created.
💾 Installing the latest release of the AiiDA core module.
💾 Installing `aiida-quantumespresso` from the PyPI.

然后,您可以使用上面描述的 cda 命令激活项目

cda firstproject

除了激活Python虚拟环境外,这还将更改目录到项目目录。 aiida-project 自动设置目录结构,我们打算使其全局可配置

(firstproject) ~/project/firstproject$ tree -a
.
├── .aiida
│   ├── access
│   ├── config.json
│   └── daemon
│       └── log
├── code
└── setup
    ├── code
    ├── computer
    └── profile

9 directories, 1 file

注意: 您的系统可能没有安装tree 命令。

销毁

可以通过使用aiida-project destroy来清理项目。首先停用环境

deactivate firstproject

然后你可以运行destroy命令

aiida-project destroy firstproject
❗️ Are you sure you want to delete the entire firstproject project? This cannot be undone! [y/N]: y
Succes: Project with name firstproject has been destroyed.

这将删除虚拟环境以及整个项目文件夹

~/project$ tree -a
.
└── .aiida_projects
    ├── conda
    └── virtualenv

3 directories, 0 files

其他特性

virtualenvwrapper集成

如果你已经在使用virtualenvwrapper,虚拟环境将被安装在与virtualenvwrapper相同目录下(即$WORKON_HOME)。因此,你还可以使用

aiida@prnmarvelsrv3:~$ workon firstproject

环境配置

自动设置一些典型的AiiDA UNIX环境变量,如AIIDA_PATH和shell自动补全(目前支持bash/zsh,即将支持fish

$ echo $AIIDA_PATH
/Users/mbercx/project/firstproject

未来目标

  • 目前它只安装AiiDA和插件,但未来我们希望它能够自动设置AiiDA数据库、存储库和默认配置文件。
(firstproject) aiida@prnmarvelsrv3:~/project/firstproject$ verdi status
 ✔ version:     AiiDA v2.3.0
 ✔ config:      /home/aiida/project/firstproject/.aiida
 ⏺ profile:     no profile configured yet
Report: Configure a profile by running `verdi quicksetup` or `verdi setup`.
  • 项目是pydantic数据模型,存储在.aiida_projects目录中的JSON文件中。随着时间的推移,应该能够根据此文件完全重新生成项目,但这仍然是一个正在进行中的工作。
(firstproject) aiida@prnmarvelsrv3:~/project/firstproject$ cd ..
(firstproject) aiida@prnmarvelsrv3:~/project$ tree -a .aiida_projects/
.aiida_projects/
├── conda
└── virtualenv
    └── firstproject.json

2 directories, 1 file

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

aiida_project-0.5.1.tar.gz (14.9 kB 查看哈希值)

上传时间

构建分布

aiida_project-0.5.1-py3-none-any.whl (11.8 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页