Skip to content

Commit

Permalink
Merge branch '202411-modernize' of github.com:20c/pymdgen into 202411…
Browse files Browse the repository at this point in the history
…-modernize
  • Loading branch information
vegu committed Nov 11, 2024
2 parents 3fc48b0 + f93f411 commit 7679ab7
Show file tree
Hide file tree
Showing 22 changed files with 1,095 additions and 1,275 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
.coverage
coverage.xml
/dist
.venv
23 changes: 10 additions & 13 deletions .pre-commit-config.yaml
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
Loading

0 comments on commit 7679ab7

Please sign in to comment.