Skip to content

Commit 49510d3

Browse files
committed
Fix CI and tooling
1 parent 014b96d commit 49510d3

7 files changed

Lines changed: 15 additions & 56 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Some additional Python packages are needed, most notabily `python-dotenv` which
9090
To install all dependencies, run the following command from the IDE terminal:
9191

9292
```bash
93-
pip install -r tools/requirements.txt
93+
pip install ./tools
9494
```
9595

9696
## 🏗️ Configuration

scripts/preBuild.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
Import("env") # type: ignore
66
sys.path.insert(0, env["PROJECT_DIR"]) # type: ignore
7+
env.Execute(f"cd tools && pip install --quiet .") # type: ignore
78

89
from tools.src.Firmware import Firmware
910
from tools.src.Tools import Tools
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
name = "frekvens"
33
description = "Toolbox for the Frekvens ESP32 project."
44
version = "1.0.0"
5-
license = { file = "../LICENSE" }
6-
readme = "../README.md"
5+
license = "MIT"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
'argparse >= 1.4.0, < 2',
9+
'python-dotenv >= 1.1.0, < 2',
10+
'requests >= 2.32.4, < 3',
11+
'requests-toolbelt >= 1.0.0, < 2',
12+
'tqdm >= 4.67.1, < 5',
13+
]
714

815
[project.urls]
916
"Homepage" = "https://github.com/VIPnytt/Frekvens"

tools/requirements.txt

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

tools/src/Firmware.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@
77

88
from tools.src.config import Frekvens
99
from tools.src.config import Obegransad
10-
from tools.src.Tools import Tools
1110

1211

1312
class Firmware:
1413
def __init__(self, env):
1514
self.env = env
16-
tools = Tools(env) # type: ignore
17-
tools.check()
1815

1916
def define(self):
2017
env_pio = dotenv.dotenv_values(".env")

tools/src/Tools.py

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,12 @@
11
import dotenv
2-
import importlib.metadata
32
import json
43
import re
5-
import subprocess
6-
import sys
4+
75

86

97
class Tools:
108
def __init__(self, env):
119
self.env = env
12-
self.check()
13-
14-
def check(self):
15-
requirements_txt_path = "tools/requirements.txt"
16-
17-
with open(requirements_txt_path) as txt:
18-
19-
for requirement in txt:
20-
21-
requirement = requirement.strip()
22-
if not requirement or requirement.startswith("#"):
23-
continue
24-
package = (
25-
requirement.split(";")[0]
26-
.split("==")[0]
27-
.split(">=")[0]
28-
.split("<=")[0]
29-
.split(">")[0]
30-
.split("<")[0]
31-
.strip()
32-
)
33-
if package:
34-
try:
35-
importlib.metadata.version(package)
36-
except importlib.metadata.PackageNotFoundError:
37-
subprocess.check_call(
38-
[
39-
sys.executable,
40-
"-m",
41-
"pip",
42-
"install",
43-
"--quiet",
44-
"-r",
45-
requirements_txt_path,
46-
]
47-
)
4810

4911
def environment(self):
5012
env_py_path = "tools/.env"
@@ -79,7 +41,8 @@ def environment(self):
7941
print(env_py_path)
8042

8143
def version(self):
82-
with open("library.json") as pio, open("tools/project.toml", "r+") as toml:
44+
config = "tools/pyproject.toml"
45+
with open("library.json") as pio, open(config, "r+") as toml:
8346
library = json.load(pio)
8447
if "version" in library:
8548
lines = toml.readlines()
@@ -91,5 +54,5 @@ def version(self):
9154
lines[i] = f'version = "{library["version"]}"\n'
9255
toml.seek(0)
9356
toml.writelines(lines)
94-
print("tools/project.toml")
57+
print(config)
9558
break

tools/src/WebApp.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
import subprocess
88
import sys
99

10-
from tools.src.Tools import Tools
11-
1210

1311
class WebApp:
1412
def __init__(self, env):
1513
self.env = env
1614
self.check()
17-
tools = Tools(env) # type: ignore
18-
tools.check()
1915

2016
def build(self):
2117
with open("library.json") as pio, open("webapp/package.json") as npm, open(

0 commit comments

Comments
 (0)