Skip to content

Commit

Permalink
back to tse
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 5, 2024
1 parent 88953f2 commit 09489ea
Show file tree
Hide file tree
Showing 23 changed files with 83 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ rust-toolchain.toml
*.html
*.bat
*.js
polars_ts/docs/_build
polars_tse/docs/_build
*.so
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: polars_ts/docs/conf.py
configuration: polars_tse/docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
Expand All @@ -29,4 +29,4 @@ sphinx:
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: polars_ts/docs/requirements-docs.txt
- requirements: polars_tse/docs/requirements-docs.txt
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "polars_ts"
name = "polars_tse"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "polars_ts"
name = "polars_tse"
crate-type = ["cdylib"]

[dependencies]
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1 align="center">
<img
width="400"
alt="polars-ts"
alt="polars-tse"
src="https://github.com/MarcoGorelli/polars-business/assets/33491632/928c68c4-4e71-45a7-bc89-14922c7ce61b">
</h1>

Expand All @@ -21,21 +21,21 @@ Installation

First, you need to [install Polars](https://pola-rs.github.io/polars/user-guide/installation/).

Then, you'll need to install `polars-ts`:
Then, you'll need to install `polars-tse`:
```console
pip install polars-ts
pip install polars-tse
```

Then, if you can run
```python
from datetime import date
import polars_ts as pts
import polars_tse as tse

print(pts.date_range(date(2023, 1, 1), date(2023, 1, 10), eager=True))
print(tse.date_range(date(2023, 1, 1), date(2023, 1, 10), eager=True))
```
it means installation all worked correctly!

Read the [documentation](https://marcogorelli.github.io/polars-ts-docs/) for a little tutorial and API reference.
Read the [documentation](https://marcogorelli.github.io/polars-tse-docs/) for a little tutorial and API reference.

Basic Example
-------------
Expand All @@ -44,7 +44,7 @@ Say we start with
from datetime import date

import polars as pl
import polars_ts as pts
import polars_tse as pts


df = pl.DataFrame(
Expand All @@ -56,7 +56,7 @@ Let's shift `Date` forwards by 5 days, excluding Saturday and Sunday:

```python
result = df.with_columns(
date_shifted=pts.col("date").bdt.offset_by(
date_shifted=pts.col("date").tse.offset_by(
'5bd',
weekend=('Sat', 'Sun'),
)
Expand All @@ -79,7 +79,7 @@ shape: (3, 2)
You can also count the number of business days between two given dates, specify a custom
calendar holiday, and create a date range excluding workdays.

Read the [documentation](https://marcogorelli.github.io/polars-ts-docs/) for more examples!
Read the [documentation](https://marcogorelli.github.io/polars-tse-docs/) for more examples!

Performance
-----------
Expand Down
17 changes: 7 additions & 10 deletions bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@
import os

# Docs are in a a separate repo cause I couldn't figure out
# how to deploy from read the docs
# how to deploy from readthedocs
subprocess.run(['make', 'install'])
subprocess.run(['make', 'clean'], cwd='docs')
subprocess.run(['make', 'html'], cwd='docs')
os.system('cp docs/_build/html/* ../../docs-polars-ts/ -r')
subprocess.run(['git', 'add', '.'], cwd='../../docs-polars-ts')
subprocess.run(['git', 'commit', '-m', '\"new version\"', '--allow-empty'], cwd='../../docs-polars-ts')
subprocess.run(['git', 'push', 'origin', 'HEAD'], cwd='../../docs-polars-ts')
os.system('cp docs/_build/html/* ../docs-polars-tse/ -r')
subprocess.run(['git', 'add', '.'], cwd='../docs-polars-tse')
subprocess.run(['git', 'commit', '-m', '\"new version\"', '--allow-empty'], cwd='../docs-polars-tse')
subprocess.run(['git', 'push', 'origin', 'HEAD'], cwd='../docs-polars-tse')

how = sys.argv[1]

subprocess.run(["cp", "../README.md", "polars_ts/README.md"])
subprocess.run(["cp", "../LICENSE", "polars_ts/LICENSE"])

with open("pyproject.toml", "r", encoding="utf-8") as f:
content = f.read()
old_version = re.search(r'version = "(.*)"', content).group(1)
Expand All @@ -35,12 +32,12 @@
with open("pyproject.toml", "w", encoding="utf-8") as f:
f.write(content)

with open("polars_ts/__init__.py", "r", encoding="utf-8") as f:
with open("polars_tse/__init__.py", "r", encoding="utf-8") as f:
content = f.read()
content = content.replace(
f'__version__ = "{old_version}"', f'__version__ = "{version}"'
)
with open("polars_ts/__init__.py", "w", encoding="utf-8") as f:
with open("polars_tse/__init__.py", "w", encoding="utf-8") as f:
f.write(content)

subprocess.run(["git", "commit", "-a", "-m", f"Bump version to {version}"])
Expand Down
6 changes: 3 additions & 3 deletions docs/API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ API
.. autosummary::
:toctree: api/

polars_ts.date_range
polars_ts.workday_count
polars_ts.ExprBusinessDateTimeNamespace.offset_by
polars_tse.date_range
polars_tse.workday_count
polars_tse.ExprBusinessDateTimeNamespace.offset_by
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
polars\_business.ExprBusinessDateTimeNamespace.offset\_by
=========================================================

.. currentmodule:: polars_ts
.. currentmodule:: polars_tse

.. automethod:: ExprBusinessDateTimeNamespace.offset_by
2 changes: 1 addition & 1 deletion docs/api/polars_business.date_range.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
polars\_business.date\_range
============================

.. currentmodule:: polars_ts
.. currentmodule:: polars_tse

.. autofunction:: date_range
2 changes: 1 addition & 1 deletion docs/api/polars_business.workday_count.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
polars\_business.workday\_count
===============================

.. currentmodule:: polars_ts
.. currentmodule:: polars_tse

.. autofunction:: workday_count
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'polars-ts'
project = 'polars-tse'
copyright = '2023, Marco Gorelli'
author = 'Marco Gorelli'

Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
polars-ts
polars-tse
===============

**polars-ts** is a Python library which is a plugin for
**polars-tse** is a Python library which is a plugin for
Polars, a blazingly fast dataframe library.

.. image:: https://github.com/MarcoGorelli/polars-ts/assets/33491632/928c68c4-4e71-45a7-bc89-14922c7ce61b
.. image:: https://github.com/MarcoGorelli/polars-tse/assets/33491632/928c68c4-4e71-45a7-bc89-14922c7ce61b
:width: 400
:alt: Polar bear in an office with a nice warm cup of coffee

Expand Down
6 changes: 3 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Installation

First, you need to `install Polars <https://pola-rs.github.io/polars/user-guide/installation/>`_.

Then, you'll need to install `polars-ts`:
Then, you'll need to install `polars-tse`:

.. code-block::
pip install polars-ts
pip install polars-tse
Then, if you can run

.. code-block::
from datetime import date
import polars_ts as pts
import polars_tse as pts
print(pts.date_range(date(2023, 1, 1), date(2023, 1, 10), eager=True))
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements-docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ sphinx_copybutton
sphinx-design
sphinx-favicon
pydata_sphinx_theme
polars-ts
polars-tse
6 changes: 3 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Say we start with
from datetime import date
import polars as pl
import polars_ts as pts
import polars_tse as pts
df = pl.DataFrame(
Expand All @@ -21,7 +21,7 @@ Let's shift `Date` forwards by 5 days, excluding Saturday and Sunday:
.. code-block:: python
result = df.with_columns(
date_shifted=pts.col("date").bdt.offset_by(
date_shifted=pts.col("date").tse.offset_by(
'5bd',
weekend=('Sat', 'Sun'),
)
Expand Down Expand Up @@ -52,7 +52,7 @@ for 2023 and 2024 (note: you'll need to install the
england_holidays = holidays.country_holidays("UK", subdiv='ENG', years=[2023, 2024])
result = df.with_columns(
date_shifted=pts.col("date").bdt.offset_by(
date_shifted=pts.col("date").tse.offset_by(
by='5bd',
weekend=('Sat', 'Sun'),
holidays=england_holidays,
Expand Down
Loading

0 comments on commit 09489ea

Please sign in to comment.