Skip to content

Commit

Permalink
First version of omotes_sdk_protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
lfse-slafleur committed Jan 26, 2024
0 parents commit d47d359
Show file tree
Hide file tree
Showing 22 changed files with 732 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build-Test-Lint-etc (linux)

on: [push]

jobs:
build:
name: Build the python package
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.11" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- run: |
./python/ci/linux/create_venv.sh
./python/ci/linux/install_dependencies.sh
- name: build
run: |
./python/ci/linux/build_python_package.sh
36 changes: 36 additions & 0 deletions .github/workflows/python_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PyPi release
run-name: Releasing next version 🚀
on:
push:
tags:
- '*'

jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11" ]
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- run: |
./python/ci/linux/create_venv.sh
./python/ci/linux/install_dependencies.sh
- name: build
run: |
./python/ci/linux/build_python_package.sh
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
224 changes: 224 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
doc/*/_build/
doc/*/_static/
doc/*/_templates/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

### PyCharm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### PyCharm+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

!.idea/codeStyles
!.idea/runConfigurations

unit_test_coverage/
test-results.xml

.env.*
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# OMOTES orchestrator

This repository is part of the 'Nieuwe Warmte Nu Design Toolkit' project.

Orchestrator component of OMOTES project which monitors workflows and starts the various steps of each workflow.


# Developers Guide
Please install `protoc` on your machine and make sure it is available in your `PATH`.

The protobuf definition is under `src/` and any language specific generated code resides under the language
folder. For instance, the Python implementation resides under `python/`. The same holds for any packaging
and build tools, they reside under the language folder as well. The tools for generating the language-specific
code us under root `/`.

To generate new language-specific implementations of the protocol:
- Alter the protobuf defintions under `src/`.
- Run `ci/linux/create_venv.sh` and `ci/linux/install_dependencies.sh` to create a Python environment in
which `protoc` plugins are installed.
- Run `ci/linux/gen_protocol.sh` to generate the language-specific implementations.

# Python-specific implementation Developers Guide
A number of tools are available to create the Python package:
- `./python/ci/linux/create_venv.sh`: Creates a virtualenvironment specific to the Python implementation of the
generated protobuf messages under `./python/.venv/`.
- `./python/ci/linux/install_dependencies.sh`: Installs the build and package dependencies in `./python/.venv/`.
- `./python/ci/linux/update_dependencies.sh`: Updates the build and package dependencies.
- `./python/ci/linux/build_python_package.sh`: Generates the python package containing the python generated protobuf
messages.
5 changes: 5 additions & 0 deletions ci/linux/create_venv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh

python3.11 -m venv ./.venv
. .venv/bin/activate
pip3 install pip-tools
8 changes: 8 additions & 0 deletions ci/linux/gen_protocol.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

. .venv/bin/activate
rm -Rf python/src/omotes_sdk_protocol/
mkdir -p python/src/omotes_sdk_protocol/
protoc -I src/ --python_out python/src/omotes_sdk_protocol/ ./src/job.proto
protoc -I src/ --mypy_out python/src/omotes_sdk_protocol/ ./src/job.proto
touch python/src/omotes_sdk_protocol/__init__.py
4 changes: 4 additions & 0 deletions ci/linux/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

. .venv/bin/activate
pip-sync ./dev-requirements.txt ./requirements.txt
5 changes: 5 additions & 0 deletions ci/linux/update_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh

. .venv/bin/activate
pip-compile --output-file=requirements.txt pyproject.toml
pip-compile --extra=dev -c requirements.txt --output-file=dev-requirements.txt pyproject.toml
25 changes: 25 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --constraint=requirements.txt --extra=dev --output-file=dev-requirements.txt pyproject.toml
#
build==1.0.3
# via orchestrator (pyproject.toml)
mypy-protobuf==3.5.0
# via orchestrator (pyproject.toml)
packaging==23.2
# via
# build
# setuptools-git-versioning
protobuf==4.25.2
# via mypy-protobuf
pyproject-hooks==1.0.0
# via build
setuptools-git-versioning==1.13.5
# via orchestrator (pyproject.toml)
types-protobuf==4.24.0.20240106
# via mypy-protobuf

# The following packages are considered to be unsafe in a requirements file:
# setuptools
Loading

0 comments on commit d47d359

Please sign in to comment.