Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Community Meeting Meta Issue [BREAKING CHANGES] #354

Closed
rochacbruno opened this issue Jun 9, 2020 · 14 comments
Closed

Community Meeting Meta Issue [BREAKING CHANGES] #354

rochacbruno opened this issue Jun 9, 2020 · 14 comments

Comments

@rochacbruno
Copy link
Member

rochacbruno commented Jun 9, 2020

Let's discuss the breaking changes coming on Dynaconf 3.0.0 https://doodle.com/poll/ke2g4kc6mzwgtavh

There are some issues still opened for 3.0 https://github.com/rochacbruno/dynaconf/milestone/9

The highlights to be discussed are:

  • Global settings object is going to be deprecated
    Users must create their own instance of dynaconf
    Deprecate

    from dynaconf import settings

    New recommended way

     # yourprogram/config.py
     settings = Dynaconf(**options)`

    reason
    Most users are confused about importing direct from dynaconf a singleton config object and when
    customizations via **options are needed they have to change the whole codebase.

  • No more default file paths
    Right now Dynaconf loads all files named settings.*
    idea is making it explicit only via option
    settings_files=[list of paths or globs]
    e.g:

    from dynaconf import Dynaconf
    settings = Dynaconf(settings_files=["main.toml", "other.toml", "path/*.toml"])

    reason
    Debugging file loading is hard, permissions and other I/O problems may happen
    idea is to make explicit and raise earlier for errors.

  • Envless mode will be default

    Now dynaconf has an envless_mode, which means it can load
    all variables direct from the main level of a file.

    server = 'bar.com'
    port = 5050

    This will be the default and if needed users will provide the
    list of environments.

    settings = Dynaconf(envs=["development", "production"])

    then

    [default]
    server = 'bar.com'
    port = 5050
    [development]
    server = 'dev.com'
    [production]
    server = 'prod.com'
    port = 80
  • Allow parser to be changed or disabled
    Right now toml is the only parser for every variable,
    idea is to make it configurable (and allow users to opt-out)
    reason
    Some users reported that wanted raw values instead of parsed
    by toml.

  • dotenv will be disabled by default
    No more loading of .env unless users explicitly enables it.
    reason
    In some environments dotenv is already loaded by the shell tool

  • Validators will fire by default if passed to the settings object
    No need to explicity call settings.validators.validate()
    if Dynaconf(validators=[...]) is passed it will be called
    right after the initialization.

  • Remove logging completely
    reason
    It is easier to debug using pdb/ipdb, logging right now is
    useless.

  • Allow Pydantic BaseModels as validators

@And2Devel
Copy link

Hi Bruno

Let me comment first bullet: right now it is very simple: you simply adding 'import dynaconf' in each module where you want to use settings, and then, referring to parameters through settings.SOMETHING. With this change, will I have to declare settings object.. in every module? every function?

It seems difficult, especially because my app changing values of parameters sometimes - then an object declared somewhere will miss these changes.. Or am I wrong?

@rochacbruno
Copy link
Member Author

@And2Devel hi, the idea is that somewhere in your project you create your own main settings object.

program/config.py

from dynaconf import Dynaconf
settings = Dynaconf(**options)

then in other parts of your program you just import from program.config import settings

@And2Devel
Copy link

And2Devel commented Jun 9, 2020

OK, I see.
What about changing value of a parameter?
Will I have to use "global" in every function, like below?

def example_function():
    global settings
    settings.SOMETHING = 'value'

If yes, then it is very similar to use of a standard python dictionary, declared in config.py, and at least for me, a value of dynaconf drops - I like the way how simple is using dynaconf 2.x..

@rochacbruno
Copy link
Member Author

@And2Devel no, you don't need to use global the only change is that instead of importing the settings from dynaconf directly you will start importing from yourprogram.config the usage remains the same.

@RonnyPfannschmidt
Copy link

in insights-qe we pretty much completely try to avoid the global variable and try to set up multiple own instances per "application object" - we collect settings files from a number of python package data folders and want to grow the ability to easyly create views to a specifiv settings instance with overrides layered on top

@rochacbruno
Copy link
Member Author

rochacbruno commented Jun 10, 2020

Dynaconf Community Meeting is going to happen on

Thursday June 11
See all timezones here: https://everytimezone.com/s/3b188d2d
UTC: 16:00-17:00
EDT: 12:00-13:00
BRT: 13:00-14:00

Add to Google Calendar: https://calendar.google.com/calendar/event?eid=NTJiZDJoY2M1MDg2bWJwcWJjcjV1MTBvNWcgNGlrZm5rbTdmb25namFuMWhlcHNxYm5nbnNAZw&ctz=America/Sao_Paulo

Participate in the meeting: https://meet.google.com/xyh-jrcv-phz

Watch it public on: https://twitch.tv/codeshow

Topics: #354

@RonnyPfannschmidt
Copy link

@rochacbruno it seems like both the add to calendar and the timezone links dont work for me, i'll retry in a bit

@JacobCallahan
Copy link
Contributor

@rochacbruno same for me

@rochacbruno
Copy link
Member Author

rochacbruno commented Jun 10, 2020

@RonnyPfannschmidt @JacobCallahan looks like it is fixed now https://calendar.google.com/calendar/event?eid=NTJiZDJoY2M1MDg2bWJwcWJjcjV1MTBvNWcgNGlrZm5rbTdmb25namFuMWhlcHNxYm5nbnNAZw&ctz=America/Sao_Paulo

@RonnyPfannschmidt
Copy link

It's like a one time link

@rochacbruno
Copy link
Member Author

rochacbruno commented Jun 16, 2020

Dynaconf COmmunity meeting is recorded here: Available for 60 days: https://www.twitch.tv/videos/647819477?t=00h06m20s

@rochacbruno
Copy link
Member Author

rochacbruno commented Jun 16, 2020

the version 3.0.0 is implementing the main changes:

"Explicit is better than implicit"

@rochacbruno rochacbruno pinned this issue Jun 21, 2020
@rochacbruno rochacbruno changed the title Community Meeting Meta Issue Community Meeting Meta Issue [BREAKING CHANGES] Jun 21, 2020
@rochacbruno
Copy link
Member Author

All the changes discussed on this issue has been implemented!

Details on https://github.com/rochacbruno/dynaconf/blob/master/3.x-release-notes.md

Pre release rc2 is coming tomorrow and I can use some help for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants