Utilities for directory readme generation, file management, renaming, and docx to pdf conversion.
Project description
hsutools
Utilities for generating folder README trees, categorizing files, batch renaming, converting docx to pdf, and Simplified to Traditional Chinese conversion. The project now uses a standard src/hsutools package layout, Typer for the CLI, and Poetry for dependency management.
Install
With Poetry (local dev)
pip install poetry
poetry install
poetry run hsu --help
Install with optional features
# Install with Simplified-to-Traditional Chinese conversion support
poetry install --extras s2tw
From PyPI (after release)
pip install hsutools
hsu --help
# With optional features
pip install hsutools[s2tw]
With pipx from the repo
pipx install .
hsu --help
CLI usage
hsu cpath --path <dir> [--max-depth 3] [--ignore name ...]hsu filem --path <dir> --mode {date|prefix|suffix} [--prefix PREFIX]hsu rename --path <dir> --find old --replace new [--include-dirs]hsu topdf --path <dir> [--ignore name ...]hsu resize --path <dir> [--width 1920] [--height ...] [--format webp] [--recursive]hsu s2tw --path <dir|file> [--backup-dir ./backup] [--no-backup] [--no-convert-names]hsu --lang zh --help切換繁體說明;亦可用環境變數HSU_LANG=zh做預設hsu build-exe [--extra-arg "--onefile"](requirespyinstallerin the Poetry dev group)
Simplified to Traditional Chinese (s2tw)
Convert Simplified Chinese to Traditional Chinese (Taiwan) in files:
- Automatic backup of original files
- Content conversion using OpenCC
- File/directory name conversion
- Recursive directory processing
# Convert all supported text files in a directory (with backup)
hsu s2tw --path ./docs
# Convert without backup
hsu s2tw --path ./docs --no-backup
# Custom backup directory
hsu s2tw --path ./docs --backup-dir ./backup
Requirements:
pip install opencc-python-reimplemented
# OR install with extras
poetry install --extras s2tw
Development
- Run tests:
poetry run pytest - Build artifacts:
poetry build - Optional exe:
poetry run hsu build-exe - Release: tag
v*.*.*and GitHub Actions will build wheel/sdist, publish to PyPI (requiresPYPI_API_TOKENsecret), and attach artifacts (wheel/sdist + Windows exe) to the GitHub Release.
Project structure
hsutools/
├── pyproject.toml
├── src/hsutools/
│ ├── cli.py
│ ├── config.py
│ ├── utils.py
│ ├── i18n.py
│ └── core/
│ ├── create_path.py
│ ├── docx_to_pdf.py
│ ├── file_manage.py
│ ├── file_renamer.py
│ ├── image_resize.py
│ └── s2tw.py
└── tests/
└── test_cli.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hsutools-1.2.1.tar.gz.
File metadata
- Download URL: hsutools-1.2.1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c3f76cacadbe2ba3a1d36a50a9acd25592d743a029017151d20b08407fd04fd
|
|
| MD5 |
74fcc5f140c6106073b7cd5374b75f85
|
|
| BLAKE2b-256 |
860bdee84e2a6f094e2c84b6f1f916cee83e4a1a0afb6968cee95e725e60be4d
|
File details
Details for the file hsutools-1.2.1-py3-none-any.whl.
File metadata
- Download URL: hsutools-1.2.1-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2e150c7c626ca9f3f59405268f136b356d44f744c7b470749777b314c37e56f
|
|
| MD5 |
a62fb4c6f6494556b0e07464c621fb15
|
|
| BLAKE2b-256 |
d49335188c45f4c01bea4e8399514de169b9118340150dbfa885f79a7cb024a5
|