Skip to content

Commit 84f32ae

Browse files
Merge pull request #135 from easyscience/hot-fix
Fix missing install step in notebooks for documentation (Colab support)
2 parents 2f1a707 + aeabe24 commit 84f32ae

28 files changed

+1540
-1481
lines changed

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WARNING: Do not edit this file manually.
22
# Any changes will be overwritten by Copier.
3-
_commit: v0.10.1-25-ga5301e9
3+
_commit: v0.10.1-33-g0f85abf
44
_src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/diffraction-app
66
app_doi: 10.5281/zenodo.18163581
@@ -12,7 +12,7 @@ home_repo_name: diffraction
1212
lib_docs_url: https://easyscience.github.io/diffraction-lib
1313
lib_doi: 10.5281/zenodo.18163581
1414
lib_package_name: easydiffraction
15-
lib_python_max: '3.13'
15+
lib_python_max: '3.14'
1616
lib_python_min: '3.11'
1717
lib_repo_name: diffraction-lib
1818
project_contact_email: support@easydiffraction.org

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@
104104

105105
- Jupyter notebooks (`docs/docs/tutorials/*.ipynb`) are **generated
106106
artifacts** — never edit them by hand. Edit only the corresponding
107-
`*.py` script, then run `pixi run notebook-convert` followed by
108-
`pixi run notebook-prepare` to regenerate the notebook.
107+
`*.py` script, then run `pixi run notebook-prepare` to regenerate the
108+
notebook.
109109

110110
## Changes
111111

.github/workflows/issues-labels.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
runs-on: ubuntu-latest
1717

1818
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v5
21+
1922
- name: Setup easyscience[bot]
2023
id: bot
2124
uses: ./.github/actions/setup-easyscience-bot

.github/workflows/pypi-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
- name: Init pixi project
4646
run: pixi init easydiffraction
4747

48-
- name: Add Python 3.13 from Conda
48+
- name: Add Python 3.14 from Conda
4949
working-directory: easydiffraction
50-
run: pixi add "python=3.13"
50+
run: pixi add "python=3.14"
5151

5252
- name: Add other Conda dependencies
5353
working-directory: easydiffraction

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ concurrency:
4444
# Set the environment variables to be used in all jobs defined in this workflow
4545
env:
4646
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
47-
PY_VERSIONS: '3.11 3.13'
48-
PIXI_ENVS: 'py-311-env py-313-env'
47+
PY_VERSIONS: '3.11 3.14'
48+
PIXI_ENVS: 'py-311-env py-314-env'
4949

5050
jobs:
5151
# Job 1: Set up environment variables

docs/architecture/architecture.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,8 @@ All examples below are drawn from the actual tutorials (`tutorials/`).
771771

772772
> **Notebook workflow:** Jupyter notebooks (`*.ipynb`) in
773773
> `docs/docs/tutorials/` are generated artifacts. Edit only the
774-
> corresponding `*.py` script, then run `pixi run notebook-convert`
775-
> followed by `pixi run notebook-prepare` to regenerate the notebook.
776-
> Never edit `*.ipynb` files by hand.
774+
> corresponding `*.py` script, then run `pixi run notebook-prepare` to
775+
> regenerate the notebook. Never edit `*.ipynb` files by hand.
777776
778777
### 8.1 Project Setup
779778

docs/docs/installation-and-setup/index.md

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ icon: material/cog-box
44

55
# :material-cog-box: Installation & Setup
66

7-
## Requirements
7+
**EasyDiffraction** is a cross-platform Python library compatible with
8+
**Python 3.11** through **3.14**.
89

910
EasyDiffraction is a cross-platform Python library compatible with
1011
**Python 3.11 through 3.13**.
@@ -13,6 +14,93 @@ installation.
1314

1415
## Environment Setup <small>optional</small> { #environment-setup data-toc-label="Environment Setup" }
1516

