Skip to content

Commit

Permalink
Merge pull request #145 from ing-bank/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sbrugman committed Oct 4, 2021
2 parents b34df69 + 1dea7c4 commit b82ed51
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 63 deletions.
5 changes: 1 addition & 4 deletions .pre-commit-config.yaml
Expand Up @@ -17,10 +17,7 @@ repos:
- flake8-comprehensions
args: [ "--select=E9,F63,F7,F82,C4"]
- repo: https://github.com/asottile/pyupgrade
rev: v2.26.0
rev: v2.29.0
hooks:
- id: pyupgrade
args: ['--py36-plus','--exit-zero-even-if-changed']

ci:
autoupdate_commit_msg: 'ci: pre-commit-config update'
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,4 +1,12 @@
# Release notes

## [v0.4.3](https://github.com/ing-bank/popmon/compare/v0.4.2...v0.4.3) (2021-10-04)


### 🐛 Bug fixes

* fix too restrictive numpy integer check in hist_stitcher ([c162f11](https://github.com/ing-bank/popmon/commits/c162f11a68a6d8aaf82cb9fd8365f018cbc2feb6))

## [Version 0.4.2](https://github.com/ing-bank/popmon/compare/v0.4.1...v0.4.2) (2021-08-25)

### ⬆️ Dependencies
Expand Down
37 changes: 37 additions & 0 deletions bump.py
@@ -0,0 +1,37 @@
import re
from pathlib import Path

MAJOR = 0
REVISION = 4
PATCH = 3
VERSION = f"{MAJOR}.{REVISION}.{PATCH}"


def write_version_py(filename: str = "popmon/version.py") -> None:
"""Write package version to version.py.
This will ensure that the version in version.py is in sync with us.
:param filename: The version.py to write too.
:type filename: str
"""
# Do not modify the indentation of version_str!
version_str = f"""\"\"\"THIS FILE IS AUTO-GENERATED BY SETUP.PY.\"\"\"
version = \"{VERSION:s}\"
"""

with open(filename, "w") as version_file:
version_file.write(version_str)


def update_setup_py(filename="setup.py"):
contents = Path(filename).read_text()
contents = re.sub(
r'version="[0-9]+\.[0-9]+\.[0-9]+[A-Za-z]*",', f'version="{VERSION}",', contents
)
Path(filename).write_text(contents)


write_version_py()
update_setup_py()
3 changes: 2 additions & 1 deletion package.json
@@ -1,6 +1,7 @@
{
"scripts": {
"release": "standard-version"
"release": "standard-version",
"bump": "python bump.py"
},
"standard-version": {
"skip": {
Expand Down
6 changes: 3 additions & 3 deletions popmon/stitching/hist_stitcher.py
Expand Up @@ -218,7 +218,7 @@ def stitch_histograms(
)
if time_bin_idx is None:
raise ValueError(
"Request to insert delta hists but time_bin_idx not set. Please do."
"Request to insert delta hists but time_bin_idx not set or deductable. Please set manually."
)
self.logger.info(
f'Inserting delta histograms in axis "{time_axis}" at bin indices {time_bin_idx}.'
Expand Down Expand Up @@ -310,7 +310,7 @@ def _generate_time_bin_idx(self, hists_basis, features_basis, time_axis, n):
if max_time_bin_idx is not None:
self.logger.info(f"Maximum time bin index found: {max_time_bin_idx}")
time_bin_idx = None
if isinstance(max_time_bin_idx, (int, np.int64)):
if isinstance(max_time_bin_idx, (int, np.integer)):
start = max_time_bin_idx + 1
stop = start + n
time_bin_idx = np.arange(start, stop)
Expand Down Expand Up @@ -351,7 +351,7 @@ def _insert_hists(self, hbasis, hdelta_list, time_bin_idx, mode):
if isinstance(time_bin_idx[0], str):
if not isinstance(hbasis, hg.Categorize):
raise TypeError("hbasis does not accept string time-values.")
elif isinstance(time_bin_idx[0], (int, np.int64)):
elif isinstance(time_bin_idx[0], (int, np.integer)):
if not isinstance(hbasis, hg.SparselyBin):
raise TypeError("hbasis does not accept integer time-values.")

Expand Down
5 changes: 1 addition & 4 deletions popmon/version.py
@@ -1,6 +1,3 @@
"""THIS FILE IS AUTO-GENERATED BY SETUP.PY."""

name = "popmon"
version = "0.4.2"
full_version = "0.4.2"
release = True
version = "0.4.3"
4 changes: 2 additions & 2 deletions popmon/visualization/report_generator.py
Expand Up @@ -22,7 +22,7 @@

from ..base import Module
from ..resources import templates_env
from ..version import name, version
from ..version import version


class ReportGenerator(Module):
Expand Down Expand Up @@ -54,7 +54,7 @@ def transform(self, datastore):
datastore[self.store_key] = htmlmin.minify(
templates_env(
filename="core.html",
generator=f"{name} {version}",
generator=f"popmon {version}",
sections=sections_html,
)
)
Expand Down
51 changes: 2 additions & 49 deletions setup.py
@@ -1,68 +1,21 @@
from setuptools import find_packages, setup

NAME = "popmon"

MAJOR = 0
REVISION = 4
PATCH = 2
DEV = False
# NOTE: also update version at: README.rst

with open("requirements.txt") as f:
REQUIREMENTS = f.read().splitlines()

# read the contents of abstract file
with open("README.rst", encoding="utf-8") as f:
long_description = f.read()

VERSION = "{major}.{revision}.{patch}".format(
major=MAJOR, revision=REVISION, patch=PATCH
)
FULL_VERSION = VERSION
if DEV:
FULL_VERSION += ".dev"
with open("requirements-test.txt") as f:
REQUIREMENTS += f.read().splitlines()


def write_version_py(filename: str = "popmon/version.py") -> None:
"""Write package version to version.py.
This will ensure that the version in version.py is in sync with us.
:param filename: The version.py to write too.
:type filename: str
"""
# Do not modify the indentation of version_str!
version_str = """\"\"\"THIS FILE IS AUTO-GENERATED BY SETUP.PY.\"\"\"
name = \"{name!s}\"
version = \"{version!s}\"
full_version = \"{full_version!s}\"
release = {is_release!s}
"""

with open(filename, "w") as version_file:
version_file.write(
version_str.format(
name=NAME.lower(),
version=VERSION,
full_version=FULL_VERSION,
is_release=not DEV,
)
)


def setup_package() -> None:
"""The main setup method.
It is responsible for setting up and installing the package.
"""
write_version_py()

setup(
name=NAME,
version=VERSION,
name="popmon",
version="0.4.3",
url="https://github.com/ing-bank/popmon",
license="MIT",
author="ING Wholesale Banking Advanced Analytics",
Expand Down

0 comments on commit b82ed51

Please sign in to comment.