- pyenv
- Python >=3.11
- pre-commit
- Poetry
Before you start, ensure you have pyenv installed on your system. If not, you can install it using Homebrew (for macOS):
$ brew update
$ brew install pyenvFor Linux, you can use the command below:
$ curl https://pyenv.run | bashFor Windows, please refer to the official pyenv-win repository.
Once pyenv is installed, you can install Python 3.11:
$ pyenv install 3.11.0
$ pyenv global 3.11.0Next, install pre-commit:
$ pip install pre-commitAnd finally, install poetry:
$ curl -sSL https://install.python-poetry.org | python --
Clone the repository to your local machine:
$ git clone https://github.com/cern-sis/Library-Notifications-Service.git
-
Navigate to the project directory:
$ cd Library-Notifications-Service -
Install the dependencies using
poetry:$ poetry install
-
Install pre-commit hooks:
$ pre-commit install
After installing, you can use the CLI as follows:
$ python -m src.cli newsletter-
Subjects domain
- Get the latest(weekly) updates from backoffice and send the notifications for those present in the catalouge.
- Format:
value:scheme
-
Title
- Title of the notification
- Format:
'Information Technology'
-
Target Group
- Egroup identifier for sending targetted notifications.
- Format:
'library-newsletter-notif-it'
Add a new container with the required arguments (subject, title, target) in the below mentioned format in cronjob.yml in qa/prod environment.
- name: <lns-subject>
image: registry.cern.ch/cern-sis/library-notifications-service
envFrom:
- secretRef:
name: lns-creds
- configMapRef:
name: lns-cfg
args:
- '--subjects'
- '<value:scheme>'
- '--title'
- '<string>'
- '--target'
- '<e-group-identifier>'- api.py - Module containing calls to library catalouge, backoffice and notifications instances.
- cli.py - Main module conatining the supported command line arguments.
- utils.py - Module containing helper methods to manipulate data.