Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump min support Python to 3.10 #416

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install dependencies
run: |
pip install -e .[dev] -c etc/requirements_dev.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.12"]
python-version: ["3.10", "3.12"]
include:
- python-version: "3.9"
- python-version: "3.10"
requirements_file: requirements_dev.txt
- python-version: "3.12"
requirements_file: requirements_minpandas.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install build dependencies
run: |
Expand Down
2 changes: 0 additions & 2 deletions etc/factory_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
Module retained in case might be useful.
"""

from __future__ import annotations

import abc
import dataclasses
import pathlib
Expand Down
4 changes: 2 additions & 2 deletions etc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=etc/requirements.txt pyproject.toml
#
korean-lunar-calendar==0.3.1
# via exchange_calendars (pyproject.toml)
numpy==2.0.2
numpy==2.1.1
# via
# exchange_calendars (pyproject.toml)
# pandas
Expand Down
8 changes: 2 additions & 6 deletions etc/requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --extra=dev --output-file=etc/requirements_dev.txt pyproject.toml
Expand All @@ -25,15 +25,13 @@ flake8==7.1.1
# via exchange_calendars (pyproject.toml)
hypothesis==6.112.1
# via exchange_calendars (pyproject.toml)
importlib-metadata==8.5.0
# via build
iniconfig==2.0.0
# via pytest
korean-lunar-calendar==0.3.1
# via exchange_calendars (pyproject.toml)
mccabe==0.7.0
# via flake8
numpy==2.0.2
numpy==2.1.1
# via
# exchange_calendars (pyproject.toml)
# pandas
Expand Down Expand Up @@ -89,8 +87,6 @@ tzdata==2024.1
# pandas
wheel==0.44.0
# via pip-tools
zipp==3.20.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
6 changes: 1 addition & 5 deletions etc/requirements_minpandas.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --extra=dev --output-file=etc/requirements_minpandas.txt pyproject.toml
Expand Down Expand Up @@ -29,8 +29,6 @@ flake8==7.1.1
# via exchange_calendars (pyproject.toml)
hypothesis==6.112.1
# via exchange_calendars (pyproject.toml)
importlib-metadata==8.5.0
# via build
iniconfig==2.0.0
# via pytest
korean-lunar-calendar==0.3.1
Expand Down Expand Up @@ -91,8 +89,6 @@ tzdata==2024.1
# via exchange_calendars (pyproject.toml)
wheel==0.44.0
# via pip-tools
zipp==3.20.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
9 changes: 4 additions & 5 deletions exchange_calendars/calendar_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

import contextlib
import datetime
import typing
from typing import Literal
from typing import Literal, TYPE_CHECKING
from zoneinfo import ZoneInfo

import numpy as np
import pandas as pd

from exchange_calendars import errors

if typing.TYPE_CHECKING:
if TYPE_CHECKING:
from exchange_calendars import ExchangeCalendar

UTC = ZoneInfo("UTC")
Expand All @@ -22,15 +21,15 @@

# Use Date type where input does not need to represent an actual session
# and will be parsed by parse_date.
Date = typing.Union[pd.Timestamp, str, int, float, datetime.datetime]
Date = pd.Timestamp | str | int | float | datetime.datetime

# Use Session type where input should represent an actual session and will
# be parsed by parse_session.
Session = Date

# Use Minute type where input does not need to represent an actual trading
# minute and will be parsed by parse_timestamp.
Minute = typing.Union[pd.Timestamp, str, int, float, datetime.datetime]
Minute = pd.Timestamp | str | int | float | datetime.datetime

# Use TradingMinute where input should represent a trading minute and will
# be parsed by parse_trading_minute.
Expand Down
2 changes: 0 additions & 2 deletions exchange_calendars/calendar_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Literal

from .calendar_helpers import parse_date, Date
Expand Down
2 changes: 2 additions & 0 deletions exchange_calendars/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import typing
import pandas as pd

Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xbud.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from zoneinfo import ZoneInfo
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xbue.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from itertools import chain
Expand Down
2 changes: 1 addition & 1 deletion exchange_calendars/exchange_calendar_xkrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations


from datetime import time
import functools
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from itertools import chain
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from itertools import chain
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xsgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from zoneinfo import ZoneInfo
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xtai.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from itertools import chain
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/exchange_calendar_xwar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import datetime
from zoneinfo import ZoneInfo
Expand Down
1 change: 0 additions & 1 deletion exchange_calendars/precomputed_exchange_calendar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import annotations
from abc import abstractmethod

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions exchange_calendars/utils/pandas_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import datetime
from zoneinfo import ZoneInfo

Expand Down
2 changes: 0 additions & 2 deletions exchange_calendars/xbkk_holidays.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import datetime

import pandas as pd
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ authors = [
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["finance", "security", "calendar", "exchange"]
requires-python = "~=3.9"
requires-python = "~=3.10"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down Expand Up @@ -64,4 +63,4 @@ write_to = "exchange_calendars/_version.py"

[tool.black]
line-length = 88
target-version = ['py39', 'py310', 'py311', 'py312']
target-version = ['py310', 'py311', 'py312']
2 changes: 0 additions & 2 deletions tests/test_calendar_helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Tests for calendar_helpers module."""

from __future__ import annotations

from collections import abc
import datetime
from datetime import time
Expand Down
9 changes: 4 additions & 5 deletions tests/test_exchange_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations

from collections import abc
from datetime import time
Expand Down Expand Up @@ -722,7 +721,7 @@ def _get_sessions_with_times_different_to_next_session(

Returns
-------
list of pd.Datetimeindex
list of pd.DatetimeIndex
[0] sessions with earlier next session
[1] sessions with later next session
"""
Expand Down Expand Up @@ -1117,12 +1116,12 @@ def non_sessions(self) -> pd.DatetimeIndex:
@property
def sessions_range_defined_by_non_sessions(
self,
) -> tuple[tuple[pd.Timestamp, pd.Timestamp], pd.Datetimeindex] | None:
) -> tuple[tuple[pd.Timestamp, pd.Timestamp], pd.DatetimeIndex] | None:
"""Range containing sessions although defined with non-sessions.

Returns
-------
tuple[tuple[pd.Timestamp, pd.Timestamp], pd.Datetimeindex]:
tuple[tuple[pd.Timestamp, pd.Timestamp], pd.DatetimeIndex]:
[0] tuple[pd.Timestamp, pd.Timestamp]:
[0] range start as non-session date.
[1] range end as non-session date.
Expand Down Expand Up @@ -1869,7 +1868,7 @@ def early_closes_sample_time(self) -> abc.Iterator[pd.Timedelta | None]:
yield None

@pytest.fixture
def early_closes_weekdays(self) -> abc.Iterator[tuple(int)]:
def early_closes_weekdays(self) -> abc.Iterator[tuple[int]]:
"""Weekdays with non-standard close times.

`test_early_closes_weekdays` will check that all sessions on these
Expand Down