feat(package): Extract package version from PEP 621 compliant pyproject.toml (#3950)

* feat(package): Extract package version from PEP621 pyproject.toml

* Update docs explaining PEP 621 package version

* Only read pyproject.toml once

* Simplify get_pep621_version

* Handle version formatting in get_pyproject_version
This commit is contained in:
Tom Fleet
2022-05-02 17:44:01 +01:00
committed by GitHub
parent 2e80aec5cb
commit 1b938fd484
2 changed files with 81 additions and 9 deletions
+2 -2
View File
@@ -2503,7 +2503,7 @@ symbol = "☁️ "
The `package` module is shown when the current directory is the repository for a
package, and shows its current version. The module currently supports `npm`, `nimble`, `cargo`,
`poetry`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` and `dart` packages.
`poetry`, `python`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards` and `dart` packages.
- [**npm**](https://docs.npmjs.com/cli/commands/npm) The `npm` package version is extracted from the `package.json` present
in the current directory
@@ -2511,7 +2511,7 @@ package, and shows its current version. The module currently supports `npm`, `ni
- [**Nimble**](https://github.com/nim-lang/nimble) - The `nimble` package version is extracted from the `*.nimble` file present in the current directory with the `nimble dump` command
- [**Poetry**](https://python-poetry.org/) The `poetry` package version is extracted from the `pyproject.toml` present
in the current directory
- [**Python**](https://www.python.org) - The `python` package version is extracted from the `setup.cfg` present in the current directory
- [**Python**](https://www.python.org) - The `python` package version is extracted from a [PEP 621](https://peps.python.org/pep-0621/) compliant `pyproject.toml` or a `setup.cfg` present in the current directory
- [**Composer**](https://getcomposer.org/) The `composer` package version is extracted from the `composer.json` present
in the current directory
- [**Gradle**](https://gradle.org/) The `gradle` package version is extracted from the `build.gradle` present