Skip to content

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. | uv 管理依赖,使用 PyYAML 从 yml 读取配置,自定义 logging 生成日志,使用 APScheduler 和 py7zr 定时压缩归档日志。

License

Notifications You must be signed in to change notification settings

duanluan/py-uv-config-log-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-uv-config-log-example

English | 简体中文

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.

Usage in PyCharm

  • In the Project view, right-click the src directory and select Mark Directory as -> Sources Root. This allows for direct imports of modules located under src.
  • If running as a module, set the 'Module name' to app1.app1 and the 'Working directory' to the project's root directory.

Command

# 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.app1

Packaging EXE

Initial Build:

  • -F Single-file executable, -D Single-directory executable
  • -n Specifies the name of the exe file
  • --add-data Adds resource files
  • -p Add 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.py

Build Using a .spec File:

  • --noconfirm No need to confirm whether to overwrite the last built file
pyinstaller app1.spec --noconfirm

Run the EXE:

app1.exe --config _internal\res\config.yml

About

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. | uv 管理依赖,使用 PyYAML 从 yml 读取配置,自定义 logging 生成日志,使用 APScheduler 和 py7zr 定时压缩归档日志。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages