I have an application that uses SQLAlchemy and Alembic for migrations.
The repository looks like this:
my-app/
my_app/
... # Source code
migrations/
versions/
... # Migration scripts
env.py
alembic.ini
MANIFEST.in
README.rst
setup.py
When in the repo, I can call alembic
commands (alembic revision
, alembic upgrade
).
I want to ship the app as a package to allow users to pip install
, and I would like them to be able to just alembic upgrade head
to migrate their DB.
How can I achieve this?
alembic
is listed as a dependency. What I don't know is how to ensure alembic.ini
and revision files are accessible to the alembic
command without the user having to pull the repo.
Adding them to MANIFEST.in
will add them to the source package but AFAIU, when installing with pip, only my_app
and subfolders end up in the (virtual) environment (this plus entry points).
Note: the notions of source dist, wheel, MANIFEST.in
and include_package_data
are still a bit blurry to me but hopefully the description above makes the use case clear.