Skip to content

Commit 890e5e4

Browse files
committed
docs: add python/pip usage
1 parent 71be8a4 commit 890e5e4

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,43 @@ Conventional Commit......................................................Passed
7979
- duration: 0.05s
8080
```
8181

82+
## Install with pip
83+
84+
`conventional-pre-commit` can also be installed as used from the command line or in your Python project:
85+
86+
```shell
87+
pip install conventional-pre-commit
88+
```
89+
90+
Then run the command line script:
91+
92+
```shell
93+
conventional-pre-commit [types] input
94+
```
95+
96+
Where `[types]` is an optional list of Conventional Commit types to allow (e.g. `feat fix chore`)
97+
98+
And `input` is a file containing the commit message to check:
99+
100+
```shell
101+
conventional-pre-commit feat fix chore ci test .git/COMMIT_MSG
102+
```
103+
104+
Or from a Python program:
105+
106+
```python
107+
from conventional_pre_commit.format import is_conventional
108+
109+
# prints True
110+
print(is_conventional("feat: this is a conventional commit"))
111+
112+
# prints False
113+
print(is_conventional("nope: this is not a conventional commit"))
114+
115+
# prints True
116+
print(is_conventional("custom: this is a conventional commit", types=["custom"]))
117+
```
118+
82119
## Versioning
83120

84121
Versioning generally follows [Semantic Versioning](https://semver.org/).

0 commit comments

Comments
 (0)