Skip to content

Commit

Permalink
Test multiple python versions (#78)
Browse files Browse the repository at this point in the history
* Test multiple python versions
* Update dependencies
* Fix code for Python 3.11
  • Loading branch information
martin-schlipf authored Feb 17, 2023
1 parent c9aaaed commit 69d3132
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 112 deletions.
153 changes: 77 additions & 76 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
name: tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry --version
poetry install
- name: Test with pytest
run: |
poetry run pytest --version
poetry run pytest --cov=py4vasp --cov-report term
- name: Check code style
run: |
poetry run isort --version
poetry run isort --check src
poetry run isort --check tests
poetry run black --version
poetry run black --check src
poetry run black --check tests
test-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
- name: Install dependencies with conda
run: |
conda info
conda install -c conda-forge mdtraj
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry --version
- name: Install py4vasp
run: |
poetry config virtualenvs.create false --local
poetry install
- name: Test with pytest
run: |
poetry run pytest --version
poetry run pytest --cov=py4vasp --cov-report term
- name: Check code style
run: |
poetry run isort --version
poetry run isort --check src
poetry run isort --check tests
poetry run black --version
poetry run black --check src
poetry run black --check tests
name: tests

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10"]

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
run: |
python -m pip install --upgrade pip
pip install poetry
poetry --version
poetry install
- name: Test with pytest
run: |
poetry run pytest --version
poetry run pytest --cov=py4vasp --cov-report term
- name: Check code style
run: |
poetry run isort --version
poetry run isort --check src
poetry run isort --check tests
poetry run black --version
poetry run black --check src
poetry run black --check tests
test-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
- name: Install dependencies with conda
run: |
conda info
conda install -c conda-forge mdtraj
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry --version
- name: Install py4vasp
run: |
poetry config virtualenvs.create false --local
poetry install
- name: Test with pytest
run: |
poetry run pytest --version
poetry run pytest --cov=py4vasp --cov-report term
- name: Check code style
run: |
poetry run isort --version
poetry run isort --check src
poetry run isort --check tests
poetry run black --version
poetry run black --check src
poetry run black --check tests
63 changes: 33 additions & 30 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ h5py = ">=3.7.0"
pandas = ">=1.4.3"
nglview = ">=3.0.3"
ase = ">=3.22.1"
mdtraj = "!=1.9.7,>=1.9.6"
mdtraj = ">=1.9.6"
mrcfile = ">=1.3.0"
plotly = ">=5.9.0"
kaleido = "!=0.2.1.post1,>=0.2.1"
Expand Down
14 changes: 9 additions & 5 deletions src/py4vasp/_raw/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from py4vasp._raw.data_wrapper import VaspData


def NONE():
return dataclasses.field(default_factory=lambda: VaspData(None))


@dataclasses.dataclass(order=True, frozen=True)
class Version:
"The version number of VASP."
Expand Down Expand Up @@ -36,7 +40,7 @@ class Band:
"The occupations of the different bands."
projectors: Projector
"Projector information (element, angular momentum, spin)."
projections: VaspData = VaspData(None)
projections: VaspData = NONE()
"If present, orbital projections of the bands."


Expand Down Expand Up @@ -92,7 +96,7 @@ class DielectricFunction:
"The energies at which the dielectric function is evaluated."
dielectric_function: VaspData
"The values of the dielectric function (frequency-dependent 3x3 tensor)."
current_current: VaspData = VaspData(None)
current_current: VaspData = NONE()
"Dielectric function obtained using the current-current response."


Expand Down Expand Up @@ -141,7 +145,7 @@ class Dos:
"Fermi energy obtained by VASP."
projectors: Projector
"Projector information (element, angular momentum, spin)."
projections: VaspData = VaspData(None)
projections: VaspData = NONE()
"If present, orbital projections of the Dos."


Expand Down Expand Up @@ -248,9 +252,9 @@ class Kpoint:
"Weight of the **k** points used for integration."
cell: Cell
"Unit cell of the crystal."
labels: VaspData = VaspData(None)
labels: VaspData = NONE()
"High symmetry label for specific **k** points used in band structures."
label_indices: VaspData = VaspData(None)
label_indices: VaspData = NONE()
"Indices of the labeled **k** points in the generation list."


Expand Down

0 comments on commit 69d3132

Please sign in to comment.