This project is a proof-of-concept demonstrating a Python monorepo structure where multiple independent libraries are consumed by a separate application.
my_monorepo: Contains the individual libraries (adder,subtractor).consumer_app: A separate application that uses the libraries from the monorepo, managed with Poetry.
Follow these steps to set up and run the project locally.
If you haven't already, clone the repository to your local machine.
git clone https://github.com/Think-and-Dev/python-library-poc
cd python-library-pocAll commands should be run from within the consumer_app directory.
cd consumer_appThis project uses Poetry to manage dependencies and link the local libraries from the monorepo.
If this is your first time setting up the project, you need to add the local packages using their paths. Poetry will create a virtual environment and install them in "editable" mode.
# Add the adder library
poetry add --editable ../my_monorepo/packages/adder
# Add the subtractor library
poetry add --editable ../my_monorepo/packages/subtractorNote: If the pyproject.toml and poetry.lock files in consumer_app already list these dependencies (because someone else has already run the add commands and committed the files), you can just run:
poetry installUse poetry run to execute the main script inside the Poetry-managed virtual environment.
poetry run python main.pyYou should see the following output, confirming that the consumer app is successfully using both libraries:
Addition result: 15
Subtraction result: 5