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

CI Updates #314

Merged
merged 11 commits into from
Jul 20, 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
40 changes: 29 additions & 11 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,43 @@ jobs:

test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
split: [1, 2, 3, 4, 5, 6]


steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Check out repo
uses: actions/checkout@v4

- name: Set up micromamba
uses: mamba-org/setup-micromamba@main

- name: Create mamba environment
run: |
micromamba create -n lobpy python=${{ matrix.python-version }} --yes

- name: Install uv
run: micromamba run -n lobpy pip install uv

- name: Install LobsterPy and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest pytest-mock pytest-split pytest-cov
python -m pip install types-setuptools
pip install .[featurizer]
micromamba activate lobpy
uv pip install --upgrade pip
uv pip install --editable '.[tests,featurizer]'

- name: Test with pytest and coverage
# run this locally to update tests durations
# pytest --cov=lobsterpy --cov-append --splits 1 --group 1 --durations-path ./tests/test_data/.pytest-split-durations --store-durations
run: |
micromamba activate lobpy
pytest --cov=lobsterpy --cov-report term-missing --cov-append --splits 6 --group ${{ matrix.split }} -vv --durations-path ./tests/test_data/.pytest-split-durations

- name: Upload coverage
uses: actions/upload-artifact@v3
with:
Expand All @@ -58,22 +72,26 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Coverage
run: |
python -m pip install coverage[toml]

- name: Download coverage artifacts
continue-on-error: true
uses: actions/download-artifact@v3

- name: Run coverage
continue-on-error: true
run: |
coverage combine coverage*/.coverage*
coverage report --show-missing

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
Expand Down
6 changes: 5 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exclude: ^(docs|examples|tests/test_data)

ci:
autoupdate_schedule: monthly
skip: [mypy]
skip: [mypy,pyright]
autofix_commit_msg: pre-commit auto-fixes
autoupdate_commit_msg: pre-commit autoupdate

Expand Down Expand Up @@ -65,3 +65,7 @@ repos:
stages: [commit, commit-msg]
args: [--ignore-words-list, 'titel,alls,ans,nd,mater,nwo,te,hart,ontop,ist,ot,fo']
types_or: [python, rst, markdown]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.372
hooks:
- id: pyright
4 changes: 2 additions & 2 deletions lobsterpy/featurize/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_file_paths(
if file_path.exists():
file_paths[file] = file_path
else:
gz_file_path = Path(zpath(file_path))
gz_file_path = Path(zpath(str(file_path.as_posix())))
if gz_file_path.exists():
file_paths[file] = gz_file_path
else:
Expand All @@ -86,7 +86,7 @@ def get_structure_path(lobster_path: Path) -> Path:
poscar_path = lobster_path / filename
if poscar_path.exists():
return poscar_path
gz_file_path = Path(zpath(poscar_path))
gz_file_path = Path(zpath(str(poscar_path.as_posix())))
if gz_file_path.exists():
return gz_file_path

Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,12 @@ no_implicit_optional = false
[tool.codespell]
ignore-words-list = "titel,alls,ans,nd,mater,nwo,te,hart,ontop,ist,ot,fo"
check-filenames = true

[tool.pyright]
typeCheckingMode = "off"
reportPossiblyUnboundVariable = false
reportUnboundVariable = true
reportMissingImports = false
reportMissingModuleSource = false
reportInvalidTypeForm = false
exclude = ["**/tests"]
2 changes: 1 addition & 1 deletion tests/cohp/test_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def test_warnings(self):
potcar_symbols=["C"],
bva_comp=True,
)
assert "Oxidation states from BVA analyzer cannot" in str(w2[0].message)
assert "Oxidation states from BVA analyzer cannot" in str(w2[-1].message)

calc_des2 = Description.get_calc_quality_description(calc_quality_warnings2)

Expand Down
Loading