The below repository is present on Knoldus Public Github and contains the multi-module python project with best practices and standards implemented.
Python 3.8
Create an isolated Python virtual environments. or conda
1.Create a new virtual environment by choosing a Python interpreter and making a ./venv directory to hold it(you can also use anaconda/any other methods available):
python3 -m venv ./venv
source ./venv/bin/activate
git clone <repo_name>
$python -m pip install --upgrade pip
pip install -r requirements.txt
├── actions
│ └── actions.py
├── app.py
├── config
│ └── config.ini
├── config.yml
├── credentials.yml
├── data
│ ├── Entity_extracted_data
│ ├── Input_Data
│ ├── nlu.yml
│ ├── rules.yml
│ └── stories.yml
├── domain.yml
├── endpoints.yml
├── lib
│ ├── config_validator.py
│ ├── error_handlers.py
│ ├── logger.py
│ ├── preprocessor.py
│ ├── rasa_agent.py
│ └── response_creator.py
├── logs
│ └── 2023_02_08.log
├── models
│ └── 20221126-134706.tar.gz
├── results_model
│ ├── DIETClassifier_confusion_matrix.png
│ ├── DIETClassifier_errors.json
│ ├── DIETClassifier_histogram.png
│ ├── DIETClassifier_report.json
│ ├── intent_confusion_matrix.png
│ ├── intent_errors.json
│ ├── intent_histogram.png
│ └── intent_report.json
└── tests
├── test_inference.py
└── test_preprocessor.py
Remove the .gitkeep file present inside data/Input_data & data/Entity_extracted_data (Check for hidden files to make sure)
$python3 app.py
GET: Check whether the server is running or not
http://localhost:8000/ping
POST: Input a .pdf as a body through postman
http://localhost:8000/invocations
Automated code quality checks are performed using pre-commit. Code quality tool are present in .pre-commit-config.yaml file. Additional code quality tools can be added or removed through the .pre-commit-config.yaml file
List of Code Quality tools used are as follows
flake8
pylint
bandit
black
isort
Note:Make sure to initialize git using $git init ,If it isn't initialized. Then run
$pre-commit run --all-files
Testing is performed with pytest. pytest has become the de facto Python unit testing framework. Code coverage is provided by
$ pytest-cov
Docker is a tool that allows for software to be packaged into isolated containers.
To build the container image:
$ docker build -t <image_name> .
To run the image in a container:
$ docker run <image_name>