JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

Project segment: Follow PEP 621 to retrieve project metadata from pyproject.toml #4461

Closed jacobo-diaz closed 9 months ago

jacobo-diaz commented 10 months ago

Code of Conduct

What would you like to see changed/added?

Template properties retrieved from pyproject.toml should follow PEP621 and PyPA specification.

Maybe a "Python" project type could be added to the .Type property, which could read the .Name and .Version fields from the "[project]" table in pyproject.toml.

oleksbabieiev commented 10 months ago

It seems like a good idea, but this new Python project type will conflict with Poetry. I don't use Poetry, but if I understand everything correctly, it has had a problem with not being PEP 621 compliant for a long time. They seem to be planning to implement PEP 621 support (at least that's what their roadmap says), but so far it looks like they haven't made much progress.

Here's my idea: maybe we could not add a separate Python project type, but rename Poetry. Then, if the name and version in the pyproject.toml are listed under the [tool.poetry] header (i.e. they exist and are not empty), extract them, and otherwise, if they are listed under the [project] header, get them from there. At least, that's the best solution I've found so far.

oleksbabieiev commented 10 months ago

@jacobo-diaz tomorrow night I'll have some free time, so I can try to implement this feature

jacobo-diaz commented 10 months ago

I completely agree with you, @oleksbabieiev. Two types is confusing. Much better renaming.

Thanks a lot,

It seems like a good idea, but this new Python project type will conflict with Poetry. I don't use Poetry, but if I understand everything correctly, it has had a problem with not being PEP 621 compliant for a long time. They seem to be planning to implement PEP 621 support (at least that's what their roadmap says), but so far it looks like they haven't made much progress.

Here's my idea: maybe we could not add a separate Python project type, but rename Poetry. Then, if the name and version in the pyproject.toml are listed under the [tool.poetry] header (i.e. they exist and are not empty), extract them, and otherwise, if they are listed under the [project] header, get them from there. At least, that's the best solution I've found so far.

JanDeDobbeleer commented 10 months ago

@jacobo-diaz @oleksbabieiev this is a feature for the project segment BTW.

github-actions[bot] commented 3 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.