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

Support pdm.toml configuration in pyproject.toml #1828

Closed
wgordon17 opened this issue Apr 9, 2023 · 4 comments
Closed

Support pdm.toml configuration in pyproject.toml #1828

wgordon17 opened this issue Apr 9, 2023 · 4 comments
Labels
⭐ enhancement Improvements for existing features

Comments

@wgordon17
Copy link

With the change from a hidden .pdm.toml configuration to a pdm.toml file, I'm requesting the ability to migrate this configuration into the [tool.pdm] configuration section of pyproject.toml.

The goal (or at least my goal) with pyproject.toml is to unify configuration of the myriad of tooling into a single file. Many tools have come a long way to making this a reality, greatly reducing my configuration file sprawl.

When .pdm.toml was just a hidden file, it was easier to ignore/justify, but now that's in your face, I would like to get rid of this file and migrate it's configuration into pyproject.toml.

So pdm.toml configuration would move from

[python]
use_venv = true

[strategy]
save = "compatibility"

[venv]
in_project = false

To pyproject.toml

[tool.pdm.python]
use_venv = true

[tool.pdm.strategy]
save = "compatibility"

[tool.pdm.venv]
in_project = false
@wgordon17 wgordon17 added the ⭐ enhancement Improvements for existing features label Apr 9, 2023
@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Apr 9, 2023

That makes sense IMO 👍

@frostming
Copy link
Collaborator

Poetry also has them in poetry.toml, if we are moving them to pyproject.toml we should use a namespace with one level deeper, like tool.pdm.config

@wgordon17
Copy link
Author

Yeah, +1 on tool.pdm.config or tool.pdm.configuration.

@frostming, thanks for raising that point about the poetry.toml file, I honestly didn't realize it was a thing 😅 So I decided to dig into on the Poetry side to understand their use case/arguments, and this about as close to an a reason as I could find: python-poetry/poetry#2937 (comment)

Tl;dr, keeping local configuration in a separate file makes sense as long as it's not checked in to VCS. The Poetry docs even call it out https://python-poetry.org/docs/configuration/#local-configuration

Be mindful about checking in this file into your repository since it may contain user-specific or sensitive information.

Considering PDM's suggestion is to check in the pdm.toml file, I feel that it definitely makes sense to just integrate those configuration settings into pyproject.toml, otherwise what's the point of have 2 different files essentially for the same purposes? ¯\_(ツ)_/¯ If I understand correctly, PDM is solving for the "user-specific configuration" piece by creating the separate .pdm-python file.

Although, looking at PDM's configuration options, you have things like pypi.password in there. That's really probably not something you want to encourage folks checking in to their VCS 😅 So, perhaps maybe rethink about encouraging folks to check in the pdm.toml file after all? In which case, it obviously makes sense still keeping it as a separate file. Now, with that said, don't let me stop you from at least migrating some of the configuration options into pyproject.toml or possibly doing some lookup order, like pdm.toml -> pypoetry.toml -> config.toml` 😉

@frostming
Copy link
Collaborator

I have some other thoughts about this. When putting config in a separate file pdm.toml, users are free to not commit it to the VCS so that they can store some private data such as index credentials. However, integrating them into pyproject.toml means that it must be shared to the public. But if we support both, there will be too many config files to read.

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

No branches or pull requests

3 participants