106 lines
3.4 KiB
Markdown
106 lines
3.4 KiB
Markdown
# d4science_copernicus_cds
|
|
|
|
**d4science_copernicus_cds** is a library developed by CNR-ISTI to manage Climate Data Store (CDS) API authentication within D4Science JupyterLab environments. It simplifies credential handling, allowing for secure, reusable access to the CDS API across multiple notebooks.
|
|
|
|
## Version
|
|
|
|
v.1.0.0
|
|
|
|
## Installation
|
|
|
|
Python: Install the library directly from the D4Science Git
|
|
|
|
```sh
|
|
pip install git+https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git
|
|
```
|
|
|
|
Jupyter notebook: install using the `!` prefix
|
|
|
|
|
|
```sh
|
|
! pip install git+https://code-repo.d4science.org/D4Science/d4science_copernicus_cds.git
|
|
```
|
|
|
|
## Built With
|
|
|
|
* [Copernicus CDSAPI](https://cds.climate.copernicus.eu/how-to-api/) - the Copernicus Climate Data Store (CDS) Application Program Interface (API) client
|
|
* [python](https://python.org/)
|
|
* [d4science](https://www.d4science.org/)
|
|
|
|
## Documentation
|
|
|
|
* **Centralized Authentication**: Configures the JupyterLab environment for automatic CDS authentication without the need to specify credentials in each notebook.
|
|
* **Secure Credential Storage**: Optionally saves credentials in a hidden configuration file, enabling silent authentication in future sessions.
|
|
* **Flexible Credential Management**: Provides functions to add, view, and remove credentials from the environment and configuration files.
|
|
|
|
### Usage
|
|
|
|
Below are the main commands provided by the auth_cds library to manage CDS API authentication and configuration.
|
|
|
|
First, import the necessary functions:
|
|
|
|
```python
|
|
from auth_cds import cds_authenticate, cds_remove_conf, cds_save_conf, cds_remove_env, cds_show_conf
|
|
```
|
|
|
|
#### Main Commands
|
|
|
|
**Authenticate and get CDS client:**
|
|
This command authenticates and returns a CDS API client instance.
|
|
|
|
```python
|
|
client = cds_authenticate()
|
|
```
|
|
|
|
**Save the current or new configuration:**
|
|
Saves the configuration to a default hidden file.
|
|
|
|
```python
|
|
cds_save_conf()
|
|
```
|
|
|
|
**Remove environment variables for the CDS API:**
|
|
Clears the CDS API credentials from environment variables. To execute, remove the comment symbol (#).
|
|
|
|
```python
|
|
cds_remove_env()
|
|
```
|
|
|
|
**Remove configurations from default paths:**
|
|
Removes any saved configuration files. To execute, remove the comment symbol (#).
|
|
|
|
```python
|
|
cds_remove_conf()
|
|
```
|
|
|
|
**Show current configuration from environment and files:**
|
|
Displays the credentials configured in the environment and any found in the saved configuration file.
|
|
|
|
```python
|
|
cds_show_conf()
|
|
```
|
|
|
|
## Change log
|
|
|
|
See [CHANGELOG.md](CHANGELOG.md).
|
|
|
|
## Authors
|
|
|
|
* **Alfredo Oliviero** ([ORCID]( https://orcid.org/0009-0007-3191-1025)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/A.Oliviero)
|
|
|
|
## Maintainers
|
|
|
|
* **Alfredo Oliviero** ([ORCID]( https://orcid.org/0009-0007-3191-1025)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/A.Oliviero)
|
|
|
|
## License
|
|
|
|
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
|
|
|
|
## About the gCube Framework
|
|
|
|
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
|
|
open-source software toolkit used for building and operating Hybrid Data
|
|
Infrastructures enabling the dynamic deployment of Virtual Research Environments
|
|
by favouring the realisation of reuse oriented policies.
|
|
|
|
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md) |