question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature idea: Use pydantic for loading configuration

See original GitHub issue

Today Slack Machine uses a plain python file for its config, which I find less than ideal.

I would like to put my bot in git, but I don’t want to commit any secrets into git.

To solve this I tried to do a simple import of the yaml module in local_settings.py, and load my secrets from there, but this won’t work when using Redis as storage backend.

The reason it won’t work is that the config is pickled and put into the storage, so any object will yield the error message seen in issue #273.

Changing to Dynaconf provides the benefit of letting me store my secrets separately from the main config. It will also provide a lot of other benefits and features that Dynaconf provides, like letting me choose which format I want to store my config in, multiple environments etc.

What do you think?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DonDebonaircommented, Mar 28, 2021

Might indeed be useful. I dropped you an email to discuss Slack Machine in a more general sense.

0reactions
DonDebonaircommented, Aug 1, 2022

Hey @davidolrik, I don’t know if you’re still using Slack Machine, but I’m working on it again. My first order of business is making it use asyncio (and in the process, generally refactoring it).

Configuration is another important topic I’d like to tackle soon. I’ve been reading over this issue again, and I wonder what the best approach is. I think Dynaconf and Pydantic are both valid options. I wonder if we’d use Pydantic, how we would deal with new settings required by plugins. Pydantic models are static, so the only think I can think of is to add a sort of “catch-all” dict setting on the Settings model. Do you have another idea?

If you moved past using Slack Machine, I also totally understand and won’t bother you again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pedantic Configuration Management with Pydantic
The AppConfig class defines the config variables required for you API's internal logic. In this case I'm not loading the variables from the...
Read more >
Configuration management in Python like a Boss(Pydantic ...
1. Inline. NAME=ANAND python main.py · 2. Export the Environment Variable. export NAME=ANAND python main.py · 3. Load from a .env file. Create...
Read more >
How to Make the Most of Pydantic - Towards Data Science
Make our usage of Pydantic safer and easier to debug by correctly holding data contracts. Achieve higher interoperability with JSON Schemas. Simplify data...
Read more >
Settings management - pydantic
Create a clearly-defined, type-hinted application configuration class; Automatically read modifications to the configuration from environment variables ...
Read more >
pydantic
Data validation and settings management using Python type annotations. pydantic enforces type hints at runtime, and provides user friendly errors when data ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found