Skip to content

Commit

Permalink
support Python 3.12 (#325)
Browse files Browse the repository at this point in the history
* feat: support Python 3.12

* fix: poetry lock

* feat: drop python 3.8

* fix: poetry lock

* fix: upgrade pyproject-flake8 version

* fix: downgrade python version for flake8

pyproject-flake8 doesn't support python 3.12
  • Loading branch information
kitagry committed Jan 16, 2024
1 parent cc1e849 commit 2b33286
Show file tree
Hide file tree
Showing 8 changed files with 1,130 additions and 1,095 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion gokart/pandas_type_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ def __init__(self, *args, **kwargs) -> None:
}

def check(self, obj, task_namespace: str):
if type(obj) == pd.DataFrame and task_namespace in self._map:
if isinstance(obj, pd.DataFrame) and task_namespace in self._map:
self._map[task_namespace].check(obj)
4 changes: 2 additions & 2 deletions gokart/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def get_info(self, only_significant=False):
params = dict(self.get_params())
for param_name, param_value in self.param_kwargs.items():
if (not only_significant) or params[param_name].significant:
if type(params[param_name]) == gokart.TaskInstanceParameter:
if isinstance(params[param_name], gokart.TaskInstanceParameter):
params_str[param_name] = type(param_value).__name__ + '-' + param_value.make_unique_id()
else:
params_str[param_name] = params[param_name].serialize(param_value)
Expand Down Expand Up @@ -452,7 +452,7 @@ def _get_module_versions(self) -> str:
for x in set([x.split('.')[0] for x in globals().keys() if isinstance(x, types.ModuleType) and '_' not in x]):
module = import_module(x)
if '__version__' in dir(module):
if type(module.__version__) == str:
if isinstance(module.__version__, str):
version = module.__version__.split(" ")[0]
else:
version = '.'.join([str(v) for v in module.__version__])
Expand Down
2 changes: 1 addition & 1 deletion gokart/tree/task_info_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def make_task_info_tree(task: TaskOnKart, ignore_task_names: Optional[List[str]]

params = task.get_info(only_significant=True)
processing_time = task.get_processing_time()
if type(processing_time) == float:
if isinstance(processing_time, float):
processing_time = str(processing_time) + 's'
is_complete = ('COMPLETE' if is_task_complete else 'PENDING')
task_log = dict(task.get_task_log())
Expand Down
2,205 changes: 1,120 additions & 1,085 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ style = "pep440"
pattern = "^(?P<base>\\d+\\.\\d+\\.\\d+)"

[tool.poetry.dependencies]
python = ">=3.8,<3.12"
python = ">=3.9,<3.13"
luigi = "*"
boto3 = "*"
slack-sdk = "^3"
Expand All @@ -32,7 +32,7 @@ redis = "*"
matplotlib = "*"

[tool.poetry.group.dev.dependencies]
pyproject-flake8 = "5.0.4"
pyproject-flake8 = "^6.1.0"
tox = "*"
moto = "*"
testfixtures = "*"
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{38,39,310,311},yapf,isort,flake8,mypy
envlist = py{39,310,311,312},yapf,isort,flake8,mypy
isolated_build = true

[testenv]
Expand Down Expand Up @@ -29,7 +29,7 @@ commands = mypy gokart test {posargs}

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

0 comments on commit 2b33286

Please sign in to comment.