Skip to content

Commit bbfd97e

Browse files
committed
Add implementation of web server with HTTP and WebSocket support
1 parent 52722d4 commit bbfd97e

11 files changed

Lines changed: 978 additions & 0 deletions

File tree

.github/workflows/OnPush.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: On Push
2+
#for every push on any branch
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
permissions:
9+
contents: write
10+
packages: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.12", "3.13"]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Fetch all history for all tags
24+
25+
- name: setup Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "${{ matrix.python-version }}"
29+
30+
- name: install python dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install build pytest
34+
pip install https://github.com/AntoineBuirey/builder/releases/download/1.0.1/builder-1.0.1-py3-none-any.whl
35+
36+
- name: build
37+
run: builder -v -D build-package
38+
39+
- name: Upload package artifacts
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: package-artifacts-${{ matrix.python-version }}
43+
path: |
44+
dist/*.tar.gz
45+
dist/*.whl
46+

.github/workflows/OnRelease.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: On Release
2+
#for every push on any branch
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
packages: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.12", "3.13"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Fetch all history for all tags
23+
24+
- name: setup Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "${{ matrix.python-version }}"
28+
29+
- name: install python dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build pytest
33+
pip install https://github.com/AntoineBuirey/builder/releases/download/1.0.1/builder-1.0.1-py3-none-any.whl
34+
35+
- name: build
36+
run: builder -v -D version=${{ github.event.release.tag_name }} build-package
37+
38+
- name: Upload package artifacts
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: package-artifacts-${{ matrix.python-version }}-${{ github.event.release.tag_name }}
42+
path: |
43+
dist/*.tar.gz
44+
dist/*.whl
45+
46+
- name: Publish release assets
47+
uses: AButler/upload-release-assets@v3.0
48+
with:
49+
files: "dist/*"
50+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
vars:
2+
build_tools: $(realpath ${PROJECT_DIR}/../build-tools)
3+
version: $(${PYTHON} ${build_tools}/get_version.py ${PROJECT_DIR})
4+
package_name: $(echo ${name} | tr '-' '_')
5+
build_dir: ${PROJECT_DIR}/${package_name}
6+
dist_dir: ${PROJECT_DIR}/dist
7+
8+
rules:
9+
build-package:
10+
tags:
11+
- build
12+
required-files:
13+
- ${PROJECT_DIR}/src/**/*.py
14+
expected-files:
15+
- ${PROJECT_DIR}/dist/${package_name}-${version}-py3-none-any.whl
16+
- ${PROJECT_DIR}/dist/${package_name}-${version}.tar.gz
17+
commands:
18+
- cp -r src ${build_dir}
19+
- ${PYTHON} ${build_tools}/create_metadata.py ${build_dir} -v ${version}
20+
- MSM_WEB_SERVER_VERSION=${version} ${PYTHON} -m build --wheel --sdist --outdir ${dist_dir} ${PROJECT_DIR}
21+
- rm -rf ${build_dir}

pyproject.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[project]
2+
name = "modular-server-manager-web-server"
3+
dynamic = ["version"]
4+
description = "MSM Web Server"
5+
authors = [
6+
{ name = "Antoine BUIREY", email = "antoine.buirey@gmail.com" }
7+
]
8+
requires-python = ">=3.12"
9+
dependencies = [
10+
"blinker==1.9.0",
11+
"click==8.1.8",
12+
"Flask==3.1.1",
13+
"gamuLogger>=3.2.4",
14+
"itsdangerous==2.2.0",
15+
"Jinja2==3.1.6",
16+
"MarkupSafe==3.0.2",
17+
"typing_extensions==4.13.2",
18+
"urllib3==2.5.0",
19+
"Werkzeug==3.1.3",
20+
"dnspython==2.7.0",
21+
"eventlet==0.40.3",
22+
"greenlet==3.2.1",
23+
"python-socketio==5.14.0",
24+
"http_code @ https://github.com/T0ine34/python-sample/releases/download/1.1.6/http_code-1.1.6-py3-none-any.whl",
25+
"singleton @ https://github.com/T0ine34/python-sample/releases/download/1.1.6/singleton-1.1.6-py3-none-any.whl",
26+
"version @ https://github.com/T0ine34/python-sample/releases/download/1.1.6/version-1.1.6-py3-none-any.whl",
27+
"modular-server-manager @ https://github.com/modular-server-manager/server/releases/download/0.1.4/modular_server_manager-0.1.4-py3-none-any.whl"
28+
]
29+
30+
[tool.metadata.require]
31+
modular-server-manager = ">=0.1.6,<1.0.0"
32+
33+
[build-system]
34+
requires = ["hatchling"]
35+
build-backend = "hatchling.build"
36+
37+
[tool.hatch.version]
38+
source = "env"
39+
variable = "MSM_WEB_SERVER_VERSION"
40+
41+
[tool.hatch.metadata]
42+
allow-direct-references = true

src/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .web_server import WebServer as Interface
2+
from .__metadata__ import __name__, __version__, __requires__

src/__metadata__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# this file will be replaced during packaging
2+
__name__ = "pkg_name"
3+
__version__ = "0.0.0"
4+
__requires__ = {}

0 commit comments

Comments
 (0)