Skip to content

Commit

Permalink
Merge pull request #137 from JuDFTteam/release-0.9.0
Browse files Browse the repository at this point in the history
🚀 Release `0.9.0`
  • Loading branch information
janssenhenning authored Mar 30, 2022
2 parents 58e8f0d + 6c781bc commit b113747
Show file tree
Hide file tree
Showing 185 changed files with 61,869 additions and 4,966 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-docs-${{ hashFiles('**/setup.json') }}
key: pip-docs-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-docs-
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
key: pip-pre-commit-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-pre-commit-
Expand All @@ -97,6 +97,7 @@ jobs:
strategy:
matrix:
python-version: ['3.10','3.9', '3.8', '3.7']
fail-fast: false

steps:
- uses: actions/checkout@v2
Expand All @@ -106,7 +107,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-${{ matrix.python-version }}-tests
Expand All @@ -129,10 +130,10 @@ jobs:
codecov
- uses: actions/upload-artifact@v2
if: failure()
with:
name: Matplotlib comparison
path: mpl-results/fig_comparison.html
if-no-files-found: ignore
name: matplotlib-comparison-${{ matrix.python-version }}
path: mpl-results

publish:
name: Publish to PyPi
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-docs-${{ hashFiles('**/setup.json') }}
key: pip-docs-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-docs-
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-pre-commit-${{ hashFiles('**/setup.json') }}
key: pip-pre-commit-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-pre-commit-
Expand Down Expand Up @@ -93,6 +93,7 @@ jobs:
matrix:
python-version: ['3.10','3.9', '3.8', '3.7']
experimental: [false]
fail-fast: false

name: tests-python-${{ matrix.python-version }}
continue-on-error: ${{ matrix.experimental }}
Expand All @@ -105,7 +106,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
pip-${{ matrix.python-version }}-tests
Expand All @@ -128,7 +129,7 @@ jobs:
codecov
- uses: actions/upload-artifact@v2
if: failure()
with:
name: Matplotlib comparison
path: mpl-results/fig_comparison.html
if-no-files-found: ignore
name: matplotlib-comparison-${{ matrix.python-version }}
path: mpl-results
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: check-added-large-files
- id: forbid-new-submodules

- repo: git://github.com/pre-commit/mirrors-yapf
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
Expand Down
41 changes: 37 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
# Changelog

# v.0.8.0
## v.0.9.0
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.8.0...v0.9.0)

