Skip to content

Commit

Permalink
Finish 0.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-eschle committed Jul 13, 2023
2 parents 55e1cb0 + 23dd82c commit 7743b95
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.8.6
- uses: pypa/gh-action-pypi-publish@v1.8.7
with:
password: ${{ secrets.PYPI_ZFIT_TOKEN }}
35 changes: 22 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
unittests:
runs-on: ${{ matrix.os }}
timeout-minutes: 180 # for eager mode
timeout-minutes: 240 # for eager mode
name: tests on ${{ matrix.os }} with ${{ matrix.python-version }} compiled = ${{ matrix.use-graph }}
env:
ZFIT_DO_JIT: ${{ matrix.use-graph }}
Expand All @@ -50,6 +50,9 @@ jobs:
extras: alldev-windows

steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
run: |
Expand All @@ -75,22 +78,25 @@ jobs:
# move coverage-lcov to requirements once https://github.com/TheCleric/coverage-lcov/issues/6 resolved
run: |
python -m pip install --upgrade pip
pip install coverage-lcov
pip install coverage-lcov pytest-xdist pytest-cov
pip install .[${{ matrix.extras }}]
- name: Test with pytest
# TODO: maybe reactivate long tests?
# if [ "$GITHUB_REF" == 'refs/heads/develop' ]; then
# echo "PYTEST_ADDOPTS=--longtests-kde --longtests" >> "$GITHUB_ENV"
# fi
run: |
coverage run --source=. --omit=".tox/*,*/test*,*/minimizers/interface.py,*/core/testing.py" --branch -m pytest .
mkdir coverage && coverage-lcov --output_file_path ./coverage/lcov.info
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2.1.2
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.use-graph }}-${{ matrix.python-version }}-ubuntu
parallel: true
pytest --cov=. --cov-config=pyproject.toml -n${{ steps.cpu-cores.outputs.count }}
# convert to lcov format
# mkdir coverage && coverage-lcov --output_file_path ./coverage/lcov.info
# TODO(jonas): fix coverage report? Needs converter to lcov format
# - name: Coveralls Parallel
# uses: coverallsapp/github-action@v2.2.0
# with:
# github-token: ${{ secrets.github_token }}
# flag-name: run-${{ matrix.use-graph }}-${{ matrix.python-version }}-ubuntu
# parallel: true
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down Expand Up @@ -141,6 +147,9 @@ jobs:
env:
ZFIT_DO_JIT: ${{ matrix.use-graph }}
steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- uses: actions/checkout@v3
- name: Get history and tags for SCM versioning to work
run: |
Expand Down Expand Up @@ -172,13 +181,13 @@ jobs:
python -m pip install --upgrade pip
pip install wheel
pip install -U .[all]
pip install nbval pytest-helpers-namespace
pip install nbval pytest-helpers-namespace pytest-xdist
pip install -r zfit-tutorials/requirements.txt
pip install -U --force-reinstall .[all] # yep. Needed. Otherwise i.e. numpy needs to be upgraded
- name: Run notebooks
run: |
pytest --nbval-lax zfit-tutorials --ignore=zfit-tutorials/experimental --ignore=zfit-tutorials/_unused --ignore=zfit-tutorials/_website --ignore=zfit-tutorials/
pytest --nbval-lax zfit-tutorials --dist loadscope --ignore=zfit-tutorials/experimental --ignore=zfit-tutorials/_unused --ignore=zfit-tutorials/_website -n${{ steps.cpu-cores.outputs.count }}
examples:
runs-on: ubuntu-latest
timeout-minutes: 60
Expand Down Expand Up @@ -222,7 +231,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2.1.2
uses: coverallsapp/github-action@v2.2.0
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
additional_dependencies: [ pyyaml ]

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.2
rev: v1.7.3
hooks:
- id: docformatter
args: [ -r, --in-place, --wrap-descriptions, '120', --wrap-summaries, '120', --pre-summary-space, --black, -- ]
Expand Down Expand Up @@ -65,7 +65,7 @@ repos:
# args: [ --py36-plus ] # TODO: change fro 3.8? type annotations fail...

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.3.0
rev: v2.4.0
hooks:
- id: setup-cfg-fmt
args: [ --max-py-version=3.10, --include-version-classifiers ]
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Changelog
.. _newest-changelog:



Develop
========================

Expand All @@ -31,6 +30,21 @@ Requirement changes
Thanks
------


0.15.0 (13 July 2023)
========================

