diff --git a/README.md b/README.md index 3e45ec45..c4761b4f 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,9 @@ Antares Craft python library is currently under construction. When completed it antares studies. This project only supports antares studies with a version v8.8 or higher. + +**Table of Contents** + +- [usage](docs/usage.md) +- [development](docs/development.md) +- [Changelog](docs/CHANGELOG.md) diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 00000000..b9a895bb --- /dev/null +++ b/docs/usage.md @@ -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() +``` \ No newline at end of file diff --git a/tests/integration/test_web_client.py b/tests/integration/test_web_client.py index 69ddde87..ea54ec51 100644 --- a/tests/integration/test_web_client.py +++ b/tests/integration/test_web_client.py @@ -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 @@ -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) @@ -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