Install
This guide will walk you through the installation process for the sonyci
package. It can be installed with pip
or pdm
(Option 1) Install with pip
pip install sonyci
(Option 2) Install with pdm
PDM is used as the packaging manager. It can be installed with pip install pdm
.
Clone the repository::
git clone https://github.com/WGBH-MLA/sonyci.git
cd sonyci
Install
Install the project with development dependencies:
pdm install
Activate your virtual environment
$(pdm venv activate)
What is $(pdm venv activate)
?
pdm venv activate
outputs the command needed to activate your virtual environment.
The $()
wrapper evaluates it in your current shell context.
Install with venv
If PDM is not available, it can also be installed with pip. It is recommeneded to install to a virtual environment using venv
:
python3 -m venv .venv
source .venv/bin/activate
Install the package
pip install .
Deactivate
To deactivate the virtual environmet, run the deactivate
command.
deactivate
Login
The first time you run the application, you will need to get an access token. You can do this with the login
command:
ci login
Credentials
You will need to provide your username
and password
, as well as your client_id
and client_secret
. These can be provided as command line options, or (recommended) as ENVIRONMENT_VARIABLES
:
Create a file called .cred
with the following contents, and add your credentials:
export CI_USERNAME=
export CI_PASSWORD=
export CI_CLIENT_ID=
export CI_CLIENT_SECRET=
export CI_WORKSPACE_ID=
Dot notation
Alternate notation for source
(may not be available in your terminal):
. .cred
Activate the variables:
source .cred
Check ennvironment variables
To check your environment variables are stored, run:
echo $CI_USERNAME
If your username does not appear, you may need to run the source
command again.
Otherwise, you can now login and get an access token:
ci login
This will save a file called .token
in the current directory. This file will be used to authenticate future requests, and you do not need to login again until the token expires.
Run the application
Now you are ready to run the application:
ci -h
See the CLI reference for more details.
Development
Additional development scripts are available in the pyproject.toml
file. You can run them with pdm <script_name>
. For example, to run the tests:
pdm test
Available scripts
test
: Run the testslint
: Run the linter, autofix fixable issuesformat
: Format the codedocs
: Build the documentation