Update to TensorFlow 2.13.x

Requirement changes
-------------------
- TensorFlow upgraded to ~=2.13.0
- as TF 2.13.0 ships with the arm64 macos wheels, the requirement of ``tensorflow_macos`` is removed

Thanks
------
- Iason Krommydas for helping with the macos requirements for TF

0.14.1 (1 July 2023)
========================

Expand Down
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,32 @@ markers = [
]
console_output_style = "progress"
collect_ignore = "setup.py"

[tool.coverage.run]
branch = true
relative_files = true
omit = [
# omit anything in a .local directory anywhere
".tox/*",
"*/test*",
"*minimizers/interface.py",
"*/core/testing.py",
]

[tool.coverage.report]
# fails in CI? not known config?
## Regexes for lines to exclude from consideration
#exclude_also = [
# # Don't complain if tests don't hit defensive assertion code:
# "raise AssertionError",
# "raise NotImplementedError",
# # Don't complain if non-runnable code isn't run:
# "if __name__ == .__main__.:",
# # Don't complain about abstract methods, they aren't run:
# "@(abc\\.)?abstractmethod",
#]

ignore_errors = true

[tool.coverage.html]
directory = "coverage_html_report"
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ pydantic<2.0.0 # fails with not a "subclass", won't fix
pyyaml
scipy>=1.2
tabulate
tensorflow>=2.12, <2.13; sys_platform != 'darwin' or platform_machine != 'arm64'
tensorflow-macos>=2.11, <2.13; sys_platform == 'darwin' and platform_machine == 'arm64'
tensorflow_probability>=0.20, <0.21
tensorflow>=2.13, <2.14 # don't relax to 2.12, because macos wheels are missing
tensorflow_probability>=0.20, <0.22
texttable
typing_extensions; python_version <"3.9.0"
uhi
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def cleanup_recursive(dict1, dict2):
for key in set(dict1.keys()) | set(dict2.keys()):
val1 = dict1.get(key)
val2 = dict2.get(key)
if val1 == ARBITRARY_VALUE:
if isinstance(val1, str) and val1 == ARBITRARY_VALUE:
dict2[key] = ARBITRARY_VALUE
elif val2 == ARBITRARY_VALUE:
elif isinstance(val2, str) and val2 == ARBITRARY_VALUE:
dict1[key] = ARBITRARY_VALUE
elif isinstance(val1, collections.abc.Mapping) or isinstance(
val2, collections.abc.Mapping
Expand Down
10 changes: 9 additions & 1 deletion zfit/core/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ def histdd(sample, bins, range, weights):
new_kwargs = {}
for key, value in kwargs.items():
value = value
if value == b"NONE_TENSOR":
is_empty = value == b"NONE_TENSOR"
try:
is_empty = bool(is_empty)
except (
ValueError
): # if it's a numpy array we need the "all" method, otherwise it's ambiguous
is_empty = is_empty.all()

if is_empty:
value = None

new_kwargs[key] = value
Expand Down
2 changes: 1 addition & 1 deletion zfit/core/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def register_tensor_conversion(
def _dense_var_to_tensor(var, dtype=None, name=None, as_ref=False):
return var._dense_var_to_tensor(dtype=dtype, name=name, as_ref=as_ref)

ops.register_tensor_conversion_function(
tf.register_tensor_conversion_function(
convertable, _dense_var_to_tensor, priority=priority
)
if name:
Expand Down
19 changes: 12 additions & 7 deletions zfit/models/kde.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,13 +1256,18 @@ def __init__(
if num_grid_points is None:
num_grid_points = self._default_num_grid_points

if bandwidth == "isj":
raise ValueError("isj not supported in GridKDE, use directly 'KDE1DimISJ'")
if bandwidth == "adaptive_std":
raise ValueError(
"adaptive_std not supported in GridKDE due to very bad results. This is maybe caused"
" by an issue regarding weights of the underlaying implementation."
)
if isinstance(
bandwidth, str
): # numpy arrays cannot be compared with equal-> "use any, all"
if bandwidth == "isj":
raise ValueError(
"isj not supported in GridKDE, use directly 'KDE1DimISJ'"
)
if bandwidth == "adaptive_std":
raise ValueError(
"adaptive_std not supported in GridKDE due to very bad results. This is maybe caused"
" by an issue regarding weights of the underlaying implementation."
)

if padding is None:
padding = self._default_padding
Expand Down

0 comments on commit 7743b95

Please sign in to comment.