Skip to content

Commit

Permalink
chore(release): prepare first release (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle authored Nov 26, 2024
1 parent 46ad93c commit 47ff3b8
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 45 deletions.
39 changes: 4 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,8 @@ antares studies.

This project only supports antares studies with a version v8.8 or higher.

## developers
### install dev requirements
**Table of Contents**

Install dev requirements with `pip install -r requirements-dev.txt`

### linting and formatting

To reformat your code, use this command line: `ruff check src/ tests/ --fix && ruff format src/ tests/`

### typechecking

To typecheck your code, use this command line: `mypy`

### integration testing

To launch integration tests you'll need an AntaresWebDesktop instance on your local env (at least the v.2.17.3,
**currently running in 2.17.5**).
To install it, download it from the last [Antares Web release](https://github.com/AntaresSimulatorTeam/AntaREST/releases)
(inside the assets list).
Then, unzip it at the root of this repository and rename the folder `AntaresWebDesktop`.
*NB*: The expected folder structure is the following: `antares_craft/AntaresWebDesktop/config.yaml`

### tox
To use [tox](https://tox.wiki/) to run unit tests in multiple python versions at the same time as linting and formatting
with ruff and typing with mypy:
1) As the dev requirements include [uv](https://docs.astral.sh/uv/) and `tox-uv` there is no need to install python
versions, `uv` will do this for you.
2) Use `tox -p` to run the environments in parallel to save time, this will create virtual environment with the
necessary python versions the first time you run tox.

### mkdocs
Smallest beginning of `mkdocs` included more as proof of concept than anything, theme and logo copied from [Antares
Simulator](https://github.com/AntaresSimulatorTeam/Antares_Simulator).
1) To preview the docs on your local machine run `mkdocs serve`.
2) To build the static site for publishing for example on [Read the Docs](https://readthedocs.io) use `mkdocs build`.
3) To flesh out the documentation see [mkdoc guides](https://www.mkdocs.org/user-guide/).
- [usage](docs/usage.md)
- [development](docs/developer.md)
- [Changelog](docs/CHANGELOG.md)
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
v0.1.0 (2024-11-26)
-------------------

* First release of the project.
35 changes: 35 additions & 0 deletions docs/developer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### install dev requirements

Install dev requirements with `pip install -r requirements-dev.txt`

### linting and formatting

To reformat your code, use this command line: `ruff check src/ tests/ --fix && ruff format src/ tests/`

### typechecking

To typecheck your code, use this command line: `mypy`

### integration testing

To launch integration tests you'll need an AntaresWebDesktop instance on your local env (at least the v.2.17.3,
**currently running in 2.17.5**).
To install it, download it from the last [Antares Web release](https://github.com/AntaresSimulatorTeam/AntaREST/releases)
(inside the assets list).
Then, unzip it at the root of this repository and rename the folder `AntaresWebDesktop`.
*NB*: The expected folder structure is the following: `antares_craft/AntaresWebDesktop/config.yaml`

### tox
To use [tox](https://tox.wiki/) to run unit tests in multiple python versions at the same time as linting and formatting
with ruff and typing with mypy:
1) As the dev requirements include [uv](https://docs.astral.sh/uv/) and `tox-uv` there is no need to install python
versions, `uv` will do this for you.
2) Use `tox -p` to run the environments in parallel to save time, this will create virtual environment with the
necessary python versions the first time you run tox.

### mkdocs
Smallest beginning of `mkdocs` included more as proof of concept than anything, theme and logo copied from [Antares
Simulator](https://github.com/AntaresSimulatorTeam/Antares_Simulator).
1) To preview the docs on your local machine run `mkdocs serve`.
2) To build the static site for publishing for example on [Read the Docs](https://readthedocs.io) use `mkdocs build`.
3) To flesh out the documentation see [mkdoc guides](https://www.mkdocs.org/user-guide/).
43 changes: 43 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Introduction

With antares-craft you can interact with studies using AntaresWeb API or in local mode.
To interact with AntaresWeb you need a token.

## AntaresWeb

### How to create a study

```
api_config = APIconf(api_host=antares_web.url, token=your_token, verify=False)
study = create_study_api("antares-craft-test", "880", api_config)
```

### How to point to an existing study

Not handled yet

## LOCAL

### How to create a study

study = create_study_local("your_name", 880, {"local_path": "your_path", "study_name": "your_name"})

### How to point to an existing study

`study = read_study_local(study_path)`

## Apart from that every operation is the same no matter the environment you're targetting.

### How to create an area with given properties:

```
area_properties = AreaProperties()
area_properties.energy_cost_unsupplied = 10
study.create_area("fr", area_properties)
```

### How to access study areas

```
area_list = study.read_areas()
```
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ build-backend = "setuptools.build_meta"

[project]
name = "antares_craft"
version = "0.0.1"
description = """Antares Craft python library is currently under construction. When completed it will allow to \
create, update and read antares studies."""
version = "0.1.0"
description = """Antares Craft python library under construction. It will allow to create, update and read antares studies."""
readme = "README.md"
license = {file = "LICENSE"}
authors = [
{name="Sylvain Leclerc"},
{name="Tatiana Vargas"},
{name="Martin Behlthle"},
{name="Martin Belthle"},
{name="Sigurd Borge"}
]
requires-python = ">=3.9"
Expand Down
4 changes: 2 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.projectVersion=0.1.5
sonar.projectVersion=0.1.0
sonar.organization=antaressimulatorteam
sonar.projectKey=AntaresSimulatorTeam_antares_craft
sonar.sources=src
sonar.language=python
sonar.python.coverage.reportPaths=coverage.xml
sonar.python.version=3.9
sonar.python.version=3.11
5 changes: 1 addition & 4 deletions tests/integration/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from antares.model.st_storage import STStorageGroup, STStorageMatrixName, STStorageProperties
from antares.model.study import create_study_api
from antares.model.thermal import ThermalClusterGroup, ThermalClusterProperties
from antares.service.api_services.area_api import AreaApiService

from tests.integration.antares_web_desktop import AntaresWebDesktop

Expand All @@ -52,8 +51,6 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop):

study = create_study_api("antares-craft-test", "880", api_config)

area_api = AreaApiService(api_config, study.service.study_id)

# tests area creation with default values
area_name = "FR"
area_fr = study.create_area(area_name)
Expand Down Expand Up @@ -196,7 +193,7 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop):
assert properties.group == STStorageGroup.BATTERY

# test reading list of areas
area_list = area_api.read_areas()
area_list = study.read_areas()
assert len(area_list) == 3
# asserts areas are sorted by id
assert area_list[0].id == area_be.id
Expand Down

0 comments on commit 47ff3b8

Please sign in to comment.