This is a Python implementation of the Secmatic Order API project
The implementation is based on Python Flask
The open api contract for the services is defined in the Specmatic Central Contract Repository
-
Install Python 3.12 ( use homebrew if you are on mac os)
-
Install JRE 17 or later
-
Clone the git repository
-
Virtual Environment Setup
-
Create a "virtual environment" named '.venv' by running:
-
python -m venv .venv
-
-
This will create a virtual environment using the default python installation, If you wish to provide a specific python installation, run:
-
py -X.Y -m venv .venv
where X and Y are the major and minor version numbers of the python installation to use.
-
-
To activate your virtual environment, execute this from a terminal window in your root folder:
-
on MacOS and Linux:
source .venv/bin/activate
-
on Windows:
on CMD
.venv\Scripts\activate.bat
on PowerShell ( might have to change ExecutionPolicy )
.\.venv\Scripts\Activate.ps1
-
-
Install project requirements
From a terminal window in your root folder, run:
pip install -r requirements.txt
-
From a terminal window in your root folder, run:
-
flask run
-
-
This should start the flask dev server on http://127.0.0.1:5000/
-
To check, run this route from browser:
-
You should see a response like this:
{ "id": 10, "inventory": 10, "name": "XYZ Phone", "type": "gadget" }
-
From a terminal window in your root folder, run:
-
pytest test -v -s
-
-
This should print the following output:
Tests run: 19, Successes: 19, Failures: 0, Errors: 0