Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update initial documentation #19

Closed
wants to merge 6 commits into from
Closed
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
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Pyconceptev core
:target: https://codecov.io/gh/ansys/pyconceptev-core
:alt: Codecov

.. |GH-CI| image:: https://github.com/ansys/pyconceptev-core/actions/workflows/ci_cd.yml/badge.svg
:target: https://github.com/ansys/pyconceptev-core/actions/workflows/ci_cd.yml
.. |GH-CI| image:: https://github.com/ansys-internal/pyconceptev-core/actions/workflows/ci_cd.yml/badge.svg
:target: https://github.com/ansys-internal/pyconceptev-core/actions/workflows/ci_cd.yml
:alt: GH-CI

.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
Expand Down
32 changes: 19 additions & 13 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
.. include:: ../../README.rst


ConceptEV Specific Instructions

Check warning on line 9 in doc/source/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/index.rst#L9

[Google.Headings] 'ConceptEV Specific Instructions' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'ConceptEV Specific Instructions' should use sentence-style capitalization.", "location": {"path": "doc/source/index.rst", "range": {"start": {"line": 9, "column": 1}}}, "severity": "WARNING"}
-------------------------------
.. WARNING::
Beware this api is in a state of rapid to change and should be considered unstable.
Beware this API is in a state of rapid to change and should be considered unstable.



You need to:
- `Install the library`
- `Configure Session using .env file`
- `Get a token`
- `Create a client`
- `Understand the API` at https://dev-conceptev.awsansys3np.onscale.com/api/docs

* `Install the library`
* `Configure Session using .env file`
* `Get a token`
* `Create a client`
* `Understand the API` at https://dev-conceptev.awsansys3np.onscale.com/api/docs

Install the library
^^^^^^^^^^^^^
Expand All @@ -36,6 +37,7 @@
pipx install poetry

#. Install dependencies using poetry:

.. code:: bash

poetry install
Expand All @@ -44,45 +46,49 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

you need to create a .env file to keep your password and other configurable data it should look something like this:

.. code-block:: bash

CONCEPTEV_USERNAME = joe.blogs@my_work.com
CONCEPTEV_PASSWORD = sup3r_s3cr3t_passw0rd
OCM_URL = https://test.portal.onscale.com/api
CONCEPTEV_URL = https://dev-conceptev.awsansys3np.onscale.com/api


Get a token
^^^^^^^^^^^

Import the main module and use get_token this should return a random string from the servers to get you access.
Import the main module and use ``get_token``. This should return a random string from the servers to get you access.

.. code-block:: python
import pyconceptev-core.main as pyconceptev #Test this

import ansys.conceptev.core.main as pyconceptev
token = pyconceptev.get_token()


Create a client
^^^^^^^^^^^^^^^

You need to create a client that can access and talk to the api. You can use the health check api to check your connection.
You need to create a client that can access and talk to the API. You can use the health check API to check your connection.

Check warning on line 71 in doc/source/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/index.rst#L71

[Google.WordList] Use 'select' instead of 'check'.
Raw output
{"message": "[Google.WordList] Use 'select' instead of 'check'.", "location": {"path": "doc/source/index.rst", "range": {"start": {"line": 71, "column": 89}}}, "severity": "WARNING"}

Check warning on line 71 in doc/source/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/index.rst#L71

[Google.WordList] Use 'select' instead of 'check'.
Raw output
{"message": "[Google.WordList] Use 'select' instead of 'check'.", "location": {"path": "doc/source/index.rst", "range": {"start": {"line": 71, "column": 102}}}, "severity": "WARNING"}

.. code-block:: python
import pythonconceptev-core.main as pyconceptev

import ansys.conceptev.core.main as pyconceptev

with pyconceptev.create_client(token,concept_id) as client:
print(pyconceptev.read(client,"/health"))

Understand the API

Check warning on line 80 in doc/source/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/index.rst#L80

[Google.Headings] 'Understand the API' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Understand the API' should use sentence-style capitalization.", "location": {"path": "doc/source/index.rst", "range": {"start": {"line": 80, "column": 1}}}, "severity": "WARNING"}
^^^^^^^^^^^^^^^^^^

Use the api documentation at https://dev-conceptev.awsansys3np.onscale.com/api/docs
Use the API documentation at https://dev-conceptev.awsansys3np.onscale.com/api/docs
This shows you which verbs and which routes/paths are available and what inputs/outputs they have.
You can use the verb functions created in this module to make things simpler.

To create a configuration we need to use the verb `post` with route `/configurations` and add the `data` from the schema.

Check warning on line 87 in doc/source/index.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] doc/source/index.rst#L87

[Google.We] Try to avoid using first-person plural like 'we'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'we'.", "location": {"path": "doc/source/index.rst", "range": {"start": {"line": 87, "column": 27}}}, "severity": "WARNING"}

.. code-block:: python

pyconcetpev.create(client,'/configurations',data={"name": "New Aero Config",
"drag_coefficient": 1,
"cross_sectional_area": 2,
"config_type": "aero"})

Loading