Skip to content

Commit 36800ac

Browse files
committed
Feat: update GitHub Actions workflows to use Hatch for versioning and dependency management
1 parent e3578a5 commit 36800ac

File tree

7 files changed

+232
-48
lines changed

7 files changed

+232
-48
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
os: [windows-latest, macos-latest]
1313
runs-on: ${{ matrix.os }}
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616

1717
# Nastavíme Python (bez toho by příkaz "python setup.py --version" nemusel fungovat)
1818
- name: Set up Python
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v4
2020
with:
2121
python-version: '3.x'
2222

@@ -89,5 +89,5 @@ jobs:
8989
with:
9090
upload_url: ${{ steps.create_release.outputs.upload_url }}
9191
asset_path: ./ForrestHub-macOS/ForrestHub
92-
asset_name: ForrestHub-macOS
92+
asset_name: ForrestHub-${{ env.VERSION }}-macOS
9393
asset_content_type: application/octet-stream

.github/workflows/test-build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
permissions: write-all
1616
runs-on: windows-latest
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919

2020
- name: Set up Python
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
2222
with:
2323
python-version: '3.x'
2424

@@ -60,15 +60,15 @@ jobs:
6060
permissions: write-all
6161
runs-on: macos-latest
6262
steps:
63-
- uses: actions/checkout@v2
63+
- uses: actions/checkout@v4
6464

6565
- name: Set up Python
66-
uses: actions/setup-python@v2
66+
uses: actions/setup-python@v4
6767
with:
6868
python-version: '3.x'
6969

70-
# Install setuptools
71-
- name: Install setuptools
70+
# Install Hatch
71+
- name: Install Hatch
7272
run: |
7373
python -m pip install --upgrade pip
7474
pip install setuptools
@@ -83,7 +83,7 @@ jobs:
8383
echo "DATESTR=$DATESTR" >> $GITHUB_ENV
8484
shell: bash
8585

86-
- name: Install dependencies
86+
- name: Install dependencies and build
8787
run: |
8888
python -m pip install --upgrade pip
8989
cd ForrestHub-app

.github/workflows/web.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- master
66
- main
7+
- feat/add-cron
78
permissions:
89
contents: write
910
jobs:

ForrestHub-app/MANIFEST.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include VERSION
2+
include requirements.txt
3+
include *.conf.py
4+
include *.spec
5+
include *.cfg
6+
include *.ini
7+
include *.json
8+
include *.pem
9+
include *.key
10+
include *.crt
11+
recursive-include assets *
12+
recursive-include templates *
13+
recursive-include pages *
14+
recursive-include games *
15+
recursive-include docs *
16+
global-exclude *.pyc
17+
global-exclude __pycache__
18+
global-exclude .git*
19+
global-exclude .DS_Store
20+
global-exclude *.log
21+
global-exclude .venv
22+
global-exclude build
23+
global-exclude dist
24+
global-exclude *.egg-info

