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

Move settings to pydantic-settings #4492

Merged
merged 4 commits into from
Sep 7, 2022
Merged

Move settings to pydantic-settings #4492

merged 4 commits into from
Sep 7, 2022

Conversation

samuelcolvin
Copy link
Member

@samuelcolvin samuelcolvin commented Sep 6, 2022

Removing settings from pydantic as settings will be a separate package pydantic-settings.

We might make it installable via pydantic[settings], not sure yet if this is a good idea?

skip change file check.

@samuelcolvin samuelcolvin changed the title Move settings to pydantic-settings Move settings to pydantic-settings Sep 6, 2022
@samuelcolvin
Copy link
Member Author

Unfortunately we have a slight problem - someone has already taken the package name pydantic-settings, I've emailed them asking if they could change their package name.

@samuelcolvin
Copy link
Member Author

otherwise should be ready.

@hramezani
Copy link
Member

Unfortunately we have a slight problem - someone has already taken the package name pydantic-settings, I've emailed them asking if they could change their package name.

Do you have other options in your mind?

@samuelcolvin
Copy link
Member Author

He has replied and kindly agreed to release the name, he's just getting his 2fa reset.

@PrettyWood
Copy link
Member

He has replied and kindly agreed to release the name, he's just getting his 2fa reset.

Great!


According to the description of author's package

but from my point it’s missing some useful features:

  • Overriding settings values by environment variables even for nested fields
  • Providing detailed information about value location inside a loaded file or environment variable, which helps to point user mistake
  • Documenting model fields isn’t feels comfortable, but it’s really essential to write comprehensive documentation for application settings

I reckon it'd be great to work together with author on the future of (official) pydantic-settings

@samuelcolvin
Copy link
Member Author

Ye, I'd love him to contribute, he says he has no plans to continue to work on the package though.

But maybe joining the team here will tempt him 😉.

@samuelcolvin samuelcolvin merged commit 85e4596 into main Sep 7, 2022
@samuelcolvin samuelcolvin deleted the remove-settings branch September 7, 2022 12:05
@samuelcolvin
Copy link
Member Author

See https://github.com/pydantic/pydantic-settings, I've moved the existing logic to a new package.

@caniko
Copy link
Contributor

caniko commented Sep 7, 2022

+1 for pyndatic[settings]

@zmievsa
Copy link

zmievsa commented Sep 7, 2022

@samuelcolvin you probably already know this but better be safe than sorry:

If the person does not reply or does not want to give you the package, you can try filling out a PEP 541 request here.

@ofek
Copy link
Contributor

ofek commented Sep 7, 2022

Can we look into finally supporting this? 🙂 #1676

@samuelcolvin
Copy link
Member Author

Can we look into finally supporting this? 🙂 #1676

Yea definitely, V2 is an opportunity to fix all the messy stuff we couldn't fix in minor releases.

@ofek
Copy link
Contributor

ofek commented Sep 7, 2022

@danields761
Copy link

@Ovsyanka83, relax, I'll transfer pypi name via my good will, and Samuel didn't sent me any blackmails ;)

@PrettyWood , nice to hear that! If some of my original ideas could be integrated into new pydantic-settings, I'll gladly contribute

@samuelcolvin , is there features of mine pydantic-settings library, which you would like to pull into new one?

@zmievsa
Copy link

zmievsa commented Sep 8, 2022

@danields761 I apologize :)

I was writing this in case the package was name-squatted by someone. Thanks for transferring it!

@samuelcolvin
Copy link
Member Author

@danields761, thanks so much.

Yes, I think so. Like @PrettyWood said, we definitely want to have better support for environment variables filling nested fields.

I also think it would be really useful to provide details on where field are populated from as you mention.

But I need to go through this in more depth and write a proposal, please keep your pydantic-settings repo in place so I can review it further while writing the proposal.

@samuelcolvin
Copy link
Member Author

Oh, forgot to add @danields761, hapy to make you a collaborator on the pydantic/pydantic-settings repo if you'd like.

@danields761
Copy link

@samuelcolvin , that would be nice, thanks!

Please, let me know, when you'll be ready

@samuelcolvin
Copy link
Member Author

Thanks @danields761, I've sent you an email.

@hmeine
Copy link

hmeine commented Sep 20, 2022

FWIW, I have been using https://github.com/danields761/pydantic-settings/ mostly for its with_attrs_docs decorator.

It greatly reduces the visual noise / clutter when documenting fields that otherwise do not even need a Field().

Hence, I would love to see this come upstream (not caring so much about the actual syntax / import).

@samuelcolvin
Copy link
Member Author

samuelcolvin commented Sep 20, 2022

Thanks @hmeine, without looking into with_attrs_docs, I'd be happy to try and support it.

Could you create an issue on https://github.com/pydantic/pydantic-settings so we don't forget this.

@maartenbreddels
Copy link

We might make it installable via pydantic[settings]

This could have made it possible to make libraries compatible with pydantic 1 and 2. Now we need to add the following requirement:

  • "pydantic-settings; python_version > '3.6'",

Which makes our libraries implicitly dependent on pydantic 2.

If we could add pydantic[settings], pip would just ignore it for pydantic 1 (ok, it gives a warning, but it makes it possible for users to still install pydantic 1 is needed for some reason).

See also #6497

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

Successfully merging this pull request may close these issues.

None yet

9 participants