Skip to content

Commit 8f3d5ea

Browse files
committed
πŸ“š Update README.md
Update the `README.md` instructions to the latest changes. Also includes a minor change in the `init` command, which now uses the `default` input of the `Prompt.ask` method. This means the user can simply press enter to use the shell detected from the `SHELL` environment variable.
1 parent 2b57b99 commit 8f3d5ea

File tree

2 files changed

+106
-37
lines changed

2 files changed

+106
-37
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 102 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,72 @@ Tool for managing AiiDA "projects" - Python environments tailored to AiiDA with
66
|---|
77

88

9-
## Usage
10-
9+
## Installation
1110

12-
1. Easy to install globally via `pipx`:
11+
The package can be installed globally with `pipx`:
1312

1413
```console
15-
aiida@prnmarvelsrv3:~$ pipx install aiida-project
16-
installed package aiida-project 0.3.0, Python 3.8.10
17-
These binaries are now globally available
14+
pipx install aiida-project
15+
```
16+
```console
17+
installed package aiida-project 0.4.0, installed using Python 3.9.16
18+
These apps are now globally available
1819
- aiida-project
1920
done! ✨ 🌟 ✨
2021
```
2122

22-
2. Create projects with their own virtual environment, and immediately install `aiida-core` and the plugins you need:
23+
See the [`pipx` installation instructions](https://pypa.github.io/pipx/installation/) if you haven't already installed `pipx`.
24+
25+
## Usage
26+
27+
After installing `aiida-project`, run the `init` command to get started:
2328

2429
```console
25-
aiida@prnmarvelsrv3:~$ aiida-project create firstproject --plugins aiida-quantumespresso
26-
✨ Creating the project environment and directory.
27-
πŸ”§ Adding the AiiDA environment variables to the activate script.
28-
βœ… Success! Project created.
29-
πŸ’Ύ Installing the latest release of the AiiDA core module.
30-
πŸ’Ύ Installing aiida-quantumespresso
30+
aiida-project init
3131
```
32+
```console
33+
πŸ‘‹ Hello there! Which shell are you using? [bash/zsh/fish] (zsh):
34+
35+
βœ¨πŸš€ AiiDA-project has been initialised! πŸš€βœ¨
36+
37+
Info: For the changes to take effect, run the following command:
38+
39+
source /Users/mbercx/.zshrc
40+
41+
or simply open a new terminal.
42+
```
43+
44+
This will also add the `cda` function to your shell startup file, so you can easily switch projects.
45+
Note that you'll have to source your e.g. `.zshrc` file for this function to be accessible!
46+
47+
### `create`
3248

33-
3. Supports virtualenv for now, integrated with virtualenvwrapper (`conda`/`mamba` support coming soon!):
49+
After initialising, you can create new projects with their own virtual environment and project directory using the `create` command.
50+
The latest version of `aiida-core` will also be installed automatically, along with any plugins you specify with the `--plugin` option:
3451

3552
```console
36-
aiida@prnmarvelsrv3:~$ workon firstproject
53+
aiida-project create firstproject --plugin aiida-quantumespresso
54+
```
55+
```console
56+
✨ Creating the project directory and environment using the Python binary:
57+
/opt/homebrew/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11
58+
πŸ”§ Adding the AiiDA environment variables to the activate script.
59+
βœ… Success: Project created.
60+
πŸ’Ύ Installing the latest release of the AiiDA core module.
61+
πŸ’Ύ Installing `aiida-quantumespresso` from the PyPI.
3762
```
3863

39-
4. Automatically sets some typical AiiDA UNIX environment variables, like AIIDA_PATH and the shell completion (bash for now, `zsh`/`fish` support coming soon!):
64+
You can then activate the project using the `cda` command described above:
4065

4166
```console
42-
(firstproject) aiida@prnmarvelsrv3:~$ cd $AIIDA_PATH
67+
cda firstproject
4368
```
4469

45-
5. Automatically sets up a well-organised directory structure, which can be configured globally:
70+
Next to activating the Python virtual environment, this will also change the directory to the one for the project.
71+
`aiida-project` automatically sets up a directory structure, which we intend to be made configurable globally:
4672

4773
```console
48-
(firstproject) aiida@prnmarvelsrv3:~/project/firstproject$ tree -a
74+
(firstproject) ~/project/firstproject$ tree -a
4975
.
5076
β”œβ”€β”€ .aiida
5177
β”‚ β”œβ”€β”€ access
@@ -61,7 +87,62 @@ aiida@prnmarvelsrv3:~$ workon firstproject
6187
9 directories, 1 file
6288
```
6389

64-
6. For now it just installs AiiDA and plugins, but in the future we want it to be able to also automatically set up the AiiDA database, repository and default profile.
90+
**Note:** You may not have the [`tree`](https://en.wikipedia.org/wiki/Tree_(command)) command installed on your system.
91+
92+
### `destroy`
93+
94+
Projects can be cleaned up by using `aiida-project destroy`.
95+
First `deactivate` the environment:
96+
97+
```console
98+
deactivate firstproject
99+
```
100+
101+
Next you can run the `destroy` command:
102+
103+
```console
104+
aiida-project destroy firstproject
105+
```
106+
```console
107+
❗️ Are you sure you want to delete the entire firstproject project? This cannot be undone! [y/N]: y
108+
Succes: Project with name firstproject has been destroyed.
109+
```
110+
111+
This will remove both the virtual environment, as well as the whole project folder:
112+
113+
```console
114+
~/project$ tree -a
115+
.
116+
└── .aiida_projects
117+
β”œβ”€β”€ conda
118+
└── virtualenv
119+
120+
3 directories, 0 files
121+
```
122+
123+
## Other features
124+
125+
### `virtualenvwrapper` integration
126+
127+
If you are already using `virtualenvwrapper`, the virtual environments will be installed in the same directory as the one used by `virtualenvwrapper` (i.e. `$WORKON_HOME`).
128+
So you can then also use the
129+
130+
```console
131+
aiida@prnmarvelsrv3:~$ workon firstproject
132+
```
133+
134+
### Environment configuration
135+
136+
Automatically sets some typical AiiDA UNIX environment variables, like AIIDA_PATH and the shell completion (`bash`/`zsh` for now, `fish` support coming soon!):
137+
138+
```console
139+
$ echo $AIIDA_PATH
140+
/Users/mbercx/project/firstproject
141+
```
142+
143+
## Future goals
144+
145+
* For now it just installs AiiDA and plugins, but in the future we want it to be able to also automatically set up the AiiDA database, repository and default profile.
65146

66147
```console
67148
(firstproject) aiida@prnmarvelsrv3:~/project/firstproject$ verdi status
@@ -71,7 +152,7 @@ aiida@prnmarvelsrv3:~$ workon firstproject
71152
Report: Configure a profile by running `verdi quicksetup` or `verdi setup`.
72153
```
73154

74-
7. Projects are pydantic data models, and are stored as JSON in the .aiida_projects directory. Over time it should be possible to completely regenerate a project based on this file, but that’s still a work in progress:
155+
* Projects are pydantic data models, and are stored as JSON in the .aiida_projects directory. Over time it should be possible to completely regenerate a project based on this file, but that’s still a work in progress:
75156

76157
```console
77158
(firstproject) aiida@prnmarvelsrv3:~/project/firstproject$ cd ..
@@ -83,17 +164,3 @@ Report: Configure a profile by running `verdi quicksetup` or `verdi setup`.
83164

84165
2 directories, 1 file
85166
```
86-
87-
8. Projects can be cleaned up by using `aiida-project destroy`:
88-
89-
```console
90-
(firstproject) aiida@prnmarvelsrv3:~/project$ aiida-project destroy firstproject
91-
Are you sure you want to delete the entire firstproject project? This cannot be undone! [y/N]: y
92-
(firstproject) aiida@prnmarvelsrv3:~/project$ tree -a
93-
.
94-
└── .aiida_projects
95-
β”œβ”€β”€ conda
96-
└── virtualenv
97-
98-
3 directories, 0 files
99-
```

β€Žaiida_project/commands/main.pyβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ def init(shell: Optional[ShellType] = None):
4848

4949
if not shell_str:
5050
shell_str = os.environ.get("SHELL")
51+
detected_shell = shell_str.split("/")[-1] if shell_str else None
5152
prompt_message = "πŸ‘‹ Hello there! Which shell are you using?"
52-
prompt_message += f" [blue]({shell_str.split('/')[-1]} detected)" if shell_str else ""
5353
shell_str = prompt.Prompt.ask(
54-
prompt=prompt_message, choices=[shell_type.value for shell_type in ShellType]
54+
prompt=prompt_message,
55+
choices=[shell_type.value for shell_type in ShellType],
56+
default=detected_shell,
5557
)
5658

5759
if shell_str == "fish":

0 commit comments

Comments
Β (0)