ForrestHub-app/pyproject.toml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "ForrestHub App"
7+
dynamic = ["version"]
8+
license = ""
9+
dependencies = [
10+
"flask>=3.1.0",
11+
"flask-socketio>=5.5.0",
12+
"gevent-websocket>=0.10.1",
13+
"requests>=2.32.0",
14+
"websocket-client>=1.8.0",
15+
"flask-cors>=6.0.0",
16+
"pyinstaller>=6.15.0",
17+
"pyopenssl>=25.1.0",
18+
"nanoid>=2.0.0",
19+
"eventlet>=0.40.0",
20+
"gunicorn>=23.0.0",
21+
"python-dotenv>=1.1.0",
22+
"click>=8.2.0",
23+
"dotenv>=0.9.9",
24+
"Js2Py @ git+https://github.com/a-j-albert/Js2Py---supports-python-3.13.git",
25+
]
26+
27+
[project.entry-points.forrestHub]
28+
forrestHub = "run:app.run"
29+
30+
[tool.hatch.version]
31+
path = "app/__init__.py"
32+
33+
[tool.hatch.build.targets.sdist]
34+
include = [
35+
"/app",
36+
]
37+
38+
[project.urls]
39+
Homepage = "https://forresthub.helceletka.cz"
40+
Repository = "https://github.com/Helceletka/ForrestHub"
41+
Documentation = "https://forresthub.helceletka.cz/docs"
42+
"Bug Reports" = "https://github.com/Helceletka/ForrestHub/issues"
43+
Changelog = "https://github.com/Helceletka/ForrestHub/blob/main/CHANGELOG.md"
44+
45+
[project.scripts]
46+
forresthub = "run:main"
47+
48+
[tool.hatch.metadata]
49+
allow-direct-references = true
50+
51+
[tool.hatch.build.targets.wheel]
52+
packages = ["app", "assets", "games", "pages", "templates"]
53+
54+
[tool.hatch.build.targets.wheel.force-include]
55+
"VERSION" = "VERSION"
56+
"requirements.txt" = "requirements.txt"
57+
"gunicorn.conf.py" = "gunicorn.conf.py"
58+
"gunicorn-https.conf.py" = "gunicorn-https.conf.py"
59+
60+
[tool.hatch.envs.default]
61+
dependencies = [
62+
"pytest>=7.0.0",
63+
"pytest-cov>=4.0.0",
64+
"black>=23.0.0",
65+
"isort>=5.12.0",
66+
"flake8>=6.0.0",
67+
"mypy>=1.0.0",
68+
"pre-commit>=3.0.0",
69+
]
70+
71+
[tool.hatch.envs.default.scripts]
72+
test = "pytest {args:tests}"
73+
test-cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=app {args:tests}"
74+
lint = [
75+
"black --check --diff .",
76+
"isort --check-only --diff .",
77+
"flake8 .",
78+
]
79+
format = [
80+
"black .",
81+
"isort .",
82+
]
83+
type-check = "mypy app"
84+
85+
[tool.hatch.envs.docs]
86+
dependencies = [
87+
"mkdocs>=1.4.0",
88+
"mkdocs-material>=9.0.0",
89+
]
90+
91+
[tool.hatch.envs.docs.scripts]
92+
build = "mkdocs build"
93+
serve = "mkdocs serve"
94+
95+
[tool.black]
96+
line-length = 88
97+
target-version = ['py38', 'py39', 'py310', 'py311', 'py312', 'py313']
98+
include = '\.pyi?$'
99+
extend-exclude = '''
100+
/(
101+
# directories
102+
\.eggs
103+
| \.git
104+
| \.hg
105+
| \.mypy_cache
106+
| \.tox
107+
| \.venv
108+
| build
109+
| dist
110+
)/
111+
'''
112+
113+
[tool.isort]
114+
profile = "black"
115+
multi_line_output = 3
116+
line_length = 88
117+
known_first_party = ["app"]
118+
skip = ["__init__.py"]
119+
120+
[tool.flake8]
121+
max-line-length = 88
122+
extend-ignore = ["E203", "W503"]
123+
exclude = [
124+
".git",
125+
"__pycache__",
126+
"build",
127+
"dist",
128+
"*.egg-info",
129+
".venv",
130+
".tox",
131+
]
132+
133+
[tool.mypy]
134+
python_version = "3.8"
135+
warn_return_any = true
136+
warn_unused_configs = true
137+
disallow_untyped_defs = true
138+
disallow_incomplete_defs = true
139+
check_untyped_defs = true
140+
disallow_untyped_decorators = true
141+
no_implicit_optional = true
142+
warn_redundant_casts = true
143+
warn_unused_ignores = true
144+
warn_no_return = true
145+
warn_unreachable = true
146+
strict_equality = true
147+
show_error_codes = true
148+
149+
[[tool.mypy.overrides]]
150+
module = [
151+
"gevent.*",
152+
"eventlet.*",
153+
"flask_socketio.*",
154+
"pyinstaller.*",
155+
]
156+
ignore_missing_imports = true
157+
158+
[tool.pytest.ini_options]
159+
minversion = "7.0"
160+
addopts = "-ra -q"
161+
testpaths = [
162+
"tests",
163+
]
164+
python_files = "test_*.py"
165+
python_classes = "Test*"
166+
python_functions = "test_*"
167+
168+
[tool.coverage.run]
169+
source = ["app"]
170+
omit = [
171+
"*/tests/*",
172+
"*/venv/*",
173+
"*/__pycache__/*",
174+
]
175+
176+
[tool.coverage.report]
177+
exclude_lines = [
178+
"pragma: no cover",
179+
"def __repr__",
180+
"raise AssertionError",
181+
"raise NotImplementedError",
182+
]

ForrestHub-app/requirements.txt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
flask~=3.1.2
2-
flask-socketio~=5.5.1
3-
gevent-websocket~=0.10.1
4-
requests~=2.32.5
5-
websocket-client~=1.8.0
6-
flask-cors~=6.0.1
7-
pyinstaller~=6.15.0
8-
pyopenssl~=25.1.0
9-
pyinstaller~=6.15.0
10-
nanoid~=2.0.0
11-
eventlet~=0.40.3
12-
gunicorn~=23.0.0
13-
python-dotenv~=1.1.1
14-
click~=8.2.1
15-
dotenv~=0.9.9
16-
git+https://github.com/a-j-albert/Js2Py---supports-python-3.13.git
1+
flask>=3.1.0
2+
flask-socketio>=5.5.0
3+
gevent-websocket>=0.10.1
4+
requests>=2.32.0
5+
websocket-client>=1.8.0
6+
flask-cors>=6.0.0
7+
pyinstaller>=6.15.0
8+
pyopenssl>=25.1.0
9+
nanoid>=2.0.0
10+
eventlet>=0.40.0
11+
gunicorn>=23.0.0
12+
python-dotenv>=1.1.0
13+
click>=8.2.0
14+
dotenv>=0.9.9
15+
Js2Py @ git+https://github.com/a-j-albert/Js2Py---supports-python-3.13.git

ForrestHub-app/setup.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)