forked from grizz/pymdgen
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up, modernize, and release pymdgen (#21)
* migrate poetry to uv * update unit test * fix review
- Loading branch information
Showing
22 changed files
with
1,095 additions
and
1,275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,36 +14,33 @@ jobs: | |
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip | ||
restore-keys: ${{ runner.os }}-pip | ||
- name: Install Poetry | ||
uses: snok/[email protected] | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v2 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
# virtualenvs-path: ~/.venv | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
id: cached-uv-dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock') }} | ||
# install dependencies if cache does not exist | ||
- name: Check cache and install dependencies | ||
run: poetry install | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: uv sync --all-extras --dev | ||
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true' | ||
- name: Run linters | ||
run: | | ||
source .venv/bin/activate | ||
flake8 . | ||
black . --check | ||
isort . | ||
uv run pre-commit run --all-files | ||
test: | ||
needs: linting | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ "ubuntu-latest", "macos-latest" ] | ||
python-version: [ "3.6", "3.7", "3.8", "3.9" ] | ||
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out repository | ||
|
@@ -52,25 +49,24 @@ jobs: | |
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Poetry | ||
uses: snok/[email protected] | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v2 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
id: cached-uv-dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock') }} | ||
# install dependencies if cache does not exist | ||
- name: Check cache and install dependencies | ||
run: poetry install | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: uv sync --all-extras --dev | ||
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true' | ||
- name: Run tests | ||
run: | | ||
poetry run pytest tests/ --cov="pymdgen" --cov-report=xml --cov-report=term-missing | ||
poetry run coverage report | ||
uv run tox | ||
# upload coverage stats | ||
- name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
.coverage | ||
coverage.xml | ||
/dist | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
fail_fast: true | ||
repos: | ||
- repo: local | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: system | ||
name: isort | ||
entry: poetry run isort . | ||
language: system | ||
pass_filenames: false | ||
- id: check-yaml | ||
- id: trailing-whitespace | ||
- repo: local | ||
hooks: | ||
- id: pyupgrade | ||
name: pyupgrade | ||
entry: poetry run pyupgrade --py36-plus | ||
entry: uv run pyupgrade --py36-plus | ||
language: python | ||
types: [python] | ||
pass_filenames: true | ||
- repo: local | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.14 | ||
hooks: | ||
- id: system | ||
name: Black | ||
entry: poetry run black . | ||
language: system | ||
pass_filenames: false | ||
- id: ruff | ||
args: [--fix, --unsafe-fixes] | ||
- id: ruff-format |
Oops, something went wrong.