Skip to content

Commit d530850

Browse files
committed
build: update build tool to poetry and use ruff for linting
1 parent 02e7ff4 commit d530850

12 files changed

+572
-406
lines changed

.github/workflows/ci.yaml

+8-34
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Github CI
22

33
on:
44
push:
5-
branches: ['main']
5+
branches: ['main', 'poetry']
66
pull_request:
77

88
jobs:
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
python-version: ['3.8']
14+
python-version: ['3.10']
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -24,48 +24,22 @@ jobs:
2424
- name: Install Pipenv
2525
run: |
2626
python -m pip install --upgrade pip
27-
python -m pip install pipenv
27+
python -m pip install poetry
2828
2929
- name: Install dependencies
3030
run: |
31-
pipenv install --dev
31+
poetry install
32+
33+
- name: Run Lint
34+
uses: astral-sh/ruff-action@v3
3235

3336
- name: Run tests with coverage
3437
run: |
35-
pipenv run coverage-xml
38+
poetry run pytest --cov=src/ --cov-report=xml --no-cov-on-fail
3639
3740
- name: Send coverage to CodeCov
3841
uses: codecov/codecov-action@v3
3942
with:
4043
token: ${{ secrets.CODECOV_TOKEN }}
4144
fail_ci_if_error: false
4245
verbose: true
43-
44-
linting:
45-
runs-on: ubuntu-latest
46-
steps:
47-
- uses: actions/checkout@v4
48-
49-
- name: Set up Python
50-
uses: actions/setup-python@v5
51-
with:
52-
python-version: '3.8'
53-
54-
- name: Install lint dependencies
55-
run: pip install flake8 mypy isort
56-
57-
- name: flake8
58-
uses: liskin/gh-problem-matcher-wrap@v3
59-
with:
60-
linters: flake8
61-
run: flake8 --max-line-length=88 --ignore=E203,W503 src/
62-
- name: mypy
63-
uses: liskin/gh-problem-matcher-wrap@v3
64-
with:
65-
linters: mypy
66-
run: mypy --strict --show-column-numbers src/
67-
- name: isort
68-
uses: liskin/gh-problem-matcher-wrap@v3
69-
with:
70-
linters: isort
71-
run: isort --line-length=88 --check --profile black src/

.github/workflows/commitlint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Commitlint
22

33
on:
44
push:
5-
branches: ['main']
5+
branches: ['main', 'poetry']
66
pull_request:
77

88
jobs:

.pre-commit-config.yaml

+6-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
hooks:
44
- id: run-tests
55
name: Run tests
6-
entry: pipenv run test
6+
entry: poetry run pytest
77
language: system
88
pass_filenames: false
99

@@ -24,20 +24,9 @@ repos:
2424
- id: end-of-file-fixer
2525
- id: trailing-whitespace
2626

27-
- repo: https://github.com/akaihola/darker
28-
rev: 1.7.1
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.9.6
2929
hooks:
30-
- id: darker
31-
args:
32-
- --isort
33-
- --flynt
34-
- --lint=flake8 --max-line-length=88 --ignore=E203,W503
35-
- --lint=mypy --strict
36-
- --lint=pylint --max-line-length=88 --disable=W0511
37-
additional_dependencies:
38-
- black==23.3.0
39-
- flake8==5.0.4
40-
- flynt==0.77
41-
- isort==5.12.0
42-
- mypy==1.8.0
43-
- pylint==2.17.4
30+
- id: ruff
31+
args: [ --fix ]
32+
- id: ruff-format

CONTRIBUTING.md

+46-25
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,64 @@
1-
# How to Contribute
1+
# Contributing Guide
22

3-
## Install Development Dependencies (Using Pipenv)
3+
Thank you for your interest in contributing to the **commitlint** project!
4+
Your contributions will help improve and enhance this tool.
5+
Please take a moment to review the following guidelines before getting started.
46

5-
All the dependencies are managed by Pipenv. Please install Pipenv on your system first by following the instructions at [https://pipenv.pypa.io/en/latest/installation.html](https://pipenv.pypa.io/en/latest/installation.html).
7+
## Prerequisites
68

7-
Once Pipenv is installed, you can install the development dependencies by running the following command:
9+
Before contributing, ensure that you have the following:
810

9-
```bash
10-
pipenv install --dev
11-
```
11+
- **Python 3.10 or higher** installed. Download it from the [official Python website](https://www.python.org/downloads/).
12+
- **Poetry** installed for dependency management. Follow the [Poetry installation guide](https://python-poetry.org/docs/#installation).
13+
14+
## Getting Started
15+
16+
To set up the project on your local machine, follow these steps:
17+
18+
1. **Fork** the repository on GitHub.
19+
2. **Clone** the forked repository to your local machine:
20+
21+
```bash
22+
git clone https://github.com/<your-username>/commitlint.git
23+
cd commitlint
24+
```
25+
26+
3. **Install dependencies**:
27+
28+
```bash
29+
poetry install
30+
```
1231

13-
## Install pre-commit hooks
32+
4. **Verify your setup**:
1433

15-
To install pre-commit and commit-msg hook for this project, run the following command:
34+
```bash
35+
poetry run commitlint --version
36+
```
37+
38+
## Tests
39+
40+
Run tests
1641

1742
```bash
18-
pipenv run install-hooks
43+
poetry run pytest
1944
```
2045

21-
## Run tests
22-
23-
Run the tests using the below command:
46+
Run tests with coverage
2447

2548
```bash
26-
pipenv run test
49+
poetry run pytest --cov=src
2750
```
2851

29-
## Before submitting
52+
Generate html coverage
3053

31-
Before submitting your Pull Request, please do the following steps:
54+
```bash
55+
poetry run pytest --cov=src/ --cov-report=html
56+
```
3257

33-
1. Add any changes you want.
34-
1. Add tests for the new changes.
35-
1. Edit documentation (`README.md`) if you have changed something significant.
36-
1. Commit your changes using [semantic commit message](https://seesparkbox.com/foundry/semantic_commit_messages).
37-
Examples: `"fix: Fixed foobar bug"`, `"feat(accounts): Added foobar feature on accounts"`.
58+
## Use pre-commit hook
3859

39-
## Other help
60+
Install pre-commit hook using the command below.
4061

41-
You can contribute by spreading a word about this library.
42-
It would also be a huge contribution to write a short article on how you are using this project.
43-
You can also share your best practices with us.
62+
```bash
63+
poetry run pre-commit install --hook-type pre-commit --hook-type commit-msg
64+
```

Pipfile

-18
This file was deleted.

0 commit comments

Comments
 (0)