Skip to content

Commit 0fc2082

Browse files
Feat/tutorial (#29)
* initial tutorial.py * Update environment systems * update github workflows * fix license classifier * port tutorial.py content * include dataset * include tutorial README * add tutorial files to .gitignore * extend ruff exclude to tutorial
1 parent 6e0fb4d commit 0fc2082

7 files changed

Lines changed: 1487 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
timeout-minutes: 15
3030
strategy:
3131
matrix:
32-
environment: [test-py311, test-py312, test-py313]
32+
environment: [test-py311, test-py312]
3333
steps:
3434
- name: Checkout
3535
uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
pixi-version: v0.40.2
1919
cache: false
20-
environments: build
20+
environments: dist
2121
activate-environment: true
2222
- name: Build distributions
2323
run: pixi run build-dist

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,12 @@ diff.md
6060

6161
# Lock file
6262
*.lock
63+
64+
# tutorial required files
65+
!tutorial_dataset.h5
66+
67+
# tutorial generated files
68+
configure_profile.yaml
69+
configure_computer.yaml
70+
configure_code.yaml
71+
.aiida_run

pyproject.toml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ classifiers = [
1111
"Programming Language :: Python",
1212
"Operating System :: POSIX :: Linux",
1313
"Intended Audience :: Science/Research",
14-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
14+
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
1515
"Development Status :: 3 - Alpha",
1616
"Framework :: AiiDA"
1717
]
1818
keywords = ["aiida", "plugin", "fans"]
1919
requires-python = ">=3.11"
2020
dependencies = [
21-
"aiida-core>=2.3",
21+
"aiida-core>=2.6",
2222
"h5py"
2323
]
2424

@@ -44,49 +44,55 @@ platforms = ["linux-64"]
4444

4545
### pixi: default dependencies (in addition to aiida-core)
4646
[tool.pixi.dependencies]
47-
fans = "*"
47+
# None
4848
[tool.pixi.pypi-dependencies]
4949
# None
5050

5151
### pixi: default tasks
5252
[tool.pixi.tasks]
5353
# None
5454

55-
### pixi: features (in addition to fans)
56-
[tool.pixi.feature.dev]
57-
pypi-dependencies = {aiida-fans = { path = ".", editable = true }}
58-
[tool.pixi.feature.prod]
55+
### pixi: features
56+
[tool.pixi.feature.self]
5957
pypi-dependencies = {aiida-fans = { path = ".", editable = true }}
60-
[tool.pixi.feature.fmt]
58+
[tool.pixi.feature.plugin]
59+
dependencies = {aiida-fans = "0.1.5"}
60+
# [tool.pixi.feature.aiida]
61+
# dependencies = {aiida-core = "2.6.*"}
62+
[tool.pixi.feature.fans]
63+
dependencies = {fans = "0.3.*"}
64+
[tool.pixi.feature.ruff]
6165
dependencies = {ruff = "*"}
6266
tasks = {fmt = "ruff check", dummy = "echo dummy", my-dummy="echo my-dummy"}
6367
[tool.pixi.feature.build]
6468
pypi-dependencies = {build = "*"}
6569
tasks = {build-dist = "python -m build"}
66-
[tool.pixi.feature.docs]
70+
[tool.pixi.feature.sphinx]
6771
dependencies = {sphinx = "*", sphinx-book-theme = "*"}
6872
tasks = {build-docs = "sphinx-build -M html docs/source docs/build"}
69-
[tool.pixi.feature.test]
73+
[tool.pixi.feature.pytest]
7074
dependencies = {pytest = "*"}
7175
tasks = {test = "echo dummy test passes"}
72-
[tool.pixi.feature.py3]
73-
dependencies = {python = ">=3.11"}
76+
[tool.pixi.feature.marimo]
77+
dependencies = {marimo = "0.13.*"}
78+
tasks = {tutorial = "marimo edit tutorial.py"}
7479
[tool.pixi.feature.py311]
7580
dependencies = {python = "3.11.*"}
7681
[tool.pixi.feature.py312]
7782
dependencies = {python = "3.12.*"}
78-
[tool.pixi.feature.py313]
79-
dependencies = {python = "3.13.*"}
83+
# [tool.pixi.feature.py313]
84+
# dependencies = {python = "3.13.*"}
8085

8186
### pixi: environments
8287
[tool.pixi.environments]
83-
dev = { features = ["dev", "fmt", "test"], solve-group = "default" }
84-
fmt = { features = ["fmt", "py3"], no-default-feature = true }
85-
build = { features = ["build", "py3"], no-default-feature = true }
86-
docs = { features = ["docs", "py3"], no-default-feature = true }
87-
test-py311 = { features = ["prod", "test", "py311"], solve-group = "py311" }
88-
test-py312 = { features = ["prod", "test", "py312"], solve-group = "py312" }
89-
test-py313 = { features = ["prod", "test", "py313"], solve-group = "py313" }
88+
dev = { features = ["self", "ruff", "pytest"], solve-group = "default" }
89+
fmt = { features = ["ruff", "py312"], no-default-feature = true }
90+
dist = { features = ["build", "py312"], no-default-feature = true }
91+
docs = { features = ["sphinx", "py312"], no-default-feature = true }
92+
test-py311 = { features = ["self", "fans", "pytest", "py311"], solve-group = "py311" }
93+
test-py312 = { features = ["self", "fans", "pytest", "py312"], solve-group = "py312" }
94+
# test-py313 = { features = ["self", "fans", "pytest", "py313"], solve-group = "py313" }
95+
tutorial = { features = ["plugin", "fans", "marimo"], no-default-feature = true}
9096

9197

9298
## Build Tools: setuptools_scm
@@ -95,7 +101,10 @@ version_file = "src/aiida_fans/_version.py"
95101

96102
## Style Tools: ruff
97103
[tool.ruff]
98-
extend-exclude = ["conf.py"]
104+
extend-exclude = [
105+
"conf.py",
106+
"tutorial.py"
107+
]
99108
line-length = 120
100109
[tool.ruff.lint]
101110
ignore = [

tutorial/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# aiida-fans-tutorial
2+
Learn how to use aiida-fans in this marimo powered tutorial.
3+
4+
## Usage
5+
6+
Assuming you have FANS, python 3.13, venv, and pip installed on a linux system, the recommended way to use this tutorial is by creating a virtual environment in this directory with the following command:
7+
8+
```
9+
python -m venv .venv
10+
```
11+
Then activate this environment like so:
12+
13+
```
14+
source .venv/bin/activate
15+
```
16+
17+
You can ensure the the environment was succesfully activated with `which python` and ultimately deactivate the environment with `deactivate` when you're finished.
18+
19+
You may need to install/upgrade pip now with your virtual environment activated. Run the following command:
20+
21+
```
22+
python -m pip install --upgrade pip
23+
```
24+
25+
Once pip is up to date, run the following command to install the tutorial's dependencies:
26+
27+
```
28+
python -m pip install -r requirements.txt
29+
```
30+
31+
Now you are ready to launch the notebook and begin the tutorial. Run the following command and access the marimo notebook at the port provided:
32+
33+
```
34+
marimo run tutorial.py
35+
```
36+
37+
## Alternative Usage
38+
39+
### 1. Conda
40+
41+
> [!WARNING]
42+
> This method is a work-in-progress!
43+
44+
### 2. Pixi
45+
46+
> [!WARNING]
47+
> This method is a work-in-progress!
48+
49+
You can use pixi to install everything you need as defined by the pyproject.toml file. It should bundle python, FANS, AiiDA, aiida-fans, and marimo all into a virtual environment located in a .pixi directory. You can proceed to directly begin the tutorial with:
50+
51+
```
52+
marimo run tutorial.py
53+
```
54+
55+
Activating the environment may look something like this:
56+
57+
```
58+
pixi shell --manifest-path ~/FANS/tutorial/pyproject.toml
59+
```

0 commit comments

Comments
 (0)