Alternatives to templating prodigy.json

I'd like to have a local development setup that connects to my test database instead of using production database. At the moment my db settings are stored in prodigy.json but I'd like to expose my db settings through environment variables. Is that possible while having prodigy CLI using the correct db as well?

This is a good question! One solution that's a bit more involved but very flexible is to set up a lightweight Python package that exposes an instance of a peewee database (created from settings stored in env variables), wraps that in Prodigy's Database class and exposes it as a prodigy_db entry point under a custom name. You can then set "db": "my_custom_db" in your prodigy.json, and it'll behave like any of the built-in database options.

You could even put all your custom recipes or loaders in there as well and expose them as entry points. It is one more level of abstraction and means you have to think about Python packaging – but it could also make your setup more elegant because it lets you keep all your Prodigy utilities in one place, you can version your package and keep track of changes, and setting everything up in a new environment only requires installing Prodigy and your utilities, and you're ready to go.

1 Like