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

Upgrade python to v3.11 #505

Merged
merged 3 commits into from
Mar 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ repos:
rev: 23.3.0
hooks:
- id: black
language_version: python3.10
language_version: python3.11
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~apl/.bash_profile \
# install python
USER apl
RUN . ~/.bash_profile \
&& pyenv install 3.10.4 \
&& pyenv global 3.10.4 \
&& pyenv install 3.11.2 \
&& pyenv global 3.11.2 \
&& pip install --upgrade pip

# install poetry
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ English | [日本語](./README_JA.md)

## Dependencies

- [Python3](https://www.python.org/downloads/release/python-3811/) - version 3.10
- [Python3](https://www.python.org/downloads/release/python-3811/) - version 3.11
- [PostgreSQL](https://www.postgresql.org/) - version 13
- [GoQuorum](https://github.com/ConsenSys/quorum)
- We support the official GoQuorum node of [ibet-Network](https://github.com/BoostryJP/ibet-Network).
Expand Down Expand Up @@ -50,7 +50,7 @@ English | [日本語](./README_JA.md)

Install python packages with:
```bash
$ poetry install --no-root --only main -E explorer
$ poetry install --no-root --only main -E ibet-explorer
```

### Install pre-commit hook
Expand Down
4 changes: 2 additions & 2 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

## 依存

- [Python3](https://www.python.org/downloads/release/python-3811/) - バージョン 3.10
- [Python3](https://www.python.org/downloads/release/python-3811/) - バージョン 3.11
- [PostgreSQL](https://www.postgresql.org/) - バージョン 13
- [GoQuorum](https://github.com/ConsenSys/quorum)
- [ibet-Network](https://github.com/BoostryJP/ibet-Network) の公式の GoQuorum をサポートしています。
Expand Down Expand Up @@ -51,7 +51,7 @@

以下のコマンドで Python パッケージをインストールします。
```bash
$ poetry install --no-root --only main -E explorer
$ poetry install --no-root --only main -E ibet-explorer
```

### pre-commit hookのインストール
Expand Down
6 changes: 3 additions & 3 deletions app/routers/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def list_redeem_history(
query = query.limit(limit)
if offset is not None:
query = query.offset(offset)
_events: List[IDXIssueRedeem] = query.all()
_events: List[Type[IDXIssueRedeem]] = query.all()

history = []
for _event in _events:
Expand Down Expand Up @@ -1011,7 +1011,7 @@ def list_all_redeem_upload(
if offset is not None:
query = query.offset(offset)

_upload_list: list[BatchIssueRedeemUpload] = query.all()
_upload_list: list[Type[BatchIssueRedeemUpload]] = query.all()

uploads = []
for _upload in _upload_list:
Expand Down Expand Up @@ -1812,7 +1812,7 @@ def list_all_personal_info_batch_registration_uploads(
if offset is not None:
query = query.offset(offset)

_upload_list: list[BatchRegisterPersonalInfoUpload] = query.all()
_upload_list: list[Type[BatchRegisterPersonalInfoUpload]] = query.all()

uploads = []
for _upload in _upload_list:
Expand Down
6 changes: 3 additions & 3 deletions cmd/explorer/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cmd/explorer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ packages = [
]

[tool.poetry.dependencies]
python = "3.10.4"
python = "3.11.2"

[tool.poetry.scripts]
ibet-explorer = "src.main:app"

[tool.mypy]
python_version = "3.10"
python_version = "3.11"
no_strict_optional = true
ignore_missing_imports = true
check_untyped_defs = true

[tool.black]
includes = "src"
target-version = ['py310']
target-version = ['py311']
line-length = 120

[build-system]
Expand Down
4 changes: 2 additions & 2 deletions cmd/explorer/src/gui/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

SPDX-License-Identifier: Apache-2.0
"""
from enum import Enum
from enum import StrEnum

UP = "\u2191"
DOWN = "\u2193"
Expand All @@ -31,7 +31,7 @@
INFO = "[blue]:information:[/]"


class ID(str, Enum):
class ID(StrEnum):
BLOCK_CONNECTED = "block_connected"
BLOCK_CURRENT_BLOCK_NUMBER = "block_current_block_number"
BLOCK_IS_SYNCED = "block_is_synced"
Expand Down
4 changes: 2 additions & 2 deletions cmd/explorer/src/gui/widget/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ class Menu(TuiWidget):

def compose(self) -> ComposeResult:
yield Button(
Text.from_markup("\[t] Show Transactions :package:"),
Text.from_markup(r"\[t] Show Transactions :package:"),
id=ID.MENU_SHOW_TX,
classes="menubutton",
)
yield Button("\[c] Cancel", id=ID.MENU_CANCEL, classes="menubutton")
yield Button(r"\[c] Cancel", id=ID.MENU_CANCEL, classes="menubutton")

def show(self, ix: MenuInstruction):
self.ix = ix
Expand Down
2 changes: 1 addition & 1 deletion migrations/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def reset():
meta.bind = engine
table = Table("alembic_version", meta, schema=get_db_schema())
if table.exists():
table.drop()
table.drop(bind=engine)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bug in reset.



argv = sys.argv
Expand Down
39 changes: 3 additions & 36 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "Apache License, Version 2.0"
readme = "README.md"

[tool.poetry.dependencies]
python = "3.10.4"
python = "3.11.2"
alembic = "~1.9.4"
boto3 = "~1.26.82"
coincurve = "~18.0.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~apl/.bash_profile \
# install python
USER apl
RUN . ~/.bash_profile \
&& pyenv install 3.10.4 \
&& pyenv global 3.10.4 \
&& pyenv install 3.11.2 \
&& pyenv global 3.11.2 \
&& pip install --upgrade pip

# install poetry
Expand Down
10 changes: 5 additions & 5 deletions tests/test_batch_processor_batch_issue_redeem.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""
import logging
import uuid
from typing import List
from typing import List, Type
from unittest.mock import ANY, patch

import pytest
Expand Down Expand Up @@ -823,29 +823,29 @@ def test_error_4(
processor.process()

# Assertion: DB
_upload_1_after: BatchIssueRedeemUpload = (
_upload_1_after: Type[BatchIssueRedeemUpload] = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type-related warnings have been removed as much as possible. This warning seems to have occurred in py310 as well.

db.query(BatchIssueRedeemUpload)
.filter(BatchIssueRedeemUpload.upload_id == upload_1_id)
.first()
)
assert _upload_1_after.processed == True

_upload_1_data_after: List[BatchIssueRedeem] = (
_upload_1_data_after: List[Type[BatchIssueRedeem]] = (
db.query(BatchIssueRedeem)
.filter(BatchIssueRedeem.upload_id == upload_1_id)
.all()
)
assert len(_upload_1_data_after) == 1
assert _upload_1_data_after[0].status == 2

_upload_2_after: BatchIssueRedeemUpload = (
_upload_2_after: Type[BatchIssueRedeemUpload] = (
db.query(BatchIssueRedeemUpload)
.filter(BatchIssueRedeemUpload.upload_id == upload_2_id)
.first()
)
assert _upload_2_after.processed == True

_upload_2_data_after: List[BatchIssueRedeem] = (
_upload_2_data_after: List[Type[BatchIssueRedeem]] = (
db.query(BatchIssueRedeem)
.filter(BatchIssueRedeem.upload_id == upload_2_id)
.all()
Expand Down