Smart Meter Data Collector
Project description
Smart Meter Data Collector Configurator Backend
Introduction
The backend is written with Python3 and bases on the following frameworks and libraries:
- Uvicorn: ASGI server implementation, using uvloop and httptools.
- Starlette: ASGI framework/toolkit
- Pydantic: Data validation and settings management using Python type hinting.
For managing dependency packages and virtualenv pipenv is used.
Development
Requirements
- Python >= 3.7
pipenv
- Optional software packages (Debian / Ubuntu)
- python3-all
- debhelper
- dh-python
- dh-systemd
Project Setup
With
pipenv install --dev
a new virtualenv
is set up and the listed (inclusive dev) dependencies in the Pipfile are installed.
pipenv shell
activates the created virtualenv
and opens a shell inside.
You can also run a command directly with:
pipenv run <command>
Running during development
Inside the virtualenv
run:
python -m smartmeter-datacollector-configurator [-c <config_path>] [-s <static_path>] [-d]
Now, the backend is running on port 8000
listening to 127.0.0.1
. With the option -d
hot-reloading and debug logs are enabled.
For development purposes it is possible to create an empty static
folder inside the backend
directory and start the application without the -s
option. At the same time you start the frontend (npm run serve
) in a separate shell. The API calls of the frontend, during development, are directed to a local backend to port 8000.
Command line arguments
The following command line arguments are supported:
-h, --help
: Shows the help output ofsmartmeter-datacollector-configurator
.-c, --config PATH
: Directory path where the configuration files are read and deployed (default: Current directory./
).-s,--static PATH
: Directory path where the static frontend files are located. If left empty the app check if a static directory exists in the package location and falls back to the current directory./static
.--host
: Listening host IP (default:127.0.0.1
).--port
: Listening port number (default:8000
).-d, --dev
: Enable development mode which provides debug logging and hot reloading.
Custom commands & workflows
smartmeter-datacollector-configurator
offers a few custom pipenv run
commands to simplify certain development workflows:
format_check
checks if the code follows theautopep8
code formatting rules.format
automatically adjusts the code to follow theautopep8
code formatting rules.isort_check
checks if the order of the import statements is correct usingisort
.isort
automatically re-orders the import statements usingisort
.lint_check
checks if the code follows thepylint
rules defined inpyproject.toml
.lint
automatically adjust the code to follow thepylint
rules defined inpyproject.toml
.build
builds a Python package which can be uploaded toPyPI
usingtwine
.build_check
usestwine
to check if the built Python package will be accepted byPiPI
.setup_check
checks whether the dependencies defined inPipfile
/Pipfile.lock
are in sync withsetup.py
.setup
synchronizes the dependencies defined inPipfile
/Pipfile.lock
withsetup.py
.debianize
creates adebian/
directory used to build Debian source / binary packages.build_srcdeb
builds a Debian source package which can be used to build a Debian (binary) package for any platform (e.g. usingpbuilder
)build_deb
builds a Debian package for the current development plattform.
Make sure to run format_check
/ format
, isort_check
/ isort
, lint_check
/ lint
, license
, setup_check
/ setup
before committing changes to the repository to avoid unnecessary development cycles. smartmeter-datacollector-configurator
uses GitHub Actions to check if these rules apply.
Visit Wiki - Creating a Release for further documentation about contributing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for smartmeter-datacollector-configurator-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1e06f5775d492b25a7353aefdc126a1774ba4a1005fcc87d9150a31cc0deae6 |
|
MD5 | 9dabe40a98b919cb6359fb01c2d85007 |
|
BLAKE2b-256 | 580d999256402d82a9c1b3fd3829e110b09e6af4b315fee02fbd83462d526290 |
Hashes for smartmeter_datacollector_configurator-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aa911ad8847326acd33ed11c687b3e679dc4c49cfa1f3b44014279348dd8d5c |
|
MD5 | e3fb93b38aaac4153484db8570b00e5a |
|
BLAKE2b-256 | 14f987e8bdd0f71da7ed4a5c5e51d30a1ccf38ff0706eabcc181bf5a13fb1331 |