Skip to content

Commit

Permalink
Upgraded to Python 3.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Feb 17, 2024
1 parent c93ffcf commit 162818d
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The codes are never designed for average high school students to understand. You

### Python

Note that LEADS requires **Python >= 3.11**.
Note that LEADS requires **Python >= 3.12**.

```shell
pip install customtkinter keyboard pyserial leads
Expand Down Expand Up @@ -155,7 +155,8 @@ This section helps you set up the exact environment we have for the VeC project.

You can simply run "[setup.sh](scripts/setup.sh)" and it will install everything for you. If anything goes wrong, you can also manually install everything.

If you install Python using the scripts, you will not find `python ...`, `python3 ...`, `pip ...`, or `pip3 ...` working because you have to specify the Python version such that `python3.11 ...` and `python3.11 -m pip ...`.
If you install Python using the scripts, you will not find `python ...`, `python3 ...`, `pip ...`, or `pip3 ...` working
because you have to specify the Python version such that `python3.12 ...` and `python3.12 -m pip ...`.

## Configurations

Expand Down
2 changes: 1 addition & 1 deletion docs/Beginner Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Programmers

Required Environment: [Python](https://python.org) >= 3.11
Required Environment: [Python](https://python.org) >= 3.12

Recommended Package Management: [Anaconda](https://www.anaconda.com/)

Expand Down
2 changes: 1 addition & 1 deletion leads/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def mark(msg: str, level: Level) -> str:

@staticmethod
def format(msg: str, font: int, color: int | None, background: int | None) -> str:
return f"\033[{font}{f';{color}' if color else ''}{f';{background + 10}' if background else ''}m{msg}\033[0m"
return f"\033[{font}{f";{color}" if color else ""}{f";{background + 10}" if background else ""}m{msg}\033[0m"

def print(self, msg: str, level: int) -> None:
if self._debug_level <= level:
Expand Down
2 changes: 1 addition & 1 deletion leads_vec/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
get_config as _get_config
from leads_gui import get_system_platform as _get_system_platform, Config as _Config

if __name__ == '__main__':
if __name__ == "__main__":
parser = _ArgumentParser(prog="LEADS VeC",
description="Lightweight Embedded Assisted Driving System VeC",
epilog="ProjectNeura: https://projectneura.org"
Expand Down
2 changes: 1 addition & 1 deletion leads_vec/_bootloader/leads_vec.service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ then
echo "Error: Config file does not exist"
exit 1
fi
python3.11 -m leads_vec -c /usr/local/leads/config.json run
python3.12 -m leads_vec -c /usr/local/leads/config.json run
6 changes: 3 additions & 3 deletions leads_vec/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def on_update(self, e: UpdateEvent) -> None:
m1.set("LAP TIME\n\n" + "\n".join(map(format_lap_time, ctx.get_lap_time_list())))
else:
m1.set(f"VeC {__version__.upper()}\n\n"
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
f"{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}\n"
f"{(duration := int(time()) - uim.rd().start_time) // 60} MIN {duration % 60} SEC\n\n"
f"{'SRW MODE' if cfg.srw_mode else 'DRW MODE'}\n"
f"{"SRW MODE" if cfg.srw_mode else "DRW MODE"}\n"
f"REFRESH RATE: {cfg.refresh_rate} FPS")
m2.set(int(d.speed))
if uim.rd().m3_mode == 0:
Expand All @@ -103,7 +103,7 @@ def on_update(self, e: UpdateEvent) -> None:
m3.set("G Force")
else:
m3.set(f"Speed Trend\n"
f"{(sts := str(st := ctx.get_speed_trend() * 10))[:sts.find('.') + 2]} {'↑' if st > 0 else '↓'}")
f"{(sts := str(st := ctx.get_speed_trend() * 10))[:sts.find(".") + 2]} {"↑" if st > 0 else "↓"}")
if uim.rd().comm.num_connections() < 1:
uim["comm_status"].configure(text="COMM OFFLINE", text_color="gray")
if uim.rd().control_system_switch_changed:
Expand Down
2 changes: 1 addition & 1 deletion leads_vec_rc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from leads import L as _L
from leads_gui import get_system_platform as _get_system_platform

if __name__ == '__main__':
if __name__ == "__main__":
parser = _ArgumentParser(prog="LEADS VeC RC",
description="Lightweight Embedded Assisted Driving System VeC Remote Controller",
epilog="GitHub: https://github.com/ProjectNeura/LEADS")
Expand Down
2 changes: 1 addition & 1 deletion leads_vec_rc/_bootloader/leads_vec_rc.service.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python3.11 -m leads_vec_rc
python3.12 -m leads_vec_rc
2 changes: 1 addition & 1 deletion scripts/python-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ then
fi
sudo su
apt update
apt install python3.11
apt install python3.12
apt install python3-tk
apt install python3-rpi.gpi
4 changes: 2 additions & 2 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ then
fi
sudo su
./python-install.sh
python3.11 -m pip install customtkinter keyboard pyserial leads
python3.11 -m leads_vec info
python3.12 -m pip install customtkinter keyboard pyserial leads
python3.12 -m leads_vec info
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
author="ProjectNeura",
author_email="[email protected]",
description="Lightweight Embedded Assisted Driving System",
license='Apache License 2.0',
license="Apache License 2.0",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
url="https://github.com/ProjectNeura/LEADS",
Expand Down

0 comments on commit 162818d

Please sign in to comment.