Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up, modernize, and release pymdgen #21

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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