Skip to content

Commit

Permalink
migration fixes (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoralez authored Oct 13, 2024
1 parent 0f9f3f3 commit 46ec21e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: true

- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: true

- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "coreforecast"
version = "0.0.12"
version = "0.0.13"
requires-python = ">=3.9"
dependencies = ["numpy>=1.20.0"]
license = { text = "Apache-2.0" }
Expand Down Expand Up @@ -33,9 +33,10 @@ requires = ["scikit-build-core", "pybind11"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
build-dir = "build"
cmake.verbose = true
logging.level = "INFO"
sdist.exclude = ["tests", "*.yml"]
sdist.exclude = ["docs", "tests", "*.yml"]
sdist.reproducible = true
wheel.exclude = ["Release"]
wheel.expand-macos-universal-tags = true
Expand Down
2 changes: 1 addition & 1 deletion python/coreforecast/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.12"
__version__ = "0.0.13"
22 changes: 0 additions & 22 deletions scripts/float64_methods.py

This file was deleted.

12 changes: 10 additions & 2 deletions src/grouped_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "expanding.h"
#include "exponentially_weighted.h"
#include "grouped_array_functions.h"
#include "lag.h"
#include "rolling.h"
#include "scalers.h"
#include "seasonal.h"
Expand Down Expand Up @@ -271,6 +272,12 @@ template <typename T> class GroupedArray {
return out;
}

py::array_t<T> LagTransform(int lag) {
py::array_t<T> out(data_.size());
Transform(lag::LagTransform<T>, lag, out.mutable_data());
return out;
}

template <typename Func>
py::array_t<T> RollingTransform(Func transform, int lag, int window_size,
int min_samples) {
Expand Down Expand Up @@ -587,6 +594,7 @@ template <typename T> void bind_ga(py::module &m, const std::string &name) {
.def("_tail", &GroupedArray<T>::Tail)
.def("_tails", &GroupedArray<T>::Tails)
.def("_append", &GroupedArray<T>::Append)
.def("_lag", &GroupedArray<T>::LagTransform)
.def("_rolling_mean", &GroupedArray<T>::RollingMeanTransform)
.def("_rolling_std", &GroupedArray<T>::RollingStdTransform)
.def("_rolling_min", &GroupedArray<T>::RollingMinTransform)
Expand Down Expand Up @@ -671,10 +679,10 @@ void init_ga(py::module_ &m) {
if (data.dtype().kind() != 'f') {
data = data.attr("astype")("float32");
}
if (data.dtype().is(py::dtype::of<float>())) {
if (py::isinstance<py::array_t<float>>(data)) {
return py::cast(std::make_unique<GroupedArray<float>>(
data.cast<py::array_t<float>>(), indptr, num_threads));
} else if (data.dtype().is(py::dtype::of<double>())) {
} else if (py::isinstance<py::array_t<double>>(data)) {
return py::cast(std::make_unique<GroupedArray<double>>(
data.cast<py::array_t<double>>(), indptr, num_threads));
} else {
Expand Down

0 comments on commit 46ec21e

Please sign in to comment.