17+
- **Ease of use**: Pixi simplifies the installation process, making it
18+
accessible even for users with limited experience in package management.
19+
- **Python version control**: Pixi allows specifying and managing different
20+
Python versions for each project, ensuring compatibility.
21+
- **Isolated environments**: Pixi creates isolated environments for each
22+
project, preventing conflicts between different package versions.
23+
- **PyPI and Conda support**: Pixi can install packages from both PyPI and
24+
Conda repositories, providing access to a wide range of libraries.
25+
26+
An alternative installation method using the traditional **pip** package
27+
manager is also provided.
28+
29+
## Installing with Pixi <small>recommended</small> { #installing-with-pixi data-toc-label="Installing with Pixi" }
30+
31+
This section describes the simplest way to set up EasyDiffraction using
32+
**Pixi**.
33+
34+
#### Installing Pixi
35+
36+
- Install Pixi by following the instructions on the
37+
[official Pixi Installation Guide](https://pixi.prefix.dev/latest/installation).
38+
39+
#### Setting up EasyDiffraction with Pixi
40+
41+
<!-- prettier-ignore-start -->
42+
43+
- Choose a project location (local drive recommended).
44+
45+
??? warning ":fontawesome-brands-windows: Windows + OneDrive"
46+
47+
We **do not recommend creating a Pixi project inside OneDrive or other
48+
synced folders**.
49+
50+
By default, Pixi creates the virtual environment inside the project
51+
directory (in `.pixi/`). On Windows, synced folders such as OneDrive
52+
may cause file‑system issues (e.g., path-length limitations or
53+
restricted link operations), which can lead to unexpected install
54+
errors or environments being recreated.
55+
56+
Instead, create your project in a **local directory on your drive**
57+
where you have full write permissions.
58+
59+
<!-- prettier-ignore-end -->
60+
61+
- Initialize a new Pixi project and navigate into it:
62+
```txt
63+
pixi init easydiffraction
64+
cd easydiffraction
65+
```
66+
- Set the Python version for the Pixi environment (e.g., 3.14):
67+
```txt
68+
pixi add python=3.14
69+
```
70+
- Add EasyDiffraction to the Pixi environment from PyPI:
71+
```txt
72+
pixi add --pypi easydiffraction
73+
```
74+
- Add a Pixi task to run EasyDiffraction commands easily:
75+
```txt
76+
pixi task add easydiffraction "python -m easydiffraction"
77+
```
78+
79+
#### Updating Pixi and EasyDiffraction
80+
81+
- To update all packages in the Pixi environment, including
82+
EasyDiffraction:
83+
```txt
84+
pixi update
85+
```
86+
- To update Pixi itself to the latest version:
87+
```txt
88+
pixi self-update
89+
```
90+
91+
#### Uninstalling Pixi
92+
93+
- Follow the
94+
[official Pixi Guide](https://pixi.prefix.dev/latest/installation/#uninstall).
95+
96+
## Classical Installation
97+
98+
This section describes how to install EasyDiffraction using the
99+
traditional method with **pip**. It is assumed that you are familiar
100+
with Python package management and virtual environments.
101+
102+
### Environment Setup <small>optional</small> { #environment-setup data-toc-label="Environment Setup" }
103+
16104
We recommend using a **virtual environment** to isolate dependencies and
17105
avoid conflicts with system-wide packages. If any issues arise, you can
18106
simply delete and recreate the environment.

docs/docs/tutorials/ed-1.ipynb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "8dbf8e63",
7+
"metadata": {
8+
"tags": [
9+
"hide-in-docs"
10+
]
11+
},
12+
"outputs": [],
13+
"source": [
14+
"# Check whether easydiffraction is installed; install it if needed.\n",
15+
"# Required for remote environments such as Google Colab.\n",
16+
"import importlib.util\n",
17+
"\n",
18+
"if importlib.util.find_spec('easydiffraction') is None:\n",
19+
" %pip install easydiffraction"
20+
]
21+
},
322
{
423
"cell_type": "markdown",
524
"id": "0",

docs/docs/tutorials/ed-10.ipynb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "f42176f2",
7+
"metadata": {
8+
"tags": [
9+
"hide-in-docs"
10+
]
11+
},
12+
"outputs": [],
13+
"source": [
14+
"# Check whether easydiffraction is installed; install it if needed.\n",
15+
"# Required for remote environments such as Google Colab.\n",
16+
"import importlib.util\n",
17+
"\n",
18+
"if importlib.util.find_spec('easydiffraction') is None:\n",
19+
" %pip install easydiffraction"
20+
]
21+
},
322
{
423
"cell_type": "markdown",
524
"id": "0",

docs/docs/tutorials/ed-11.ipynb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "b38dbf4f",
7+
"metadata": {
8+
"tags": [
9+
"hide-in-docs"
10+
]
11+
},
12+
"outputs": [],
13+
"source": [
14+
"# Check whether easydiffraction is installed; install it if needed.\n",
15+
"# Required for remote environments such as Google Colab.\n",
16+
"import importlib.util\n",
17+
"\n",
18+
"if importlib.util.find_spec('easydiffraction') is None:\n",
19+
" %pip install easydiffraction"
20+
]
21+
},
322
{
423
"cell_type": "markdown",
524
"id": "0",

0 commit comments

Comments
 (0)