Draft
Refactor CLI interface and make project uv-first#24
Conversation
- Add argparse-based CLI with URL, --output, --chapters, metadata overrides - Wrap __main__ block into main() function with args parameter - Fix bug: book_data accessed before None check - Fix platform-specific subprocess.run(["open", url]) for cross-platform - Add output_dir parameter to download_and_tag_audiobook - Fix project name in pyproject.toml - Add unit tests for CLI parsing, scraper selection, and utilities - Update README with CLI usage documentation Co-authored-by: aviiciii <88141521+aviiciii@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Clean up code base and enhance CLI interface
Add argparse CLI interface and clean up codebase
Mar 1, 2026
…requirements.txt - Remove transitive/unused deps (bs4, certifi, charset-normalizer, idna, lxml, soupsieve, tqdm, typing-extensions, urllib3, websockets) - Use >= version specs instead of == pins (uv.lock handles pinning) - Add [project.scripts] entry point: uv run audiobook-downloader - Add [build-system] with hatchling for installable package - Remove stale requirements.txt (referenced old "tokybook" project name) - Regenerate uv.lock - Update README: uv-first instructions, Python 3.11+ badge Co-authored-by: aviiciii <88141521+aviiciii@users.noreply.github.com>
Co-authored-by: aviiciii <88141521+aviiciii@users.noreply.github.com>
Copilot
AI
changed the title
Add argparse CLI interface and clean up codebase
Refactor CLI interface and make project uv-first
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codebase cleanup: add proper CLI interface via argparse, fix bugs, and make uv the primary package manager.
CLI interface
argparse-based CLI with positionalurl,-o/--output,-c/--chapters, and metadata override flags (--title,--author,--narrator,--year,--cover-url)uv-first packaging
pyproject.toml: Removed 10 transitive/unused deps (bs4,certifi,lxml,tqdm,websockets, etc.), switched from==pins to>=bounds (lockfile handles pinning), added[project.scripts]entry point and[build-system]with hatchlingrequirements.txt: was stale (still referenced old "tokybook" name);uv.lockis the source of truthuv.lockuv run audiobook-downloaderanduv run main.pyboth work.pip install .still works as fallback.Bug fixes
book_data["title"]was accessed before theNonecheck onbook_data— moved the check firstsubprocess.run(["open", url])was macOS-only — now dispatches viaplatform.system()for macOS/Windows/LinuxCode cleanup
__main__block intomain(args=None)— testable, importableoutput_dirparam todownload_and_tag_audiobook()(backward-compatible default)sanitize_book_title,parse_chapter_ranges💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.