Skip to content

Commit

Permalink
Merge branch 'fix/readme-add-package-install' into 'main'
Browse files Browse the repository at this point in the history
Fix/readme add package install

See merge request cpes/european-projects/enershare/tsg-client!77
  • Loading branch information
itsjrsa committed Jun 5, 2024
1 parent f30d96a commit 3629c8c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 19 deletions.
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,51 @@ Python example scripts (and respective description) are also available in the [e
- [Python 3.9+](https://www.python.org/downloads/)
- [Poetry](https://python-poetry.org/docs/#installation)


### Installation steps

To install the TSG-Client, please follow the steps below:
#### Installing as a package

Although the `tsg-client` is not yet published on public Python repositories of software (e.g., PyPI), you can install it (as a package) by directly referencing this repository URL.

You can use the command below to install it directly using pip.

```bash
pip install git+https://github.com/CPES-Power-and-Energy-Systems/tsg-client.git
```

Do not forget that you will need to set up some environment variables to use this library. You can find a more detailed documentation [here](https://cpes-power-and-energy-systems.github.io/tsg-client/).


#### Cloning and local installation

If you want to modify the source code of this library, it is recommended to clone and then use [Poetry](https://python-poetry.org) to create a virtual environment to install the library dependencies and do any modifications needed.

To do this, please follow the steps below:

1. Clone the repository.

```bash
$ git clone https://github.com/CPES-Power-and-Energy-Systems/tsg-client.git
git clone https://github.com/CPES-Power-and-Energy-Systems/tsg-client.git
```

2. Assuming you have Poetry [installed](https://python-poetry.org/docs/#installation), run the following command to install the required dependencies:

```bash
$ poetry install
poetry install
```

3. Activate the virtual environment*:

```bash
$ poetry shell
poetry shell
```

Now you are ready to use the TSG-Client.

> *It's possible to use poetry without virtual environments (although recommended). For more info see Poetry [documentation](https://python-poetry.org/docs/configuration/#virtualenvscreate).
## Adding new dependencies
##### Adding new dependencies

To add a new dependency to the project, use the following command:

Expand Down
42 changes: 28 additions & 14 deletions docs/source/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,51 @@ It provides a simple and easy-to-use interface for tasks such as:

- **Python**: Install Python (version 3.9+)

- **Install Python requirements:**
- Open a terminal and execute the following command:
```bash
pip install -r requirements.txt
```


### Clone the project and setup the environment
#### Installing as a package

To install the TSG-Client, please follow the steps below:
Although the `tsg-client` is not yet published on public Python repositories of software (e.g., PyPI), you can install it (as a package) by directly referencing this repository URL.

1. Clone the repository.
You can use the command below to install it directly using pip.

```bash
$ git clone https://github.com/CPES-Power-and-Energy-Systems/tsg-client.git
pip install git+https://github.com/CPES-Power-and-Energy-Systems/tsg-client.git
```

2. (optional) Create a virtual environment and activate it.
Do not forget that you will need to set up some environment variables to use this library. You can find mode details on the [Set up environment variables](#set-up-environment-variables) section.

Check warning on line 46 in docs/source/getting_started.md

View workflow job for this annotation

GitHub Actions / pages

'myst' cross-reference target not found: 'set-up-environment-variables' [myst.xref_missing]

3. Install the required dependencies:

#### Cloning and local installation

If you want to modify the source code of this library, it is recommended to clone and then use [Poetry](https://python-poetry.org) to create a virtual environment to install the library dependencies and do any modifications needed.

To do this, please follow the steps below:


1. Clone the repository.

```bash
git clone https://github.com/CPES-Power-and-Energy-Systems/tsg-client.git
```

2. Assuming you have Poetry [installed](https://python-poetry.org/docs/#installation), run the following command to install the required dependencies:

```bash
$ pip install -r requirements.txt
poetry install
```

4. Run the following command to install the python library:
3. Activate the virtual environment*:

```bash
$ pip install .
poetry shell
```

Now you are ready to use the TSG-Client.

> *It's possible to use poetry without virtual environments (although recommended). For more info see Poetry [documentation](https://python-poetry.org/docs/configuration/#virtualenvscreate).

Once you install the library, you'll be able to use the TSG-Client in your Python projects by just importing it (see basic example below):

```python
Expand Down

0 comments on commit 3629c8c

Please sign in to comment.