Soliloquy is a unified command-line tool for managing a Python monorepo that contains multiple standalone packages—each with its own pyproject.toml. It consolidates common tasks such as dependency management, version bumping, remote dependency resolution, test execution and analysis, and project configuration updates into one robust CLI.
- Version Management: Automatically bump or set versions (major, minor, patch, or finalize) across projects.
- Dependency Management: Lock and install dependencies from single or multiple
pyproject.tomlfiles. - Validation: Build, test, and analyze code with configurable test modes and parallel execution support.
- Release Workflow: Validate, update remote dependencies, and publish to PyPI with a single command.
- Recursive Discovery: Automatically scan directories (and subdirectories) to find
pyproject.tomlfiles.
Install Soliloquy directly from PyPI:
pip install soliloquyAlternatively, install from source:
git clone https://github.com/swarmauri/soliloquy.git
cd soliloquy
pip install .After installation, you can run Soliloquy from the command line:
soliloquy --helpThis command displays the available commands and options.
Soliloquy includes several commands for different stages of your workflow:
Bump or set version numbers, lint your code, and commit changes.
Options:
-f,--file: Specify a singlepyproject.tomlfile.-d,--directory: Specify a directory containing one or morepyproject.tomlfiles.-R,--recursive: Recursively findpyproject.tomlfiles.--bump: Select the type of version bump (major,minor,patch, orfinalize).--set-ver: Explicitly set a version (e.g.,2.0.0.dev1).--commit-msg: Set the Git commit message (default:"chore: prepare changes").
Example:
soliloquy prepare --bump patch -d ./packagesLock dependencies and install packages across your projects.
Options:
-f,--file: Specify a singlepyproject.tomlfile.-d,--directory: Specify a directory with multiple projects or an aggregator.-R,--recursive: Recursively findpyproject.tomlfiles.
Example:
soliloquy install -d ./projects --recursiveBuild, test, and analyze your code.
Options:
-f,--file: Specify a singlepyproject.tomlfile.-d,--directory: Specify a directory with multiple projects.-R,--recursive: Recursively findpyproject.tomlfiles.--test-mode: Choose the test mode (single,monorepo, oreach; default:single).--num-workers: Number of parallel pytest workers (default:1).--results-json: Path to a JSON file with test results for analysis.--required-passed: Set a requirement for passed tests (e.g.,ge:80).--required-skipped: Set a requirement for skipped tests (e.g.,lt:10).--no-cleanup: Prevent cleanup of temporary test directories for Git-based dependencies.
Example:
soliloquy validate -d ./src --test-mode monorepo --num-workers 4Validate, update remote dependencies, and publish your package to PyPI.
Options:
-f,--file: Specify a singlepyproject.tomlfile.-d,--directory: Specify a directory with multiple projects.-R,--recursive: Recursively findpyproject.tomlfiles.--test-mode: Choose the test mode (default:single).--num-workers: Number of parallel pytest workers (default:1).--results-json: Path to a JSON file with test results.--required-passed: Set a requirement for passed tests.--required-skipped: Set a requirement for skipped tests.--publish-password: Provide your PyPI password for publishing.--no-cleanup: Prevent cleanup of temporary test directories.
Example:
soliloquy release -d ./myproject --publish-password YOUR_PYPI_PASSWORDSoliloquy leverages the configuration defined in your pyproject.toml files. To get the most out of Soliloquy, ensure that each project within your monorepo is correctly configured. For more details on configuration options and best practices, please refer to the official documentation.
Here are some practical use cases:
-
Prepare a release by bumping the patch version:
soliloquy prepare --bump patch -d ./packages
-
Install dependencies across all projects recursively:
soliloquy install -d ./monorepo --recursive
-
Run tests in monorepo mode with multiple workers:
soliloquy validate -d ./src --test-mode monorepo --num-workers 4
-
Release your package after validation:
soliloquy release -d ./myproject --publish-password YOUR_PYPI_PASSWORD
Contributions are welcome! If you’d like to contribute:
- Fork the Repository: Create your own fork on GitHub.
- Create a Branch: Work on a new feature or bugfix.
- Write Tests: Ensure your changes are covered by tests.
- Submit a Pull Request: Provide a detailed description of your changes.
Please review our CONTRIBUTING.md for more details on our contribution process.
This project is licensed under the Apache 2.0 License.
For questions, suggestions, or further information, please open an issue on GitHub or reach out directly.
Happy coding with Soliloquy! 🚀