Use uv to manage dependencies, read configuration from a YAML file using PyYAML, customize logging to generate logs, and use APScheduler and py7zr to periodically compress and archive logs.
- In the Project view, right-click the
srcdirectory and selectMark Directory as->Sources Root. This allows for direct imports of modules located undersrc. - If running as a module, set the 'Module name' to
app1.app1and the 'Working directory' to the project's root directory.
# Create a virtual environment in the current directory
uv venv
# --- Activate the virtual environment ---
# Windows
.venv\Scripts\activate.bat
# Linux / MacOS
source .venv/bin/activate
# --- Deactivate the virtual environment ---
# Windows
.venv\Scripts\deactivate.bat
# Linux / MacOS
deactivate
# Install the project in the current directory in editable mode
uv pip install -e .
# Execute the 'app1.app1' module as a script within the uv-managed environment
uv run python -m app1.app1Initial Build:
-FSingle-file executable,-DSingle-directory executable-nSpecifies the name of the exe file--add-dataAdds resource files-pAdd the specified path to the module search path (sys.path)
pyinstaller -n app1 -D --add-data "src/app1/res;res" -p src src/app1/app1.pyBuild Using a .spec File:
--noconfirmNo need to confirm whether to overwrite the last built file
pyinstaller app1.spec --noconfirmRun the EXE:
app1.exe --config _internal\res\config.yml