commitizen-tools / commitizen

Create committing rules for projects :rocket: auto bump versions :arrow_up: and auto changelog generation :open_file_folder:
https://commitizen-tools.github.io/commitizen/
MIT License
2.41k stars 256 forks source link

Choosing pep440 as the version scheme throws 'Version scheme "pep440" unknown.' on Windows #853

Closed cesarcoatl closed 11 months ago

cesarcoatl commented 1 year ago

Description

I tried to recreate my .cz.yaml configuration file, and when I selected pep440 as the preferred version_scheme, I got the following error: 'Version scheme "pep440" unknown.'

Steps to reproduce

  1. Run cz init
  2. Select a supported confie file
  3. Choose cz (commit rule)
  4. Choose source of the version
  5. Confirm latest tag
  6. Choose version scheme (select pep440)

Current behavior

$ cz init
Welcome to commitizen!

Answer the questions to configure your project.
For further configuration visit:

https://commitizen-tools.github.io/commitizen/config/

? Please choose a supported config file:  .cz.yaml
? Please choose a cz (commit rule): (default: cz_conventional_commits) cz_conventional_commits
? Choose the source of the version: pep621: Get and set version from pyproject.toml:project.version field
? Is v2023.8.0 the latest tag? Yes
? Choose version scheme:  pep440
Version scheme "pep440" unknown.

Desired behavior

cz init should succeed, as it does on Linux or macOS and create the following configuration file:

---
commitizen:
  name: cz_conventional_commits
  tag_format: v$version
  update_changelog_on_bump: true
  version_provider: pep621
  version_scheme: pep440

Screenshots

image

Environment

$ cz version --report
Commitizen Version: 3.9.0
Python Version: 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
Operating System: Windows
cesarcoatl commented 1 year ago

I tried a clean install both via python -m pip install --user commitizen and pipx install commitizen, and I was able to recreate cz config file without issues for both methods.

One question, though.

If pep440 is the default version_scheme, should it be present on the configuration file created with cz init?

$ cz init
Welcome to commitizen!

Answer the questions to configure your project.
For further configuration visit:

https://commitizen-tools.github.io/commitizen/config/

? Please choose a supported config file:  .cz.yaml
? Please choose a cz (commit rule): (default: cz_conventional_commits) cz_conventional_commits
? Choose the source of the version: pep621: Get and set version from pyproject.toml:project.version field
? Is v2023.9.0 the latest tag? Yes
? Choose version scheme:  pep440
? Is "v$version" the correct tag format? Yes
? Create changelog automatically on bump Yes
? What types of pre-commit hook you want to install? (Leave blank if you don't want to install) done

You can bump the version running:

        cz bump

Configuration complete 🚀

$ cat .cz.yaml
---
commitizen:
  name: cz_conventional_commits
  tag_format: v$version
  update_changelog_on_bump: true
  version_provider: pep621
  version_scheme: pep440
woile commented 1 year ago

Are you saying somehow it was related to the installation method used? It could be also that pip was outdated.

If pep440 is the default version_scheme, should it be present on the configuration file created with cz init?

You can skip it, but cz init will set the value. I chose to set the value because it prevents a problem for users in case we decide to change the defaults (we don't have any plans, but a new finding could push us to have to do so)

cesarcoatl commented 1 year ago

Are you saying somehow it was related to the installation method used?

Since you asked, I thought that might be the root cause. I once had that happen to me with tox on Windows, so I wanted to make sure.

I guess I ran into a glitch, but it's all good now.

Thanks

Lee-W commented 11 months ago

Are you saying somehow it was related to the installation method used?

Since you asked, I thought that might be the root cause. I once had that happen to me with tox on Windows, so I wanted to make sure.

I guess I ran into a glitch, but it's all good now.

Thanks

Looks like it's resolved. I'll close it for now. Feel free to reopen it if it's not the case