Skip to content

Commit defacc9

Browse files
committed
feat: update built-in dataset to parquet and enforce dependencies
- Update built-in dataset to parquet - Require Python >= 3.10 - Require Polars >= 1.37
1 parent 4e9d910 commit defacc9

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="https://raw.githubusercontent.com/quantbai/elvers/main/assets/elvers.svg" alt="Elvers" width="500">
44

55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6-
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
6+
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
77
[![Polars](https://img.shields.io/badge/Polars-1.37+-CD853F.svg)](https://pola.rs/)
88

99
</div>

elvers/data/crypto_1d.parquet

138 KB
Binary file not shown.

elvers/io/loader.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@
1010
from .panel import Panel
1111

1212

13-
def load(source: Optional[Union[str, Path, pl.DataFrame]] = None) -> Panel:
13+
def load(source: Optional[Union[str, Path, pl.DataFrame]] = None, format: str = "parquet") -> Panel:
1414
"""Load data into a balanced Panel.
1515
1616
Reads CSV/Parquet/DataFrame, validates schema, then expands to a
1717
fully balanced (N symbols x T days) long-format panel. Missing
1818
factor values are filled with null.
1919
2020
When called with no arguments, loads the built-in sample dataset
21-
(daily crypto OHLCV) bundled with the package.
21+
(daily crypto OHLCV) bundled with the package. Can specify `format="csv"`
22+
or `format="parquet"`.
2223
"""
2324
if source is None:
24-
ref = resources.files("elvers.data").joinpath("crypto_1d.csv")
25+
if format not in ["csv", "parquet"]:
26+
raise ValueError("format must be 'csv' or 'parquet'")
27+
ref = resources.files("elvers.data").joinpath(f"crypto_1d.{format}")
2528
with resources.as_file(ref) as p:
2629
return load(p)
2730
df = _read_source(source)

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ license = {text = "MIT"}
1111
authors = [
1212
{name = "quantbai", email = "quantbai@gmail.com"}
1313
]
14-
requires-python = ">=3.11"
14+
requires-python = ">=3.10"
1515
dependencies = [
16-
"polars>=1.35.0,<2.0.0",
16+
"polars>=1.37.0,<2.0.0",
1717
]
1818
classifiers = [
1919
"Development Status :: 2 - Pre-Alpha",
2020
"Intended Audience :: Financial and Insurance Industry",
2121
"License :: OSI Approved :: MIT License",
2222
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.10",
2324
"Programming Language :: Python :: 3.11",
2425
"Programming Language :: Python :: 3.12",
2526
"Programming Language :: Python :: 3.13",
@@ -30,7 +31,7 @@ Homepage = "https://github.com/quantbai/elvers"
3031
Repository = "https://github.com/quantbai/elvers"
3132

3233
[tool.setuptools.package-data]
33-
"elvers.data" = ["*.csv"]
34+
"elvers.data" = ["*.csv", "*.parquet"]
3435

3536
[tool.setuptools.dynamic]
3637
version = {attr = "elvers.__version__"}

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ def get_version():
2121
url='https://github.com/quantbai/elvers',
2222
packages=find_packages(),
2323
include_package_data=True,
24-
package_data={"elvers.data": ["*.csv"]},
24+
package_data={"elvers.data": ["*.csv", "*.parquet"]},
2525
install_requires=[
26-
'polars>=1.35.0,<2.0.0',
26+
'polars>=1.37.0,<2.0.0',
2727
],
2828
classifiers=[
2929
'Development Status :: 2 - Pre-Alpha',
3030
'Intended Audience :: Developers',
3131
'Intended Audience :: Financial and Insurance Industry',
3232
'Intended Audience :: Science/Research',
3333
'Programming Language :: Python :: 3',
34+
'Programming Language :: Python :: 3.10',
3435
'Programming Language :: Python :: 3.11',
3536
'Programming Language :: Python :: 3.12',
3637
'Programming Language :: Python :: 3.13',
@@ -40,5 +41,5 @@ def get_version():
4041
'Topic :: Office/Business :: Financial :: Investment',
4142
'Topic :: Scientific/Engineering',
4243
],
43-
python_requires='>=3.11',
44+
python_requires='>=3.10',
4445
)

0 commit comments

Comments
 (0)