Skip to content

Commit b789d41

Browse files
vegugablooge
andauthored
Clean up, modernize, and release pymdgen (#22)
* Clean up, modernize, and release pymdgen (#21) * migrate poetry to uv * update unit test * fix review * set codecov token --------- Co-authored-by: Samsul Hadi <samsulhadikediri@gmail.com>
1 parent 3b3120c commit b789d41

22 files changed

+1096
-1275
lines changed

.github/workflows/tests.yml

+16-19
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,33 @@ jobs:
1414
path: ~/.cache/pip
1515
key: ${{ runner.os }}-pip
1616
restore-keys: ${{ runner.os }}-pip
17-
- name: Install Poetry
18-
uses: snok/install-poetry@v1.1.1
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v2
1919
with:
2020
virtualenvs-create: true
2121
virtualenvs-in-project: true
2222
# virtualenvs-path: ~/.venv
2323
- name: Load cached venv
24-
id: cached-poetry-dependencies
24+
id: cached-uv-dependencies
2525
uses: actions/cache@v2
2626
with:
2727
path: .venv
28-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
28+
key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
2929
# install dependencies if cache does not exist
3030
- name: Check cache and install dependencies
31-
run: poetry install
32-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
31+
run: uv sync --all-extras --dev
32+
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
3333
- name: Run linters
3434
run: |
35-
source .venv/bin/activate
36-
flake8 .
37-
black . --check
38-
isort .
35+
uv run pre-commit run --all-files
3936
4037
test:
4138
needs: linting
4239
strategy:
4340
fail-fast: true
4441
matrix:
4542
os: [ "ubuntu-latest", "macos-latest" ]
46-
python-version: [ "3.6", "3.7", "3.8", "3.9" ]
43+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
4744
runs-on: ${{ matrix.os }}
4845
steps:
4946
- name: Check out repository
@@ -52,28 +49,28 @@ jobs:
5249
uses: actions/setup-python@v2
5350
with:
5451
python-version: ${{ matrix.python-version }}
55-
- name: Install Poetry
56-
uses: snok/install-poetry@v1.1.1
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v2
5754
with:
5855
virtualenvs-create: true
5956
virtualenvs-in-project: true
6057
- name: Load cached venv
61-
id: cached-poetry-dependencies
58+
id: cached-uv-dependencies
6259
uses: actions/cache@v2
6360
with:
6461
path: .venv
65-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
62+
key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock') }}
6663
# install dependencies if cache does not exist
6764
- name: Check cache and install dependencies
68-
run: poetry install
69-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
65+
run: uv sync --all-extras --dev
66+
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
7067
- name: Run tests
7168
run: |
72-
poetry run pytest tests/ --cov="pymdgen" --cov-report=xml --cov-report=term-missing
73-
poetry run coverage report
69+
uv run tox
7470
# upload coverage stats
7571
- name: Upload coverage
7672
uses: codecov/codecov-action@v1
7773
with:
7874
file: ./coverage.xml
7975
fail_ci_if_error: true
76+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
.coverage
88
coverage.xml
99
/dist
10+
.venv

.pre-commit-config.yaml

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
fail_fast: true
22
repos:
3-
- repo: local
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.5.0
45
hooks:
5-
- id: system
6-
name: isort
7-
entry: poetry run isort .
8-
language: system
9-
pass_filenames: false
6+
- id: check-yaml
7+
- id: trailing-whitespace
108
- repo: local
119
hooks:
1210
- id: pyupgrade
1311
name: pyupgrade
14-
entry: poetry run pyupgrade --py36-plus
12+
entry: uv run pyupgrade --py36-plus
1513
language: python
1614
types: [python]
1715
pass_filenames: true
18-
- repo: local
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.1.14
1918
hooks:
20-
- id: system
21-
name: Black
22-
entry: poetry run black .
23-
language: system
24-
pass_filenames: false
19+
- id: ruff
20+
args: [--fix, --unsafe-fixes]
21+
- id: ruff-format

0 commit comments

Comments
 (0)