Commit d7e2446
Resample refactor (#428)
* making contributing.md slightly more clear (#422)
* making contributing.md slightly more clear
* Remove `Analyze` job from test.yml (#423)
- This job called CodeQL which is broken due to new firewall rules
---------
Co-authored-by: Lorin Dawson <[email protected]>
* created prelim makefile with tox commands, updated contributing.md (#424)
* created prelim makefile with tox commands, updated contributing.md
* adding 3.11 to docs, and updating create-env in makefile to install all necessary python versions
* removing 3.8
* Update Makefile to improve test and environment management
Added commands for creating virtual environments, running tests, and generating coverage reports. Enhanced documentation for supported DBR versions and added new command options for better usability.
* Update Makefile to conditionally install Python versions
Modified the `venv` target to check for existing Python versions before installing them. This prevents redundant installations and ensures only missing versions are installed via `pyenv`.
* Update Makefile to use dynamic virtualenv variable
Replaced hardcoded `.venv` with the `$(VENV)` variable in the Makefile. This allows for greater flexibility and customization of the virtual environment directory name.
* Fix typo in Makefile target comment
Corrected a misspelling in the comment for the `test` target. Changed "testtests" to "tests" for improved clarity and professionalism.
---------
Co-authored-by: Lorin <[email protected]>
* [Chore] Cicd updates 02 (#425)
* created prelim makefile with tox commands, updated contributing.md
* adding 3.11 to docs, and updating create-env in makefile to install all necessary python versions
* removing 3.8
* updating git workflows to use make
* create coverage report in test
* remove commented tox command
* update check_for_nan, force bool returns
* updates to io.py to pass tests
* testing out change to tsdf to account for new mypy restrcitions
* updating mypy error handling
* revert
* updating mypy.ini to ignore scipy
* remove edits to tox.ini to show versions
* - Fix `bool` conversions in `tempo/intervals.py` to ensure consistent type handling.
- Correct `tox.ini` basepython to `py311` and manage additional dependencies.
- Clarify complex number handling in `fourier_transform` and ensure float usage in `fftfreq`.
- Expand `Makefile` functionality with environment checks for Python and Java setups.
* Add `_cleanup_delta_warehouse` method for Delta test environment cleanup.
Integrate pre- and post-test cleanup of Delta warehouse directories and metastore files in `setUpClass` and `tearDownClass` to ensure a consistent test environment.
* Expand Makefile with enhanced Python environment checks and management.
- Add `.claude` to `.gitignore`.
- Replace `check-pyenv` with `check-python` to support system Python and automate `pyenv` installation.
- Introduce `setup-python-versions` and `setup-all-python-versions` targets for flexible Python version setups.
- Update `venv`, `test`, and `test-all` targets to utilize new utilities.
---------
Co-authored-by: Lorin <[email protected]>
* chore: code formatting and linting updates
* Upgrading Tox to Hatch, and Updating respective commands in Makefile (#426)
* created prelim makefile with tox commands, updated contributing.md
* adding 3.11 to docs, and updating create-env in makefile to install all necessary python versions
* removing 3.8
* updating git workflows to use make
* create coverage report in test
* initial hatch commit
* updates to makefile
* updating github workflow dependencies to install hatch instead of tox
* fixing posargs issue in lint
* fixing type checker
* adding version call so hatch knows what to pick up
* using correct method in version.py"
* adding get_version to version.py for hatch environment creation
* adding semver as dep in git
* using vcs as hatch version
* updating version.py to dynamically pull version, and semver as dep in all testenvs
* checking semver install
* updating semver
* fixing var ref before assignment in version.py
* fixing correct error type
* getting around coverage circ dep
* forgot to update makefile
* remove commented tox command
* update check_for_nan, force bool returns
* updates to io.py to pass tests
* testing out change to tsdf to account for new mypy restrcitions
* updating mypy error handling
* revert
* updating mypy.ini to ignore scipy
* remove edits to tox.ini to show versions
* linting fix
* refactor: simplify resampling and interpolation logic
- Removed `_ResampledTSDF` class in favor of integrating resampling metadata (`_resample_freq`, `_resample_func`) into `TSDF`.
- Improved error handling for `freq` and `func` parameters in resample and interpolation methods.
- Updated interpolation logic to utilize a resampled TSDF object and mapped predefined fill methods.
- Adjusted references to `partitionCols` by transitioning to `series_ids`.
- Added `parameterized` dependency to `pyproject.toml` for enhanced test capabilities.
- Reduced circular imports and restructured imports for maintainability.
- Updated tests to align with changes in resample and interpolation workflows.
* refactor: extract resample helper functions to `resample_utils` and update tests
- Moved reusable functions and constants (e.g., `validateFuncExists`, `checkAllowableFreq`) to `resample_utils` for better modularity.
- Updated `resample`, `tsdf`, and associated tests to use the refactored helper functions.
- Simplified test data construction by introducing `get_test_function_df_builder`.
* core refactor done: enhance resampling logic and consolidate column handling behavior
- Introduced `AGG_KEY` constant for consistent grouping across resample functions.
- Refined column handling logic in `aggregate` and `resample` to align with best practices, emphasizing explicit configurations and preserving observational columns by default.
- Updated `calc_bars` to seamlessly integrate OHLC bar calculations with enhanced column handling.
- Adjusted tests to use more descriptive data keys (`input_data`, `expected_data`) for better clarity.
- Updated tests to align with modified column handling and aggregation behavior.
* refactor: introduce `resample_utils` module for shared resampling utilities
- Added `resample_utils.py` to encapsulate utility functions (`checkAllowableFreq`, `validateFuncExists`) and constants for resampling.
- Defined global frequency and aggregation options for modularity.
- Improved frequency validation logic with `freq_dict` and `ALLOWED_FREQ_KEYS`.
* refactor: optimize time bounds calculation in resample logic. All resmaple tests pass
- Replaced window function-based approach with `groupBy` for calculating time bounds, reducing duplicate computations.
- Improved handling of `series_ids` for partitioning, ensuring accuracy in sequence generation.
- Simplified logic for timestamp sequence generation using `time_bounds`.
* refactor: update test data construction and skip conditions for enhanced clarity and precision
- Consolidated shared test data definitions and references using `$ref`.
- Adjusted timestamp handling and sequence column logic in various tests.
- Added skip conditions for tests involving composite timestamp indexes or complex timestamp structures.
- Refactored utility tests to improve consistency in `get_test_function_df_builder` usage.
* refactor: replace `get_test_df_builder` with `get_test_function_df_builder` in tests for consistent data building
* refactor: add PySpark 3.5+ compatibility and provide fallbacks for older versions
- Introduced version checks for PySpark features like `count_if` and `bool_or`.
- Added compatibility wrapper `_bool_or_compat` for `bool_or` functionality.
- Updated segment handling logic with fallbacks for PySpark < 3.5, ensuring robust interpolation behavior.
* Allow more column types to be interpolated (#421)
* Allow interpolation to only reject column types that cannot work for the specific method used
* Fix unit test incompatibility with dbr113
* Fix tests and clarify error message
* Fix incorrect column reference in test
---------
Co-authored-by: Brian Deacon <[email protected]>
* update: extend .gitignore to include `.venv-*` directory pattern
* chore linting: improve type annotations, imports, and formatting for code consistency
- Replaced redundant `Any` in type hints with more precise alternatives (e.g., `object`, `TSDF`, `Collection`).
- Converted `TimeUnitsType` from `NamedTuple` creation to a class for improved readability.
- Consolidated and reorganized imports across modules for better clarity.
- Removed unused imports and redundant `pass` statements in abstract methods.
- Standardized and fixed minor formatting issues (consistency in blank lines, indentation, and trailing spaces).
* refactor: improve type annotations, reorganize imports, and enhance join logic across modules
- Added precise type annotations (e.g., `Optional`, `Tuple`) to methods for better clarity and static analysis support.
- Refactored imports to include `# type: ignore` directives where necessary for untyped packages or compatibility.
- Enhanced `_toleranceFilter` and `_join` methods with placeholders and TODOs for future logic implementations.
- Introduced stricter validation for parameters (e.g., `freq` checks) to avoid runtime errors.
- Updated join constructors to handle default prefix values and improve readability.
* style: fix indentation to 4 spaces per PEP 8
* adding imports for IntervalsDF + pytest in dev.txt
* test: remove `intervals_tests.py` to clean up unused and redundant test cases
* test: remove `intervals_df_tests.json` to clean up deprecated and redundant test cases
* test: update exception type in `test_appendAggKey_freq_is_none`
- Replaced `TypeError` with `ValueError` in assertion to align with updated `_appendAggKey` behavior.
---------
Co-authored-by: kwang-databricks <[email protected]>
Co-authored-by: Brian Deacon <[email protected]>
Co-authored-by: Brian Deacon <[email protected]>1 parent 2cfe796 commit d7e2446
File tree
46 files changed
+9767
-3117
lines changed- .github/workflows
- python
- requirements
- tempo
- intervals
- tests
- intervals/core
- unit_test_data
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+9767
-3117
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 48 | + | |
54 | 49 | | |
55 | | - | |
| 50 | + | |
56 | 51 | | |
57 | 52 | | |
58 | | - | |
| 53 | + | |
59 | 54 | | |
60 | | - | |
| 55 | + | |
61 | 56 | | |
62 | | - | |
63 | 57 | | |
64 | 58 | | |
65 | 59 | | |
| |||
70 | 64 | | |
71 | 65 | | |
72 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
0 commit comments