pythondeploymentpython-poetryreplitpyproject.toml

How to define local dependencies for deployment using Poetry?


As I've been building my app, I separated various utilities into their own packages that I may publish later if they turn out to be useful. My project structure ended up as:

root
[app]
..main.py
[lib]
..[lib_a]
..[lib_b]
..
pyproject.toml

I'm guessing the relative path is the problem, with the production environment being different (and out of my control, as I am using replit). What is the correct way to manage these local dependencies?

workspace


Solution

  • Turns out you can just specify the package:

    [tool.poetry]
    name = "My App"
    ...
    packages = [
       {include="app"},
       {include="lib"},
    ]
    
    [tool.poetry.dependencies]
    assistant_gold = { path = "./lib/assistant_gold", develop = true }
    firestore_gold = { path = "./lib/firestore_gold", develop = true }