dzkb / cebula-bots

πŸ§… πŸ€–

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#cebula-bots

Contributing

To begin, create a new virtual environment, for example using the virtualenvwrapper package. After that, install dependencies:

$ pip install -r requirements.txt
.
β”œβ”€β”€ README.md       # This file
β”œβ”€β”€ formatters.py   # Data formatting
β”œβ”€β”€ hooks.py        # Webhooks instructions
β”œβ”€β”€ jobs            # Jobs definition
β”‚   β”œβ”€β”€ __init__.py # Jobs triggers
β”‚   β”œβ”€β”€ base.py     # Base structures
β”‚   └── <job_name>.py # Job code
β”œβ”€β”€ main.py         # Scheduler entrypoint
β”œβ”€β”€ retry.py        # Job retry function
β”œβ”€β”€ scheduler.py    # Scheduler intialization
β”œβ”€β”€ settings.py
└── tests
    β”œβ”€β”€ conftest.py # Fixtures
    └── test_*.py

To create a new job, create a new module in jobs/ directory. After implementing the job, it's definition must be added to jobs/__init__.py:

all_jobs = [
    JobDefinition(
        id="xkom", function=xkom, trigger=CronTrigger(hour="10,22", second="10")
    ),
]

For triggers documentation, refer to APScheduler's documentation (apscheduler.triggers.* modules).

Environment variables

For settings, environment variables are used, along with python-dotenv package, which loads .env file.

Running tests

For tests, pytest package is used in following manner:

$ python -m pytest

Code guidelines

Code should be formatted using black and isort. Be sure to run the following before commiting:

black . && isort -y

About

πŸ§… πŸ€–

License:MIT License


Languages

Language:Python 100.0%