Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Python 3 11 support #291

Merged
merged 3 commits into from
Jan 30, 2023
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
26 changes: 13 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
task:
type: string
docker:
- image: circleci/python:<< parameters.python-version >>
- image: cimg/python:<< parameters.python-version >>
skrawcz marked this conversation as resolved.
Show resolved Hide resolved
environment:
TASK: << parameters.task >>
steps:
Expand All @@ -21,10 +21,6 @@ jobs:
workflows:
unit-test-workflow:
jobs:
- test:
name: build-py36
python-version: '3.6'
task: tests
- test:
name: build-py37
python-version: '3.7'
Expand All @@ -41,14 +37,14 @@ workflows:
name: build-py310
python-version: '3.10'
task: tests
- test:
name: build-py311
python-version: '3.11'
task: tests
- test:
name: pre-commit
python-version: '3.9'
task: pre-commit
- test:
name: dask-py36
python-version: '3.6'
task: dask
- test:
name: dask-py37
python-version: '3.7'
Expand All @@ -61,10 +57,6 @@ workflows:
name: spark-py38
python-version: '3.8'
task: pyspark
- test:
name: integrations-py36
python-version: '3.6'
task: integrations
- test:
name: integrations-py37
python-version: '3.7'
Expand All @@ -81,6 +73,10 @@ workflows:
name: integrations-py310
python-version: '3.10'
task: integrations
- test:
name: integrations-py311
python-version: '3.11'
task: integrations
- test:
name: asyncio-py39
python-version: '3.9'
Expand All @@ -89,3 +85,7 @@ workflows:
name: asyncio-py310
python-version: '3.10'
task: async
- test:
name: asyncio-py311
python-version: '3.11'
task: async
2 changes: 1 addition & 1 deletion build_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CONDA_HOME=$HOME/anaconda3
# conda activate && anaconda login
pkg='sf-hamilton'
# adjust the Python versions you would like to build
array=( 3.6 3.7 3.8 3.9 3.10 )
array=(3.7 3.8 3.9 3.10 3.11 )
echo "Building conda package ..."
cd ~
# this will create a ~/sf-hamilton directory with metadata to build the package.
Expand Down
11 changes: 3 additions & 8 deletions graph_adapter_tests/h_async/test_h_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,8 @@ async def test_driver_end_to_end_telemetry(send_event_json):
}
# to ensure the last telemetry invocation finishes executing
# get all tasks -- and the current task, and await all others.
try:
# only works for 3.7+
tasks = asyncio.all_tasks()
current_task = asyncio.current_task()
await asyncio.gather(*[t for t in tasks if t != current_task])
except AttributeError:
# required for 3.6
await asyncio.sleep(1)
tasks = asyncio.all_tasks()
current_task = asyncio.current_task()
await asyncio.gather(*[t for t in tasks if t != current_task])
assert send_event_json.called
assert len(send_event_json.call_args_list) == 2
3 changes: 0 additions & 3 deletions graph_adapter_tests/h_dask/test_h_dask.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

import pandas as pd
import pytest
from dask.delayed import delayed
Expand Down Expand Up @@ -46,7 +44,6 @@ def test_dask_graph_adapter_simple(client):
# TODO: do some more asserting?


@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7")
def test_smoke_screen_module(client):
config = {"region": "US"}
dr = driver.Driver(config, smoke_screen_module, adapter=h_dask.DaskGraphAdapter(client))
Expand Down
6 changes: 1 addition & 5 deletions hamilton/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,8 @@ def index_key_name(pd_object: Union[pd.DataFrame, pd.Series]) -> str:

def get_parent_time_index_type():
"""Helper to pull the right time index parent class."""
if hasattr(
pd_extension, "NDArrayBackedExtensionIndex"
): # for python 3.7+ & pandas >= 1.2
if hasattr(pd_extension, "NDArrayBackedExtensionIndex"):
index_type = pd_extension.NDArrayBackedExtensionIndex
elif hasattr(pd_extension, "ExtensionIndex"): # for python 3.6 & pandas <= 1.2
index_type = pd_extension.ExtensionIndex
else:
index_type = None # weird case, but not worth breaking for.
return index_type
Expand Down
2 changes: 1 addition & 1 deletion hamilton/dev_utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class parameterized(...):
str
] # If this is None, this means that the use_instead is a drop in replacement
current_version: Union[Tuple[int, int, int], Version] = dataclasses.field(
default=CURRENT_VERSION
default_factory=lambda: CURRENT_VERSION
)
warn_action: Callable[[str], None] = dataclasses.field(default=logger.warning)
fail_action: Callable[[str], None] = dataclasses.field(
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
dataclasses; python_version < '3.7'
numpy
pandas
typing_inspect
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def load_requirements():
"Natural Language :: English",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
# Note that this feature requires pep8 >= v9 and a version of setup tools greater than the
# default version installed with virtualenv. Make sure to update your tools!
Expand Down
3 changes: 0 additions & 3 deletions tests/test_end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

import pytest

import hamilton.driver
Expand Down Expand Up @@ -34,7 +32,6 @@ def test_data_quality_workflow_fails():
)


@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7")
def test_smoke_screen_module():
config = {"region": "US"}
dr = hamilton.driver.Driver(config, tests.resources.smoke_screen_module)
Expand Down