Skip to content

Commit

Permalink
[UPDATE] Merging updates
Browse files Browse the repository at this point in the history
  • Loading branch information
akmalsoliev committed Feb 21, 2024
2 parents c7c321b + e6d5203 commit f3ef020
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polars_xdt"
version = "0.12.2"
version = "0.12.8"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -9,7 +9,7 @@ name = "polars_xdt"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.20.0", features = ["extension-module"] }
pyo3 = { version = "0.20.0", features = ["extension-module", "abi3-py38"] }
pyo3-polars = { version = "0.11.1", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
chrono = { version = "0.4.31", default-features = false, features = ["std", "unstable-locales"] }
Expand Down
2 changes: 1 addition & 1 deletion bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Docs are in a a separate repo cause I couldn't figure out
# how to deploy from readthedocs
subprocess.run(["make", "install"])
subprocess.run(["make", "install", "--release"])
subprocess.run(["make", "clean"], cwd="docs")
subprocess.run(["make", "html"], cwd="docs")
os.system("cp docs/_build/html/* ../docs-polars-xdt/ -r")
Expand Down
10 changes: 10 additions & 0 deletions polars_xdt/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def offset_by(
│ 2023-09-01 ┆ 2bd ┆ 2023-09-05 │
│ 2024-01-04 ┆ -3bd ┆ 2024-01-01 │
└────────────┴──────┴──────────────┘
"""
expr = parse_into_expr(expr)
if (
Expand Down Expand Up @@ -237,6 +238,7 @@ def is_workday(
│ 2023-05-01 ┆ true │
│ 2023-09-09 ┆ false │
└────────────┴────────────┘
"""
expr = parse_into_expr(expr)
weekmask = get_weekmask(weekend)
Expand Down Expand Up @@ -323,6 +325,7 @@ def from_local_datetime(
│ 2020-10-10 02:00:00 ┆ Africa/Kigali ┆ 2020-10-10 00:00:00 UTC │
│ 2020-10-09 20:00:00 ┆ America/New_York ┆ 2020-10-10 00:00:00 UTC │
└─────────────────────┴──────────────────┴─────────────────────────┘
"""
expr = parse_into_expr(expr)
from_tz = parse_into_expr(from_tz, str_as_lit=True)
Expand Down Expand Up @@ -389,6 +392,7 @@ def to_local_datetime(
│ 2020-10-10 00:00:00 UTC ┆ Africa/Kigali ┆ 2020-10-10 02:00:00 │
│ 2020-10-10 00:00:00 UTC ┆ America/New_York ┆ 2020-10-09 20:00:00 │
└─────────────────────────┴──────────────────┴─────────────────────┘
"""
expr = parse_into_expr(expr)
time_zone = parse_into_expr(time_zone, str_as_lit=True)
Expand Down Expand Up @@ -447,6 +451,7 @@ def format_localized(
│ 2024-08-24 00:00:00 ┆ субота, 24 серпня 2024 │
│ 2024-10-01 00:00:00 ┆ вівторок, 01 жовтня 2024 │
└─────────────────────┴──────────────────────────┘
"""
expr = parse_into_expr(expr)
return expr.register_plugin(
Expand Down Expand Up @@ -485,6 +490,7 @@ def to_julian_date(expr: str | pl.Expr) -> pl.Expr:
│ 2013-01-01 00:30:00 ┆ 2456293.5208333335 │
│ 2024-01-07 13:18:51 ┆ 2460317.0547569445 │
└─────────────────────┴────────────────────┘
"""
expr = parse_into_expr(expr)
return expr.register_plugin(
Expand Down Expand Up @@ -554,6 +560,7 @@ def ceil(
│ 2024-08-24 00:00:00 ┆ 2024-09-01 00:00:00 │
│ 2024-10-01 00:00:00 ┆ 2024-10-01 00:00:00 │
└─────────────────────┴─────────────────────┘
"""
expr = parse_into_expr(expr)
truncated = expr.dt.truncate(every)
Expand Down Expand Up @@ -600,6 +607,7 @@ def day_name(expr: str | pl.Expr, locale: str | None = None) -> pl.Expr:
│ 2020-10-25 00:00:00 ┆ Sunday ┆ dimanche ┆ неділя │
│ 2020-10-26 00:00:00 ┆ Monday ┆ lundi ┆ понеділок │
└─────────────────────┴──────────────────┴─────────────────┴────────────────────┘
"""
expr = parse_into_expr(expr)
if locale is None:
Expand Down Expand Up @@ -645,6 +653,7 @@ def month_name(expr: str | pl.Expr, locale: str | None = None) -> pl.Expr:
│ 2020-10-25 00:00:00 ┆ October ┆ octobre ┆ жовтня │
│ 2020-11-26 00:00:00 ┆ November ┆ novembre ┆ листопада │
└─────────────────────┴────────────────────┴───────────────────┴──────────────────────┘
"""
expr = parse_into_expr(expr)
if locale is None:
Expand Down Expand Up @@ -701,6 +710,7 @@ def workday_count(
│ 2023-05-01 ┆ 2023-05-02 ┆ 1 │
│ 2023-09-09 ┆ 2023-12-30 ┆ 80 │
└────────────┴────────────┴─────────────────┘
"""
start_dates = parse_into_expr(start_dates)
end_dates = parse_into_expr(end_dates)
Expand Down
1 change: 1 addition & 0 deletions polars_xdt/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def date_range( # noqa: PLR0913
│ 2023-01-09 │
│ 2023-01-10 │
└────────────┘
"""
if weekend == ("Sat", "Sun"):
weekend_int = [6, 7]
Expand Down
1 change: 1 addition & 0 deletions polars_xdt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def parse_into_expr(
Returns
-------
polars.Expr
"""
if isinstance(expr, pl.Expr):
pass
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["maturin>=1.0,<2.0", "polars>=0.26.0"]
requires = ["maturin>=1.0,<2.0", "polars>=0.20.6"]
build-backend = "maturin"

[project]
name = "polars-xdt"
description = "Time Series Extras (e.g. business day utilities) for Polars"
description = "eXtra stuff for Dates and Times in Polars"
readme = "README.md"
authors = [
{ name="Marco Gorelli", email="[email protected]" },
Expand All @@ -31,10 +31,10 @@ module-name = "polars_xdt._internal"
docstring-code-format = true

[tool.ruff]
select = [
lint.select = [
"ALL",
]
ignore = [
lint.ignore = [
'A003',
'ANN101',
'ANN401',
Expand Down Expand Up @@ -69,7 +69,7 @@ ignore = [
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
lint.fixable = ["ALL"]

# Exclude a variety of commonly ignored directories.
exclude = [
Expand All @@ -88,4 +88,4 @@ line-length = 80
module = [
"pandas"
]
ignore_missing_imports = true
ignore_missing_imports = true

0 comments on commit f3ef020

Please sign in to comment.