|
| 1 | +pySDC Tutorial at 14th PinT Workshop |
| 2 | +==================================== |
| 3 | +**Time**: July 7, 2025 |
| 4 | + |
| 5 | +**Place**: ICMS, Edinburgh |
| 6 | + |
| 7 | +Installation |
| 8 | +------------ |
| 9 | +In order to start playing, install `pySDC` and its dependencies, ideally in developer mode. |
| 10 | +First, we need to download the repository. |
| 11 | +There are multiple ways to do that, but if you plan to work with `pySDC` directly, the best way is to |
| 12 | +(1) `fork <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks>`_ |
| 13 | +the main repository to your Github account and then |
| 14 | +(2) `clone <https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository>`_ it from there. |
| 15 | +This way you can work on a separate repository while being able to pull updates from the main one and |
| 16 | +starting pull requests to merge back your ideas. |
| 17 | +You can also clone the main repository, but this will not accept your pushes. |
| 18 | +Downloading `pySDC` as a tarball is the easiest, but also the least favorable solution. |
| 19 | +Finally, the code can also be obtained using ``pip install``, but then sources are not that easily accessible. |
| 20 | + |
| 21 | +So, please go ahead and clone from your fork on Github: |
| 22 | + |
| 23 | +.. code-block:: bash |
| 24 | +
|
| 25 | + git clone https://github.com/<your_account>/pySDC.git |
| 26 | +
|
| 27 | +Next, navigate to the directory that contains this file and setup up a virtual environment, e.g. by using `Micromamba <https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html>`_. |
| 28 | +From the root directory of `pySDC`, you can run |
| 29 | + |
| 30 | +.. code-block:: bash |
| 31 | +
|
| 32 | + cd <pySDC-root-dir>/pySDC/playgrounds/PinT_Workshop_2025 |
| 33 | + |
| 34 | +Now, create the virtual environment with the following command. If you are using ``conda`` instead of ``micromamba``, you can just replace ``micromamba`` with ``conda`` in the commands, or run first run ``conda install -c conda-forge micromamba``. |
| 35 | + |
| 36 | +.. code-block:: bash |
| 37 | +
|
| 38 | + micromamba env create -f environment-tutorial.yml |
| 39 | + micromamba activate pySDC_tutorial |
| 40 | +
|
| 41 | + |
| 42 | +This may take a while... |
| 43 | +Note that this folder and all changes in it will remain even if you leave the virtual environment. |
| 44 | +Only installations made with ``micromamba`` or ``pip`` are affected by changing the environment. |
| 45 | +Use `branches <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches>`_ to isolate development work. |
| 46 | +**Please make sure to perform all the following steps inside the virtual environment!** |
| 47 | + |
| 48 | +Finally, you can install `pySDC` via ``pip`` in editable mode using: |
| 49 | + |
| 50 | +.. code-block:: bash |
| 51 | +
|
| 52 | + pip install -e <pySDC-root-dir> |
| 53 | +
|
| 54 | +You don't need to do this, but it can make life easier when it comes to setting path variables etc. |
| 55 | + |
| 56 | +Testing |
| 57 | +------- |
| 58 | + |
| 59 | +Change to `pySDC`'s root directory and run |
| 60 | + |
| 61 | +.. code-block:: bash |
| 62 | +
|
| 63 | + pytest pySDC/tests -m "base and not slow" |
| 64 | +
|
| 65 | +This will check if "all" went well with the installation you just created. |
| 66 | +Note that at the time of creating this tutorial we had to remove `mpi4py_fft` from the dependencies. |
| 67 | +Therefore, 7 out of the 39 selected test cases may fail! |
| 68 | +Anyway, you are now ready to play with `pySDC`. |
| 69 | + |
| 70 | +Jupyter |
| 71 | +------- |
| 72 | +In order to use our virtual environment within Jupyter, we make a kernel for it with all our nice packages. |
| 73 | +We do that with |
| 74 | + |
| 75 | +.. code-block:: bash |
| 76 | +
|
| 77 | + python -m ipykernel install --user --name=pySDC_tutorial |
| 78 | +
|
| 79 | +Now, start jupyter and have a look at the notebooks! |
| 80 | + |
| 81 | +.. code-block:: bash |
| 82 | +
|
| 83 | + jupyter notebook |
0 commit comments