This should be an easy one, but I'm straight-up br...
# general
w
This should be an easy one, but I'm straight-up brain mush this month.
alembic
is packaged into my pex file, and I want to run the command line to test out migrations and whatnot, but that's looking for an
alembic.ini
file. Since I can't bundle
files
into a
pex-binary
, I need to use a
resource
. However, when I do that,
alembic
CLI doesn't know where to look for the config. I think it ends up getting packaged into site packages or something. Anyone have experience with this? Eventually I'll be bundling the command into a
scie
with the rest of my application as a separate command, but trying to quickly test something on a pex
c
if you run the pex with a known path, you could perhaps point alembic to the ini file, knowing where it’ll end up?
w
Yeah, that might work - I can try that out. For the moment, I just bundled it in the SCIE, and it seems to be working? I'll know momentarily
I can't seem to use the bindings path correctly, as it doesn't exist until I run another command. I need to spent some time looking at the scie docs, as I'm just rusty. Was hoping for a quick hack for someone to work with
b
The "quick" hack we use for this is to have a wrapper for the alembic CLI, that first unpacks the config to a temporary directory, then
os.chdir
to that directory, and then invokes
alembic.config.main(argv=args)
.
This is for packaging into a PEX, and with an old version of alembic that didn't support pointing it to a specific config directory (it may now, I don't know).
w
Ah, okay, that's interesting. You can now, with
-c CONFIG_PATH
or using I believe
ALEMBIC_CONFIG
envvar
👍 1
For the moment, I've tried packaging alembic with my main command as
SCIE_BOOT=migrate
and then just allowing passed in commands, but I just realized that I also have to get the
migrations
directory included. I thought it was just the config, but alembic needs a path, the scripts directory, and config. Blah
I may just remove the CLI access, and see if it isn't easier with a shim script
b
w
Thanks! I'll try it out!