Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,5 @@ shell.nix
model/

*.html

.idea/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features

- Update documentation for installing MUSE ([#138](https://github.com/SGIModel/MUSE_OS/pull/138))
- Updating pyproject.toml with valid python versions ([#121](https://github.com/SGIModel/MUSE_OS/pull/121))
- Expand CI workflow ([#119](https://github.com/SGIModel/MUSE_OS/pull/119))
- Convert setup.cfg to pyproject.toml and add entrypoint ([#118](https://github.com/SGIModel/MUSE_OS/pull/118))
Expand Down
137 changes: 5 additions & 132 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,12 @@

# ModUlar energy system Simulation Environment: MUSE

## Installation
## Installation instructions

### Recommended way
MUSE is available in `PyPI` and therefore it can be installed easily with `pip`. Detailed instructions on how to do that ensuring the right version of Python is used can be found in the Documentation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fine to have the instructions only on one side to avoid repetitions. We would need a direct link to the documentation from the README file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the text of the PR it is indicated that the README needs updating once this is merge. I cannot update the README until that happens.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, OK, so I misunderstood and the README would still have back again the info on the installation once the doc is updated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think I was not clear either. The README will be short, as I have left it, but the link to the documentation in RdDs cannot be added until this is merged because there's nothing to point to (I can point to the documentation overall, but not to the specific sections of it because those have changed). Is it clearer?

The recommended way for **end users** to access and use the tool is via `pipx`.
This will create an isolated environment and install MUSE-OS within in one go,
also letting you to invoke `muse` anywhere in your system.

1. Install and configure [`pipx`](https://pypa.github.io/pipx/) following the
instructions appropriate for your operative system. Make sure it works well before
moving on.
2. Install MUSE-OS with `pipx install MUSE-OS`. It might take a
while to complete, but afterwards updates should be pretty fast.
- **Note**: `pipx` will use by default a python version which might not be compatible
with MUSE-OS. To select a specific python version use the `--python` flag or set the
environment variable `PIPX_DEFAULT_PYTHON` to the appropriate executable.
See [`pipx install`](https://pypa.github.io/pipx/docs/) documentation for more information.
3. To run MUSE-OS just open a terminal and execute `muse`, with the appropriate input
arguments, if relevant. See section below about usage.

Whenever there is a new version of MUSE-OS, just run `pipx upgrade MUSE-OS` and
it will be downloaded and installed with no fuss.

### Alternative way

If you want to have a bit more control - or you don't want to use `pipx`,
just create a virtual environment first and then install `MUSE-OS`.

Although not strictly necessary, **creating a virtual environment is highly recommended**:
it will isolate users and developers from changes occuring on their operating system,
and from conflicts between python packages. It ensures reproducibility from day to day.

There are several ways of creating a virtual environment - below we list two of them.
Regardless of the method used, **once it has been created and activated**, you can install
`MUSE-OS` within using:

```bash
python -m pip install MUSE-OS
```

And then use it by invoking `muse` with the relevant input arguments.

#### Creating a virtual environment using `conda`

Create a virtual environment including python with:

```bash
conda create -n muse_env python=3.9
```

Activate the environment with:

```bash
conda activate muse_env
```

Later, to recover the system-wide "normal" python, deactivate the environment with:

```bash
conda deactivate
```

#### Creating a virtual environment using `venv`

Create a virtual environment with:

```bash
python -m pip install venv
python -m venv muse_env
```

Activate the environment with:

```powershell
# In Powershell
muse_env\Scripts\Activate.ps1

# In Linux/MacOS
source muse_env/bin/activate
```

Later, to recover the system-wide "normal" python, deactivate the environment with:

```bash
deactivate
```
- Recommended installation instructions
- Instructions for developers

## Usage

Expand All @@ -106,53 +26,6 @@ Once installed, users can:
- run `muse --help` to get a description of the command-line arguments,
including the name of any additional models provided with MUSE.

## Development

It is strongly recommened to use a virtual environment, as above. The simplest approach is to
first download the muse code with:

```bash
> git clone https://github.com/SGIModel/MUSE_OS.git
```

```bash
cd MUSE_OS
# Create virtual environment - for development, this is typically called ".venv"
# Activate virtual environment. Finally, install muse:
python -m pip install -e ."[dev,doc]"
```

Please note the quotation marks. The downloaded code can then be modified. The changes will be
automatically reflected in the environment.

To ensure the consistency of the code with other developers, install the pre-commit hooks with:

```bash
python -m pip install pre-commit
pre-commit install
```

This will ensure that a series of quality assurance tools are run with every commit you make.

In the developing phase, MUSE can also be used to run test cases to check that the model would reproduce expected results from a defined set of input data. Tests can be run with the command [pytest](https://docs.pytest.org/en/latest/), from the testing framework of the same name.

The documentation can be built with:

```bash
python -m sphinx -b html docs docs/build
```

The main page for the documentation can then be found at
`docs\\build\\html\\index.html` (or `docs/build/html/index.html` on Mac and Linux).
The file can viewed from any web browser.

[vscode](https://code.visualstudio.com/) users will find that the repository is setup
with default settings file. Users will still need to [choose the virtual
environment](https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment),
or conda environment where to run the code. This will change the `.vscode/settings.json`
file and add a user-specific path to it. Users should try and avoid commiting changes to
`.vscode/settings.json` indiscriminately.

## Copyrigh
## Copyright

Copyright © 2023 Imperial College London
Binary file added docs/figures/disable_python_alias.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figures/launch_power_shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/figures/visual-studio-installation.png
Binary file not shown.
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ ModUlar energy system Simulation Environment: MUSE
.. toctree::
:maxdepth: 2
:caption: Contents:
:numbered:
:titlesonly:

Glossary <glossary>
Installing MUSE <installing-muse>
Installing MUSE <installation>
Running MUSE <running-muse-example>
MUSE Overview <overview>
Key MUSE Components <muse-components>
Expand Down
Loading