https://github.com/sncf-connect-tech/hesperides-cli
Command Line Interface for Hesperides
https://github.com/sncf-connect-tech/hesperides-cli
cli hesperides python
Last synced: about 1 year ago
JSON representation
Command Line Interface for Hesperides
- Host: GitHub
- URL: https://github.com/sncf-connect-tech/hesperides-cli
- Owner: sncf-connect-tech
- License: gpl-3.0
- Created: 2017-07-13T13:09:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-15T14:10:32.000Z (over 5 years ago)
- Last Synced: 2025-06-22T11:02:45.544Z (about 1 year ago)
- Topics: cli, hesperides, python
- Language: Python
- Homepage: https://github.com/voyages-sncf-technologies/hesperides
- Size: 159 KB
- Stars: 4
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# HESPERIDES CLI
[](https://travis-ci.org/voyages-sncf-technologies/hesperides-cli) [](https://coveralls.io/github/voyages-sncf-technologies/hesperides-cli?branch=master) [](https://pypi.python.org/pypi/hesperides-cli) [](https://pypi.python.org/pypi/hesperides-cli) [](https://pypi.python.org/pypi/hesperides-cli)
Python 3 lib & CLI (_Command Line Interface_) for [Hesperides](https://github.com/voyages-sncf-technologies/hesperides)
A changelog is available here: [CHANGELOG.md](CHANGELOG.md)
## Installation
`hesperides-cli` is published on [Pypi](https://pypi.python.org/pypi/hesperides-cli). It can be installed simply with `pip`:
pip install hesperides-cli
### Developper environment installation
After cloning this repo and optionally creating a [virtualenv](https://github.com/berdario/pew):
pip install -e .
### Releasing a new version
With a valid `~/.pypirc`:
1. update `CHANGELOG.md`
2. bump version in `hesperidescli/hesperidescli.py` & `git commit` & `git push`
3. `python setup.py sdist`
4. `twine upload dist/*`
5. perform a release on GitGub, including the description added to `CHANGELOG.md`
## Usage
hesperides [OPTIONS] COMMAND [ARGS]
To get all hesperides commands, just type:
hesperides
### Configure
This client configuration is stored locally in `~/.hesperides/`:
To set up your environment and create a local user profile by answering to a few questions:
hesperides set-conf [PROFILE_NAME]
If you have multiple profiles, you can switch between them with:
hesperides use-profile [PROFILE_NAME]
To try your configuration, type one of these commands:
hesperides get-versions
hesperides get-user
### Usage with Docker
You can using the following `Dockerfile` as a starting point:
FROM python:3
RUN pip install hesperides-cli
ARG USERNAME
ARG PASSWORD
RUN hesperides set-conf --username $USERNAME --password $PASSWORD --hesperides-endpoint https://hesperides.example --ignore-ssl-warnings
ENTRYPOINT ["hesperides"]
The resulting Docker image will contain some secret credentials, which is **not** a good practice,
but makes it really easy to use for demos:
docker build --build-arg USERNAME=... --build-arg PASSWORD=... -t hesperides-cli .
docker run --rm hesperides-cli get-versions
If your goal is instead to generate files in your Docker image at startup time,
you can start by putting something like this in your `ENTRYPOINT`:
hesperides write-files --app $APP --ptf $PTF
### Exporting properties as environment variables
For this use case, you can use `get-properties --export`.
Here is an example of usage, that could be included in a Gitlab CD/CI step for instance:
tmp_file=$(mktemp) && hesperides get-properties --app APP --ptf PTF --path '#ROOT#test-module#1.1#WORKINGCOPY' --export > $tmp_file && source $tmp_file && rm $tmp_file
### Local files generation with zero calls to the backend API
_cf._ [hesperidescli.local](hesperidescli/local)
### Warning for Windows bash users
When using this tool with a Python version installed through Windows,
in combination with a Linux-like shell environment (_e.g._ Git Bash),
the files generated by `write-files` may not be written were you expect,
because your Python executable will interpret Unix path like `/var/tmp` as relative to your current drive (`C:`, `D:`...).
In this situation, use this command to find out where is the location of your root (`/`) for Python:
python -c 'import os; os.chdir("/"); print(os.getcwd())'