Skip to content
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
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hatch
# Pin virtualenv<21: virtualenv 21.0 removed an API hatch depends on
# https://github.com/pypa/hatch/issues/2193
python -m pip install hatch 'virtualenv<21'
- name: Lint check
working-directory: ./python
run: make lint LINT_PARAMS="-- --check --diff"
Expand Down Expand Up @@ -60,7 +62,9 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install semver
python -m pip install hatch
# Pin virtualenv<21: virtualenv 21.0 removed an API hatch depends on
# https://github.com/pypa/hatch/issues/2193
python -m pip install hatch 'virtualenv<21'
- name: Execute hatch envs
working-directory: ./python
run: make test coverage-report DBR=${{ matrix.config.dbr }}
Expand Down
50 changes: 48 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "Tempo"
name = "dbl-tempo"
dynamic = ["version"]
description = 'Tempo is timeseries manipulation for Spark. This project builds upon the capabilities of PySpark to provide a suite of abstractions and functions that make operations on timeseries data easier and highly scalable.'
readme = "README.md"
Expand Down Expand Up @@ -146,6 +146,7 @@ runLint = [
"black --check --diff ./tempo",
"flake8 --config ./.flake8 ./tempo"
]
formatBlack = ["black ./tempo ./tests"]

[tool.hatch.envs.type-check]
template = "testenv"
Expand All @@ -161,6 +162,33 @@ dependencies = [
check = "mypy --install-types --non-interactive ./tempo"


[tool.hatch.build.targets.wheel]
packages = ["tempo"]

[tool.hatch.build.targets.sdist]
include = [
"/tempo",
"/tests",
"/README.md",
"/pyproject.toml",
"/version.py"
]
exclude = [
"/.venv*",
"/.tox",
"/.mypy_cache",
"/.pytest_cache",
"/__pycache__",
"*.pyc",
"*.pyo",
"*.egg-info",
"/dist",
"/build",
"/htmlcov",
"/.coverage*",
"/coverage.xml"
]

[tool.hatch.envs.build-dist]
template = "testenv"
skip-install = true
Expand All @@ -170,7 +198,7 @@ dependencies = [
]

[tool.hatch.envs.build-dist.scripts]
build = "python setup.py clean bdist_wheel"
build = "hatch build"


[tool.hatch.envs.build-docs]
Expand Down Expand Up @@ -218,3 +246,21 @@ run-coverage = [
"coverage report -m",
"coverage xml"
]

[tool.black]
line-length = 88
target-version = ['py39', 'py310', 'py311']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
31 changes: 0 additions & 31 deletions python/setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion python/tempo/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
timeSeriesCol: str = "event_ts",
seriesIdCols: List[str] = [],
gap: int = 0,
**other_kwargs: Any
**other_kwargs: Any,
) -> None:
super(TimeSeriesCrossValidator, self).__init__(**other_kwargs)
self._setDefault(timeSeriesCol="event_ts", seriesIdCols=[], gap=0)
Expand Down
5 changes: 2 additions & 3 deletions python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ skip_install = true
deps =
build
semver
setuptools
wheel
hatchling
commands =
python setup.py clean bdist_wheel
hatch build

[testenv:build-docs]
description = build documentation
Expand Down
10 changes: 1 addition & 9 deletions python/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ def run_cmd(cmd):
# fetch the most recent version tag to use as build version
def get_latest_git_tag():
latest_tag = run_cmd("git describe --abbrev=0 --tags")
build_version = re.sub(r"v\.?\s*", "", latest_tag)
# validate that this is a valid semantic version - will throw exception if not
try:
import semver
semver.VersionInfo.parse(build_version)
except (ModuleNotFoundError):
# unable to validate because semver is not installed in barebones env for hatch
pass
return build_version
return re.sub(r"v\.?\s*", "", latest_tag)


# fetch the most recent build version for hatch environment creation
Expand Down