The audio_archive_bot project has been successfully restructured with modern Python packaging following PEP 621 standards while maintaining full backward compatibility with existing code.
-
audio_archive_bot/__init__.py- Package initialization file
- Exports version and main components
- Provides backward compatibility fallbacks
-
audio_archive_bot/__main__.py- Entry point for
python -m audio_archive_bot - Delegates to the CLI module
- Entry point for
-
audio_archive_bot/cli.py- Main CLI entry point
- Handles environment validation
- Imports and runs the existing hybrid_bot.py code
- Provides user-friendly error messages
-
audio_archive_bot/hybrid_bot.py(copied)- Main bot implementation
- Discord event handlers
- Bot configuration and setup
-
audio_archive_bot/voice_manager_hybrid.py(copied)- Hybrid voice manager
- IPC interface to Node.js
- Recording management
-
pyproject.toml- Modern packaging configuration (PEP 621)
- Project metadata and dependencies
- Development tool configurations (black, isort, pytest, etc.)
- Console scripts entry point
- Comprehensive classifiers and keywords
-
MANIFEST.in- Specifies non-Python files to include in distribution
- Includes .js files, shell scripts, documentation
- Includes Node.js configuration (package.json)
- Excludes build artifacts and logs
-
setup.py- Legacy compatibility file
- Delegates to pyproject.toml
- Ensures compatibility with older pip versions
-
PACKAGING_GUIDE.md- Comprehensive packaging documentation
- Installation instructions
- Development workflow
- Building and publishing guide
- Troubleshooting section
-
PACKAGE_SUMMARY.md(this file)- Quick reference summary
- Package structure overview
- Installation and usage instructions
-
install_package.sh- Interactive installation script
- Checks Python version
- Offers development/production installation options
audio_archive_bot/
βββ audio_archive_bot/ # Main Python package
β βββ __init__.py # Package exports (version, HybridVoiceManager)
β βββ __main__.py # python -m audio_archive_bot entry point
β βββ cli.py # CLI entry point (audio_bot_run command)
β βββ hybrid_bot.py # Main bot implementation
β βββ voice_manager_hybrid.py # Voice management IPC
β
βββ pyproject.toml # Modern packaging (PEP 621)
βββ MANIFEST.in # Distribution file inclusion rules
βββ setup.py # Legacy compatibility
βββ requirements.txt # Original dependencies (kept for reference)
β
βββ PACKAGING_GUIDE.md # Complete packaging documentation
βββ PACKAGE_SUMMARY.md # This summary file
βββ install_package.sh # Interactive installer
β
βββ [Original files] # All original files preserved
β βββ hybrid_bot.py # Original bot (still works)
β βββ voice_manager_hybrid.py # Original voice manager
β βββ voice_recorder.js # Node.js voice recorder
β βββ package.json # Node.js dependencies
β βββ run_hybrid.sh # Original run script
β βββ ... # Other original files
β
βββ [Documentation] # All existing documentation
βββ README.md
βββ CONTRIBUTING.md
βββ CHANGELOG.md
βββ ...
# Interactive installation
./install_package.sh
# Or manual development installation
pip3 install -e .
# With development tools
pip3 install -e ".[dev]"# Check package is installed
pip3 show audio-archive-bot
# Check version
python3 -c "import audio_archive_bot; print(audio_archive_bot.__version__)"
# Verify command is available
which audio_bot_runaudio_bot_runThis is the modern, packaged way to run the bot.
python3 -m audio_archive_bot# Original methods still work
python3 hybrid_bot.py
./run_hybrid.sh
./run_bot_forever.sh- Build System: setuptools >= 45
- Version: 0.1.0
- Python Requirement: >= 3.8
- License: MIT
- Name: audio-archive-bot
- Description: Hybrid Python/Node.js Discord bot for voice recording
- Keywords: discord, bot, audio, recording, voice, mp3, archive
- Classifiers: Beta, End Users/Desktop, MIT License, Python 3.8+
Production:
- discord.py[voice] >= 2.6.3
- python-dotenv >= 1.0.0
- pydub >= 0.25.1
- psutil >= 5.9.0
Development (optional):
- black >= 24.10.0 (code formatting)
- isort >= 5.13.2 (import sorting)
- flake8 >= 7.1.1 (linting)
- bandit >= 1.7.10 (security)
- pytest >= 8.0.0 (testing)
- pre-commit >= 4.0.0 (git hooks)
The package provides the following command-line tools:
audio_bot_run: Main entry point to start the bot
Integrated configurations for:
- Black: Code formatting (line length 100)
- isort: Import sorting (Black-compatible)
- Bandit: Security linting
- pytest: Testing framework
- Coverage: Code coverage reporting
# Clone and install
git clone <repository-url>
cd audio_archive_bot
pip3 install -e ".[dev]"
npm install# Format code
black audio_archive_bot/
# Sort imports
isort audio_archive_bot/
# Lint
flake8 audio_archive_bot/
# Security check
bandit -r audio_archive_bot/# Run tests (when available)
pytest
# With coverage
pytest --cov=audio_archive_bot --cov-report=html# Install hooks
pre-commit install
# Run manually
pre-commit run --all-files# Install build tool
pip3 install build
# Build both sdist and wheel
python3 -m buildThis creates:
dist/audio-archive-bot-0.1.0.tar.gz(source distribution)dist/audio_archive_bot-0.1.0-py3-none-any.whl(wheel)
# Install twine
pip3 install twine
# Test PyPI (recommended first)
twine upload --repository testpypi dist/*
# Production PyPI
twine upload dist/*All original functionality is preserved:
- Original files remain in place - No files were moved or deleted from the root
- Original scripts still work - run_hybrid.sh, run_bot_forever.sh, etc.
- Original import paths work - Can still import from root-level modules
- Configuration unchanged - .env file format is identical
Before:
git clone <repo>
cd audio_archive_bot
pip3 install -r requirements.txt
python3 hybrid_bot.pyAfter (recommended):
git clone <repo>
cd audio_archive_bot
pip3 install -e .
audio_bot_runOr (still supported):
# Old method still works!
python3 hybrid_bot.pyBefore:
pip3 install -r requirements.txt
python3 hybrid_bot.pyAfter:
pip3 install -e ".[dev]"
black audio_archive_bot/
pytest
audio_bot_runBefore running, configure your environment:
# Copy template
cp .env.example .env
# Edit with your credentials
nano .envRequired variables:
DISCORD_TOKEN- Your Discord bot tokenTARGET_USER_ID- User ID to monitor
Optional variables:
EMAIL_USER- Gmail address for email deliveryEMAIL_PASS- Gmail app passwordEMAIL_RECIPIENT- Where to send recordings
The package includes Node.js integration for voice recording:
# Install Node.js dependencies
npm install
# Run Node.js component (separate terminal)
node voice_recorder.js
# Or use the integrated script
./run_hybrid.shpip3 uninstall audio-archive-bot-
Configure Environment
- Copy .env.example to .env
- Add your Discord credentials
-
Install Dependencies
- Run
./install_package.shorpip3 install -e . - Run
npm installfor Node.js
- Run
-
Start the Bot
- Run
audio_bot_runor./run_hybrid.sh
- Run
-
Development (optional)
- Install dev dependencies:
pip3 install -e ".[dev]" - Set up pre-commit:
pre-commit install - Read CONTRIBUTING.md
- Install dev dependencies:
- README.md - User guide and bot functionality
- PACKAGING_GUIDE.md - Detailed packaging documentation
- CONTRIBUTING.md - Development guidelines
- CHANGELOG.md - Version history
- SECURITY.md - Security policy and reporting
For issues or questions:
- Check the documentation files
- Review existing GitHub issues
- Open a new issue with details
Current Version: 0.1.0
This is the initial packaged release. Future versions will follow semantic versioning (MAJOR.MINOR.PATCH).
Last Updated: 2025-10-17 Status: Production Ready Compatibility: Python 3.8+, Node.js 18+