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

Use trusted publishing for pypi #57

Merged
merged 6 commits into from
Jan 2, 2025
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
22 changes: 22 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[flake8]
show-source = True
max-complexity = 10
hang-closing = False
max-line-length = 88
extend-select =
B950

extend-ignore =
E203
E501

extend-exclude =
.git
__pycache__
build
dist
doc

per-file-ignores =
__init__.py: F401
gutenTAG/api/*: F401
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build-source-distribution, build-manylinux-wheels]
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- name: Download packages
Expand All @@ -154,7 +158,4 @@ jobs:
find dist -type f -exec mv {} dist/ \;
find dist/* -type d -exec rmdir {} \; || true
- name: Publish package to PyPi
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
uses: pypa/[email protected]
2 changes: 1 addition & 1 deletion generation_configs/multivariate-test-cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def gen_bo_diversity_series():
for bo, times in zip(bo_tuple, times_mapping[i]):
bo_defs.extend(random_bo(bo) for _ in range(times))
for anom_pos in range(i):
pos_begin = np.sum(times_mapping[i][:anom_pos], dtype=np.int_)
pos_begin = np.sum(times_mapping[i][:anom_pos], dtype=np.int32)
pos_end = pos_begin + times_mapping[i][anom_pos]
pos = np.random.randint(pos_begin, pos_end)
timeseries.append(
Expand Down
2 changes: 1 addition & 1 deletion gutenTAG/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "1.4.1"
__version__: str = "1.4.2"
8 changes: 4 additions & 4 deletions gutenTAG/addons/timeeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _process_timeseries(
dataset["trend"] = (
config.get(BASE_OSCILLATION, {})
.get(PARAMETERS.TREND, {})
.get(PARAMETERS.KIND, np.NAN)
.get(PARAMETERS.KIND, np.nan)
)
dataset["period_size"] = TimeEvalAddOn._calc_period_size(
config.get(BASE_OSCILLATION, config.get(BASE_OSCILLATIONS, [{}])),
Expand All @@ -142,8 +142,8 @@ def _set_global_vals(df: pd.DataFrame) -> None:
df["collection_name"] = "GutenTAG"
df["dataset_type"] = "synthetic"
df["datetime_index"] = False
df["split_at"] = np.NAN
df["stationarity"] = np.NAN
df["split_at"] = np.nan
df["stationarity"] = np.nan

@staticmethod
def _calc_contamination(anomalies: Iterable[Dict], ts_length: int) -> float:
Expand Down Expand Up @@ -180,7 +180,7 @@ def _calc_period_size(
BASE_OSCILLATION_NAMES.DIRICHLET,
BASE_OSCILLATION_NAMES.MLS,
]:
periods.append(np.NAN)
periods.append(np.nan)
elif kind in [
BASE_OSCILLATION_NAMES.SINE,
BASE_OSCILLATION_NAMES.COSINE,
Expand Down
4 changes: 2 additions & 2 deletions gutenTAG/base_oscillations/custom_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def generate_only_base(
"Number of rows in the input timeseries file is less than the desired length"
)
col_type = df.dtypes[0]
if col_type != np.float_:
df = df.astype(np.float_)
if col_type != np.float64:
df = df.astype(np.float64)
warnings.warn(
f"Input data was of {col_type} type and has been automatically converted to float."
)
Expand Down
8 changes: 4 additions & 4 deletions gutenTAG/generator/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
if isinstance(
obj,
(
np.int_,
int,
np.intc,
np.intp,
np.int8,
Expand All @@ -37,16 +37,16 @@
):
return int(obj)

elif isinstance(obj, (np.float_, np.float16, np.float32, np.float64)):
elif isinstance(obj, (float, np.float16, np.float32, np.float64)):
return float(obj)

elif isinstance(obj, (np.complex_, np.complex64, np.complex128)):
elif isinstance(obj, (np.complex64, np.complex128, np.complex256)):
return {"real": obj.real, "imag": obj.imag}

elif isinstance(obj, (np.ndarray,)):
return obj.tolist()

elif isinstance(obj, (np.bool_)):
elif isinstance(obj, (bool, np.bool8)):

Check warning on line 49 in gutenTAG/generator/overview.py

View check run for this annotation

Codecov / codecov/patch

gutenTAG/generator/overview.py#L49

Added line #L49 was not covered by tests
return bool(obj)

elif isinstance(obj, (np.void)):
Expand Down
66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[project]
name = "timeeval-GutenTAG"
description = "A good Timeseries Anomaly Generator."
license = {file="LICENSE"}
authors= [
{"name" = "Phillip Wenig", email = "[email protected]"},
{"name" = "Sebastian Schmidl", email = "[email protected]"}
]
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Typing :: Typed",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
]
dynamic = ["readme", "version", "requires-python", "scripts", "dependencies"]

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = false
parallel = true
omit = ["**/__main__.py"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"\\.\\.\\.",
"def __repr__",
"pass",
"if __name__ == .__main__.:",
]
fail_under = 80
skip_covered = true
sort = "Cover"

[tool.mypy]
python_version = "3.9"
show_error_codes = true

[[tool.mypy.overrides]]
module = [
"sklearn.*",
"matplotlib.*",
"pandas.*",
"tqdm.*",
"psutil.*",
"prts.*",
"statsmodels.*",
"joblib.*",
"numpyencoder.*",
"scipy.*",
"neurokit2.*"
]
ignore_missing_imports = true
76 changes: 0 additions & 76 deletions setup.cfg

This file was deleted.

19 changes: 0 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,9 @@ def run(self):
setup(
name=f"timeeval-{PYTHON_NAME}",
version=VERSION,
description="A good Timeseries Anomaly Generator.",
long_description=README,
long_description_content_type="text/markdown",
author="Phillip Wenig and Sebastian Schmidl",
author_email="[email protected]",
url="https://github.com/TimeEval/gutentag",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Typing :: Typed",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
],
packages=find_packages(exclude=("tests", "tests.*")),
package_data={"gutenTAG": ["py.typed", "config/schema/*"]},
install_requires=REQUIRED,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_base_oscillations/test_custom_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_read_floats(self):
use_column_test=tpe,
)
# data is properly converted
self.assertEqual(timeseries.dtype, np.float_)
self.assertEqual(timeseries.dtype, np.float64)

def test_convert_to_float_with_warning(self):
for tpe in ["ints", "bools"]:
Expand All @@ -168,7 +168,7 @@ def test_convert_to_float_with_warning(self):
# warning is raised
self.assertRegex(str(w.warning), "automatically converted to float")
# data is properly converted
self.assertEqual(timeseries.dtype, np.float_)
self.assertEqual(timeseries.dtype, np.float64)

def test_error_on_string_type(self):
with self.assertRaises(ValueError) as e:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_generator/test_overview_sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ def setUp(self) -> None:
"timeseries": [
{
"name": "ecg",
"length": np.int_(100),
"base-oscillations": [{"kind": "ecg", "frequency": np.float_(2)}],
"length": np.int32(100),
"base-oscillations": [{"kind": "ecg", "frequency": np.float64(2)}],
"anomalies": [
{
"position": "middle",
"length": np.int_(40),
"channel": np.int_(0),
"length": np.int32(40),
"channel": np.int32(0),
"kinds": [
{
"kind": "pattern-shift",
"shift_by": np.int_(5),
"transition_window": np.int_(10),
"shift_by": np.int32(5),
"transition_window": np.int32(10),
"some_array": np.array([1.2, 2.3]),
}
],
Expand Down
Loading