Skip to content

Commit 01edc76

Browse files
authored
Replace poetry by PEP-621 compliant pyproject.toml (#9)
1 parent 24cecea commit 01edc76

File tree

11 files changed

+129
-692
lines changed

11 files changed

+129
-692
lines changed

.github/workflows/lint-and-test.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,35 @@ on:
1111
workflow_dispatch:
1212
workflow_call:
1313

14+
env:
15+
PYTHON_VERSION: '3.11'
16+
1417
jobs:
1518
lint-and-test:
1619
strategy:
1720
fail-fast: false
1821
matrix:
19-
python-version: ["3.8", "3.9", "3.10", "3.11"]
22+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2023
runs-on: ubuntu-latest
2124
steps:
22-
- uses: actions/checkout@v3
23-
- name: Install poetry
24-
run: pipx install poetry
25-
- uses: actions/setup-python@v3
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
2629
with:
27-
python-version: ${{ matrix.python-version }}
28-
cache: 'poetry'
29-
- name: Install dependencies
30-
run: poetry install
31-
- name: Lint markdown
32-
run: poetry run mdwrap --fmt --check --ignore-extend tests .
30+
python-version: ${{ matrix.PYTHON_VERSION }}
31+
cache: 'pip'
32+
- name: Install Python dependencies
33+
run: |
34+
python -m pip install -U pip
35+
python -m pip install -r requirements-freeze.txt
3336
- name: Lint with flake8
34-
run: poetry run flake8
37+
run: python -m flake8
3538
- name: Lint with black
36-
run: poetry run black --check .
39+
run: python -m black --check .
3740
- name: Lint with isort
38-
run: poetry run isort --check .
41+
run: python -m isort --check .
3942
- name: Test with pytest
40-
run: poetry run pytest
43+
run: python -m pytest
4144
- name: Build the package
42-
run: poetry build
45+
run: python -m build

.github/workflows/release.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- '*.*.*'
77

8+
env:
9+
PYTHON_VERSION: '3.11'
10+
811
jobs:
912
lint-and-test:
1013
name: Call Lint and Test
@@ -16,20 +19,19 @@ jobs:
1619
name: Create Release
1720
runs-on: ubuntu-latest
1821
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@master
21-
- name: Install poetry
22-
run: pipx install poetry
23-
- uses: actions/setup-python@v3
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
2426
with:
25-
python-version: "3.11"
26-
cache: 'poetry'
27+
python-version: ${{ env.PYTHON_VERSION }}
28+
cache: 'pip'
2729
- name: Build the package
28-
run: poetry build
30+
run: python -m build
2931
- name: Check Version
3032
id: check-version
3133
run: |
32-
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
34+
[[ "$(grep 'version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/')" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
3335
- name: Create Release
3436
uses: ncipollo/release-action@v1
3537
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ tests/integration/**/output.*
77

88
# OS Specific
99
.DS_Store
10+
11+
# Environments
12+
.venv

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-added-large-files
66
- id: check-case-conflict
@@ -9,7 +9,7 @@ repos:
99
- id: end-of-file-fixer
1010
- id: trailing-whitespace
1111
- repo: https://github.com/PyCQA/flake8
12-
rev: 6.0.0
12+
rev: 7.0.0
1313
hooks:
1414
- id: flake8
1515
additional_dependencies:
@@ -21,11 +21,11 @@ repos:
2121
"flake8-implicit-str-concat",
2222
]
2323
- repo: https://github.com/psf/black
24-
rev: 23.7.0
24+
rev: 24.4.2
2525
hooks:
2626
- id: black
2727
- repo: https://github.com/PyCQA/isort
28-
rev: 5.12.0
28+
rev: 5.13.2
2929
hooks:
3030
- id: isort
3131
- repo: https://github.com/csia-pme/mdwrap

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

README.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
- [Overview](#overview)
1717
- [Pre-commit Hook](#pre-commit-hook)
1818
- [Installation](#installation)
19-
- [With pip](#with-pip)
20-
- [With Poetry](#with-poetry)
2119
- [Usage](#usage)
2220
- [Arguments](#arguments)
2321
- [Limitations](#limitations)
@@ -56,18 +54,11 @@ repos:
5654
5755
## Installation
5856
59-
### With pip
6057
6158
```bash
6259
pip install git+https://github.com/csia-pme/[email protected]
6360
```
6461

65-
### With Poetry
66-
67-
```bash
68-
poetry add git+https://github.com/csia-pme/[email protected]
69-
```
70-
7162
## Usage
7263

7364
```bash
@@ -119,33 +110,39 @@ blocks.
119110

120111
### Development
121112

122-
Firstly, install the pre-commit hooks:
113+
Create and enable a virtual environment:
123114

124115
```bash
125-
pre-commit install
116+
python -m venv .venv
117+
source .venv/bin/activate
126118
```
127119

128-
Then, install the development dependencies:
120+
Install the development dependencies:
129121

130122
```bash
131-
poetry install
123+
pip install .
124+
```
125+
126+
Install the pre-commit hooks:
127+
128+
```bash
129+
pre-commit install
132130
```
133131

134132
### Testing
135133

136134
To run the tests:
137135

138136
```bash
139-
poetry run pytest
137+
pytest
140138
```
141139

142140
### Linting
143141

144142
To lint the code:
145143

146144
```bash
147-
poetry run flake8
148-
poetry run black --check .
145+
pre-commit run -a
149146
```
150147

151148
### Releasing
@@ -156,7 +153,7 @@ poetry run black --check .
156153

157154
```bash
158155
# Bump the version in pyproject.toml
159-
poetry version <version>
156+
sed -i 's/version = ".*"/version = "0.x.y"/' pyproject.toml
160157
# Create a new tag
161158
git tag <version> main
162159
# Push the tag
@@ -172,7 +169,6 @@ git push origin <version>
172169
This project is built with the following tools:
173170

174171
- [`pre-commit`](https://pre-commit.com/)
175-
- [`poetry`](https://python-poetry.org/)
176172
- [`pytest`](https://docs.pytest.org/)
177173
- [`flake8`](https://flake8.pycqa.org/en/latest/)
178174
- [`black`](https://black.readthedocs.io/en/stable/)

mdwrap/utils/argparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def make_wide(formatter, w=80, h=36):
107107
try:
108108
# https://stackoverflow.com/a/5464440
109109
# beware: "Only the name of this class is considered a public API."
110-
kwargs = {'width': w, 'max_help_position': h}
110+
kwargs = {"width": w, "max_help_position": h}
111111
formatter(None, **kwargs)
112112
return lambda prog: formatter(prog, **kwargs)
113113
except TypeError:

0 commit comments

Comments
 (0)