This package Notifies the contributors of Smart Data Models of updates and/or version upgrades in case it happens in the data model/subject they contributed to.
To create a virtual environment in Python using the venv
module, the following command can be executed in the terminal:
python3 -m venv venv
To activate a virtual environment named "venv" in the root path, you can use the following command:
source venv/bin/activate
To manage the dependencies in this project and for Python package management, Poetry is used.
-
Install Poetry: Execute the following command in the terminal:
curl -sSL https://install.python-poetry.org | python -
-
Activate the Virtual Environment: Since this project
contributor_notifier
has a virtual environment managed by Poetry, it can be activated using the following command:cd contributor_notifier poetry shell
-
Install Dependencies: If the project's dependencies are not installed, the following command can be used to install them based on the pyproject.toml and poetry.lock files (under
contributor_notifier
):poetry install
To check the installed packages used in this Python project, check the file named
pyproject.toml
. For example:[tool.poetry] name = "contributor_notifier" version = "0.1.0" description = "" authors = ["feki-rihab <rihab.feki@fiware.org>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.9" requests = "^2.31.0" pymongo = "^4.6.1" pygithub = "^2.2.0" python-dotenv = "^1.0.1" github-py = "^0.5.0" pyyaml = "^6.0.1" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"
-
Add Dependencies (Optional): To customize this project or add more functionnalities to it, the
add
command can be used to add dependencies to it.For example, to add the
requests
library, run:cd contributor_notifier poetry add requests
-
Run The Project: Once the virtual environment is activated, the Python script can be run using the
poetry run
command.For example, to run a script named
main.py
, use:poetry run python main.py
To manage Environment Variables in this project, create a file .env
in which you can define the needed variables that should be private and secrets e.g database credentials, access tokens, etc. For example:
MONGO_DB_NAME=your-database-name
MONGO_PORT=mongo-port
MONGO_HOST="127.0.0.1"
MONGO_COLLECTION_NAME=your-collection-name
TOKEN=github-token
Use the library python-dotenv
to instantiate the env vars in the python modules, for example:
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
# MongoDB connection parameters - env variables
mongo_host = os.getenv("MONGO_HOST")
mongo_port = int(os.getenv("MONGO_PORT"))