### Added
- New `bokeh` plot routine for matrix plot of rectangle patches with added texts [[#124]](https://github.com/JuDFTteam/masci-tools/pull/124)
- Added TS contribution to free energy to output of `outxml_parser`

### Improvements
- Several arguments in XML setter functions were renamed for more consistent signatures.
The main changes are
- `attributedict`/`change_dict` -> `changes`
- `attributename`/`attribv` -> `name`/`value`
- `add_number` -> `number_to_add`

The old signatures are still supported with deprecations if called via the `FleurXMLModifier` [[#118]](https://github.com/JuDFTteam/masci-tools/pull/118)
- Remove constraint on `bokeh` version (previously `<=1.4.0`) [[#122]](https://github.com/JuDFTteam/masci-tools/pull/122)
- Add `only_spin` option and calculate complete non-spinpolarized DOS for `spinpol=False` in `plot_fleur_dos` [[#125]](https://github.com/JuDFTteam/masci-tools/pull/125)
- Refactored `CFCalculation`, i.e. naming of attributes handling of cutoffs. Added classmethod to construct instance directly from numpy arrays [[#127]](https://github.com/JuDFTteam/masci-tools/pull/127)
- Refactored plotting methods for `CFCalculation` to allow the same parameter freedom as for the other matplolib routines [[#127]](https://github.com/JuDFTteam/masci-tools/pull/127)
- Improvement to labels and legends in DOS/bandstructure plots. Matplotlib plots now put the legend centered below the plot and added latex labels to axis and ticks in bokeh (version `2.4.0` needed) [[#133]](https://github.com/JuDFTteam/masci-tools/pull/133)
- `io_nmmpmat`: Allow negative indices in `read_nmmpmat_block` and raise error for invalid index
### Bugfixes
- Fix for signatures of `set_text`/`set_first_text`. These contained names of attribute setting functions [[#118]](https://github.com/JuDFTteam/masci-tools/pull/118)
- Fix for validating arguments in `FleurXMLModifier` not accepting an argument named `name` when passed by keyword. [[#118]](https://github.com/JuDFTteam/masci-tools/pull/118)
- Fixed problems in `masci_tools.testing.bokeh` when adding files for new bokeh versions [[#122]](https://github.com/JuDFTteam/masci-tools/pull/122)
- Several fixes for `plot_fleur_dos`. Using the `area_plot` or specifying `color` explicitely could mess up the color order [[#132]](https://github.com/JuDFTteam/masci-tools/pull/132)
- Fixed bug in `validate_nmmpmat` and consequently `FleurXMLModifier` not correctly validating denisty matrix files with certain off-diagonal elements being negative [[#135]](https://github.com/JuDFTteam/masci-tools/pull/135)
- Fix for `HDF5Reader` for compatibility for file handles in `aiida-core` 2.0. The file handles coming from the file repository have no directly attached extension so the check if the file is a hdf file cannot be performed

### For developers
- Fixed upload of pytest-mpl results artifacts to include the whole directory with images and not just the HTML file [[#117]](https://github.com/JuDFTteam/masci-tools/pull/117)
- Updated typing to newer version of `lxml-stubs` (`0.4.0`) [[#123]](https://github.com/JuDFTteam/masci-tools/pull/123)

## v.0.8.0
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.7.2...v0.8.0)

### Added
Expand Down Expand Up @@ -29,13 +62,13 @@
- Reorganized visualization tests, making the regeneration of baseline images with `pytest-mpl` easier [[#101]](https://github.com/JuDFTteam/masci-tools/pull/101)
- Switched build system from `setuptools` to `flit`, since this way all the configuration can be specified in the `pyproject.toml` and a lot of duplication of information is avoided (e.g. version numbers) [[#102]](https://github.com/JuDFTteam/masci-tools/pull/102)

# v.0.7.2
## v.0.7.2
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.7.1...v0.7.2)

### Bugfixes
- Fixed regression in ``set_atomgroup_label`` and ``set_species_label``. These functions could be used in previous versions with atom labels, that do not exist. This is not possible in ``v.0.7.1``. Since some parts of the ``aiida-fleur`` plugin relied on this the behaviour has to be kept.

# v.0.7.1
## v.0.7.1
[full changelog](https://github.com/JuDFTteam/masci-tools/compare/v0.7.0...v0.7.1)

### Added
Expand Down Expand Up @@ -190,7 +223,7 @@ This release contains bugifxes for the visualization routines
- Tool to analyze/work with greensfunctions calculated by Fleur `masci_tools.tools.greensfunction`
### Improvements
- Several improvements of KKR parsers/parameters [[#13]](https://github.com/JuDFTteam/masci-tools/pull/13)
- Introduced patching functions for the schema dictionaries to manually correct ambiguities (#48)
- Introduced patching functions for the schema dictionaries to manually correct ambiguities [[#48]](https://github.com/JuDFTteam/masci-tools/pull/48)
- Improvements of the `HDF5Reader` and recipes for Fleur DOS/bandstructure calculation
- For devs:
- pylint warnings are no longer fatal for the CI jobs
Expand Down
14 changes: 7 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
extensions = ['myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
Expand All @@ -45,14 +46,13 @@
'lxml': ('https://lxml.de/apidoc/',None),
'h5py': ('https://docs.h5py.org/en/latest/', None)}

myst_enable_extensions = []

todo_include_todos = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

Expand Down Expand Up @@ -395,15 +395,15 @@
('py:obj', 'bool'),
('py:obj', 'Mapping'),
('py:obj', 'plum'),
('py:class', 'etree._xpath'),
('py:class', 'etree._DictAnyStr'),
('py:class', 'etree._XPathObject'),
('py:class', 'etree._XPathEvaluatorBase'),
('py:class', 'h5py._hl.group.Group'),
('py:class', 'etree._Element'),
('py:class', 'etree.XPath'),
('py:class', 'TypeAlias'),
('py:class', 'Logger'),
('py:class', 'FilterType'),
('py:class', 'XMLLike'),
('py:class', 'etree.XPathElementEvaluator'),
]


Expand Down
9 changes: 8 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ Module reference (API)
:maxdepth: 4

module_guide/mg_index


Reference
##########

.. toctree::
:maxdepth: 2

reference/index


Indices and tables
Expand Down
4 changes: 4 additions & 0 deletions docs/source/reference/_changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```{include} ../../../CHANGELOG.md
:relative-docs: docs/
:relative-images:
```
7 changes: 7 additions & 0 deletions docs/source/reference/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Reference
==========

.. toctree::
:maxdepth: 2

_changelog.md
2 changes: 1 addition & 1 deletion masci_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
__copyright__ = ('Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. '
'All rights reserved.')
__license__ = 'MIT license, see LICENSE.txt file.'
__version__ = '0.8.0'
__version__ = '0.9.0'
__authors__ = 'The JuDFT team. Also see AUTHORS.txt file.'

logging.getLogger(__name__).addHandler(logging.NullHandler())
2 changes: 1 addition & 1 deletion masci_tools/cmdline/commands/fleur_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def add_fleur_schema(schema_file, test_xml_file, overwrite, branch, api_key, fro
project.files.raw(file_path=f'io/xml/{file_name}', ref=branch, streamed=True, action=f.write)
echo.echo_success('Download successful')

xmlschema = etree.parse(os.fspath(schema_file))
xmlschema = etree.parse(schema_file)
xmlschema, _ = clear_xml(xmlschema)

namespaces = {'xsd': 'http://www.w3.org/2001/XMLSchema'}
Expand Down
23 changes: 12 additions & 11 deletions masci_tools/io/common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
from __future__ import annotations

import io
from typing import IO, Any, Generator, Iterable, NamedTuple, TypeVar
try:
from typing import TypeAlias #type:ignore
except ImportError:
from typing import IO, Any, Generator, Iterable, NamedTuple, TypeVar, Union, Tuple, List
import sys
if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
from typing_extensions import TypeAlias
import numpy as np
from collections.abc import Sequence
Expand Down Expand Up @@ -47,9 +48,9 @@ def open_general(filename_or_handle: FileLike, iomode: str | None = None) -> IO[
if reopen_file:
if iomode is None:
iomode = 'r'
f = open(filename_or_handle, iomode, encoding='utf8')
f = open(filename_or_handle, iomode, encoding='utf8') #type:ignore[arg-type]
else:
f = filename_or_handle
f = filename_or_handle #type:ignore[assignment]
if f.closed: # reopen file if it was closed before
if iomode is None:
f = open(f.name, f.mode, encoding='utf8')
Expand Down Expand Up @@ -446,9 +447,9 @@ def is_sequence(arg: Any) -> bool:
return isinstance(arg, Sequence) and not isinstance(arg, str)


_TVectorType = TypeVar('_TVectorType', 'tuple[float, float, float]', 'list[float]', np.ndarray)
VectorType: TypeAlias = Union[Tuple[float, float, float], List[float], np.ndarray]
_TVectorType = TypeVar('_TVectorType', bound=VectorType)
"""Generic type variable for atom position types"""
VectorType: TypeAlias = 'tuple[float, float, float] | list[float] | np.ndarray'


def abs_to_rel(vector: _TVectorType, cell: list[list[float]] | np.ndarray) -> _TVectorType:
Expand Down Expand Up @@ -476,7 +477,7 @@ def abs_to_rel(vector: _TVectorType, cell: list[list[float]] | np.ndarray) -> _T
return relative_vector.tolist()
if isinstance(vector, tuple):
return tuple(relative_vector) #type:ignore
return relative_vector
return relative_vector #type:ignore[return-value]


def abs_to_rel_f(vector: _TVectorType, cell: list[list[float]] | np.ndarray, pbc: tuple[bool, bool,
Expand Down Expand Up @@ -514,7 +515,7 @@ def abs_to_rel_f(vector: _TVectorType, cell: list[list[float]] | np.ndarray, pbc
return relative_vector.tolist()
if isinstance(vector, tuple):
return tuple(relative_vector) #type:ignore
return relative_vector
return relative_vector #type:ignore[return-value]


def rel_to_abs(vector: _TVectorType, cell: list[list[float]] | np.ndarray) -> _TVectorType:
Expand Down Expand Up @@ -572,7 +573,7 @@ def rel_to_abs_f(vector: _TVectorType, cell: list[list[float]] | np.ndarray) ->
return absolute_vector.tolist()
if isinstance(vector, tuple):
return tuple(absolute_vector) #type:ignore
return absolute_vector
return absolute_vector #type:ignore[return-value]


def find_symmetry_relation(from_pos: VectorType,
Expand Down
6 changes: 3 additions & 3 deletions masci_tools/io/fleur_inpgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def write_inpgen_file(cell: np.ndarray | list[list[float]],
if isinstance(file, io.IOBase):
file.write(inpgen_file_content_str)
else:
with open(file, 'w', encoding='utf-8') as inpfile:
with open(file, 'w', encoding='utf-8') as inpfile: #type:ignore[arg-type]
inpfile.write(inpgen_file_content_str)

return inpgen_file_content_str
Expand Down Expand Up @@ -493,8 +493,8 @@ def read_inpgen_file(
if isinstance(file, io.IOBase):
contents = file.read()
else:
if os.path.exists(file):
with open(file, encoding='utf-8') as f:
if os.path.exists(file): #type:ignore[arg-type]
with open(file, encoding='utf-8') as f: #type:ignore[arg-type]
contents = f.read()
else:
contents = file
Expand Down
Loading

0 comments on commit b113747

Please sign in to comment.