Skip to content

Commit 93fd3af

Browse files
authored
Merge pull request #729 from commitizen-tools/fix/deps
Fix/deps
2 parents bcd3988 + ec52a23 commit 93fd3af

File tree

11 files changed

+44
-21
lines changed

11 files changed

+44
-21
lines changed

.github/.codecov.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
# minimum of 97% (real 96%)
6+
target: 97%
7+
threshold: 1%

commitizen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import logging.config
33

4-
from colorama import init
4+
from colorama import init # type: ignore
55

66
from commitizen.cz.base import BaseCommitizen
77

commitizen/commands/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def is_python_poetry(self) -> bool:
3636
if not self.has_pyproject:
3737
return False
3838
with open("pyproject.toml") as f:
39-
return "tool.poetry.version" in f.read()
39+
return "[tool.poetry]" in f.read()
4040

4141
@property
4242
def is_python(self) -> bool:

commitizen/config/json_config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
from pathlib import Path
33
from typing import Union
4+
from commitizen.exceptions import InvalidConfigurationError
45

56
from commitizen.git import smart_open
67

@@ -11,8 +12,8 @@ class JsonConfig(BaseConfig):
1112
def __init__(self, *, data: Union[bytes, str], path: Union[Path, str]):
1213
super(JsonConfig, self).__init__()
1314
self.is_empty_config = False
14-
self._parse_setting(data)
1515
self.add_path(path)
16+
self._parse_setting(data)
1617

1718
def init_empty_config_content(self):
1819
with smart_open(self.path, "a") as json_file:
@@ -43,7 +44,11 @@ def _parse_setting(self, data: Union[bytes, str]) -> None:
4344
}
4445
```
4546
"""
46-
doc = json.loads(data)
47+
try:
48+
doc = json.loads(data)
49+
except json.JSONDecodeError:
50+
raise InvalidConfigurationError(f"Failed to parse {self.path}")
51+
4752
try:
4853
self.settings.update(doc["commitizen"])
4954
except KeyError:

docs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ descriptive commits.
4242

4343
[Python](https://www.python.org/downloads/) `3.7+`
4444

45-
[Poetry](https://python-poetry.org/docs/) `1.2.0+`
46-
4745
[Git][gitscm] `1.8.5.2+`
4846

4947
## Installation

docs/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ Commitizen provides some version providers for some well known formats:
292292
!!! note
293293
The `scm` provider is meant to be used with `setuptools-scm` or any packager `*-scm` plugin.
294294

295+
An example in your `.cz.toml` would look like this:
296+
297+
```toml
298+
[tool.commitizen]
299+
version_provider = "pep621"
300+
```
301+
295302
### Custom version provider
296303

297304
You can add you own version provider by extending `VersionProvider` and exposing it on the `commitizen.provider` entrypoint.

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ If you're a first-time contributor, you can check the issues with [good first is
88

99
## Install before contributing
1010

11-
1. Install [poetry](https://python-poetry.org/), installation [pages](https://python-poetry.org/docs/#installing-with-the-official-installer)
11+
1. Install [poetry](https://python-poetry.org/) `1.2.0+`, installation [pages](https://python-poetry.org/docs/#installing-with-the-official-installer)
1212
2. Install [gpg](https://gnupg.org), installation [pages](https://gnupg.org/documentation/manuals/gnupg/Installation.html#Installation). For Mac users, you could try [homebrew](https://brew.sh/).
1313

1414
## Before making a pull request

docs/tutorials/github_actions.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: "Bump version and create changelog with commitizen"
3030
steps:
3131
- name: Check out
32-
uses: actions/checkout@v2
32+
uses: actions/checkout@v3
3333
with:
3434
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
3535
fetch-depth: 0
@@ -94,14 +94,21 @@ jobs:
9494
deploy:
9595
runs-on: ubuntu-latest
9696
steps:
97-
- uses: actions/checkout@v1
97+
- uses: actions/checkout@v3
98+
with:
99+
fetch-depth: 0
98100
- name: Set up Python
99-
uses: actions/setup-python@v1
101+
uses: actions/setup-python@v4
100102
with:
101103
python-version: "3.x"
104+
- name: Install Poetry
105+
uses: snok/install-poetry@v1
106+
with:
107+
version: latest
108+
virtualenvs-in-project: true
109+
virtualenvs-create: true
102110
- name: Install dependencies
103111
run: |
104-
python -m pip install --pre -U poetry
105112
poetry --version
106113
poetry install
107114
- name: Build and publish
@@ -112,7 +119,7 @@ jobs:
112119
./scripts/publish
113120
```
114121

115-
Notice that we are calling a bash script in `./scripts/publish`, you should configure it with your tools (twine, poetry, etc.). Check [commitizen example](https://github.com/commitizen-tools/commitizen/blob/master/scripts/publish)
122+
Notice that we are using poetry, and we are calling a bash script in `./scripts/publish`. You should configure the action, and the publish with your tools (twine, poetry, etc.). Check [commitizen example](https://github.com/commitizen-tools/commitizen/blob/master/scripts/publish)
116123
You can also use [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) to publish your package.
117124

118125
Push the changes and that's it.

docs/tutorials/gitlab_ci.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ auto-bump:
9191
- git config --global user.email "${CI_EMAIL}" && git config --global user.name "${CI_USERNAME}"
9292
- 'exists=`git show-ref refs/heads/master` && if [ -n "$exists" ]; then git branch -D master; fi'
9393
- git checkout -b master
94-
- cz bump # execute auto bump and push to master
94+
- cz bump --yes # execute auto bump and push to master
9595
- git push origin master:$CI_COMMIT_REF_NAME
9696
- TAG=$(head -n 1 VERSION) # get the new software version and save into artifacts
9797
- echo "#!/bin/sh" >> variables

poetry.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ classifiers = [
3636
[tool.poetry.dependencies]
3737
python = "^3.7"
3838
questionary = "^1.4.0"
39-
decli = "^0.5.2"
39+
decli = "^0.6.0"
4040
colorama = "^0.4.1"
4141
termcolor = ">= 1.1, < 3"
4242
packaging = ">=19"
@@ -140,7 +140,6 @@ convention = "google"
140140

141141
[tool.mypy]
142142
files = "commitizen"
143-
ignore_missing_imports = true
144143
disallow_untyped_decorators = true
145144
disallow_subclassing_any = true
146145
warn_return_any = true

0 commit comments

Comments
 (0)