⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
[!WARNING]
This SDK is under development and not yet released.[!IMPORTANT]
For this python code to work, the SDK from Horiba has to be purchased, installed and licensed. The code in this repo and the SDK are under development and not yet released for public use!
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
📦 Prerequisites
>=3.9
(Optional but recommended) Work in a virtual environment:
Navigate to the (empty) project folder you want to work and run:
python -m venv .
Activate the virtual environment:
Note: do deactivate it, simply run deactivate
.
Install the sdk:
pip install horiba-sdk
or install with Poetry
poetry add horiba-sdk
Create a file named center_scan.py
and copy-paste the content of
examples/asynchronous_examples/center_scan.py
Install the required library for plotting the graph in the example:
pip install matplotlib
or install with Poetry
poetry add matplotlib
Run the example with:
python center_scan.py
git clone https://github.com/ThatsTheEnd/horiba-python-sdk.git
cd horiba-python-sdk
Poetry
installed run:make poetry-download
pre-commit
hooks:make install
make pre-commit-install
make codestyle
git add .
git commit -m "feat: add new feature xyz"
git push
Want to know more about Poetry? Check its documentation.
Poetry's [commands](https://python-poetry.org/docs/cli/#commands) are very intuitive and easy to learn, like: - `poetry add numpy@latest` - `poetry run pytest` - `poetry publish --build` etc
Building a new version of the application contains steps:
poetry version <version>
. You can pass the new version explicitly, or a rule such as major
, minor
, or patch
. For more details, refer to the Semantic Versions standard.CHANGELOG.md
with git-changelog -B auto -Tio CHANGELOG.md
GitHub
.Create a tag and push it. The release is automatically triggered on tag push:
git tag vX.Y.Z # where the version MUST match the one you indicated before
git push --tags
Makefile
contains a lot of functions for faster development.
To download and install Poetry run: ```bash make poetry-download ``` To uninstall ```bash make poetry-remove ```
Install requirements: ```bash make install ``` Pre-commit hooks coulb be installed after `git init` via ```bash make pre-commit-install ```
Automatic formatting uses `pyupgrade`, `isort` and `black`.
```bash
make codestyle
# or use synonym
make formatting
```
Codestyle checks only, without rewriting files:
```bash
make check-codestyle
```
> Note: `check-codestyle` uses `isort`, `black` and `darglint` library
Update all dev libraries to the latest version using one comand
```bash
make update-dev-deps
```
```bash
make check-safety
```
This command launches `Poetry` integrity checks as well as identifies security issues with `Safety` and `Bandit`.
```bash
make check-safety
```
4. Code security
Run `mypy` static type checker ```bash make mypy ```
Run `pytest` Unix: ```bash make test ``` Windows: ```powershell poetry run pytest -c pyproject.toml --cov-report=html --cov=horiba_sdk tests/ ``` For the hardware tests run the following: Windows: ```powershell $env:HAS_HARDWARE="true" poetry run pytest -c pyproject.toml --cov-report=html --cov=horiba_sdk tests/ ``` Unix: ```bash HAS_HARDWARE="true" make test ```
Of course there is a command to ~~rule~~ run all linters in one: ```bash make lint ``` the same as: ```bash make test make check-codestyle make mypy make check-safety ```
```bash make docker-build ``` which is equivalent to: ```bash make docker-build VERSION=latest ``` Remove docker image with ```bash make docker-remove ``` More information [about docker](https://github.com/ThatsTheEnd/horiba-python-sdk/tree/master/docker).
Delete pycache files ```bash make pycache-remove ``` Remove package build ```bash make build-remove ``` Delete .DS_STORE files ```bash make dsstore-remove ``` Remove .mypycache ```bash make mypycache-remove ``` Or to remove all above run: ```bash make cleanup ```
The latest documentation can be found at
horiba-python-sdk.readthedocs.io.
In order to build it locally, run the following in the docs/
folder:
make html
The documentation will then be built under docs/build/html/
.
Documentation is built each time a commit is pushed on main
or for pull
requests. When release tags are created in the repo, readthedocs will also tag
the documentation accordingly
Python 3.9
and higher.Poetry
as the dependencies manager. See configuration in pyproject.toml
.ruff
pre-commit
hooks with code-formatting.mypy
; security checks with safety
and bandit
pytest
..editorconfig
, .dockerignore
, and .gitignore
. You don't have to worry about those things.GitHub
integration: issue and pr templates.Github Actions
with predefined build workflow as the default CI/CD.Makefile
. More details in makefile-usage.@dependabot
. You will only enable it.Release Drafter
. You may see the list of labels in release-drafter.yml
. Works perfectly with Semantic Versions specification.LICENSE
, CONTRIBUTING.md
, CODE_OF_CONDUCT.md
, and SECURITY.md
are generated automatically.Release Drafter
.
You can see the list of available releases on the GitHub Releases page.
We follow Semantic Versions specification.
Label | Title in Releases |
---|---|
enhancement , feature |
🚀 Features |
bug , refactoring , bugfix , fix |
🔧 Fixes & Refactoring |
build , ci , testing |
📦 Build System & CI/CD |
breaking |
💥 Breaking Changes |
documentation |
📝 Documentation |
dependencies |
⬆️ Dependencies updates |
This project is licensed under the terms of the MIT
license. See LICENSE for more details.
@misc{horiba-python-sdk,
author = {ZühlkeEngineering},
title = {'horiba-python-sdk' is a package that provides source code for the development with Horiba devices},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/ThatsTheEnd/horiba-python-sdk}}
}
This project was generated with python-package-template