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

サポートするPythonバージョンを「3.8以上」から「3.9以上」に変更しました。 #137

Merged
merged 17 commits into from
Aug 5, 2024

Conversation

yuji38kwmt
Copy link
Collaborator

@yuji38kwmt yuji38kwmt commented Aug 1, 2024

VSCode Dev Containers

  • VSCode Dev ContainersのPython環境を3.8から3.12に変更しました。
    • Ubuntu 18.04から22.04に変更しました。
    • Dockerfileの不要な設定(docker composeなど)を削除しました。
    • devcontainer.jsonで不要な設定を削除しました。

pyproject.toml

  • pyproject.toml : サポートするPythonバージョンを「3.8以上」から、「3.9以上」に変更しました。
  • リンターである mypy, flake8, pylintのバージョンを最新にしました。flake8がPython3.12で動作しなかったためです。
    • リンターを最新にしたことで新しく発生したエラーは無視するようにしました。
poetry run mypy anno3d tests
anno3d/annofab/specifiers/extended_specs_label_specifiers_v1.py:28: error: Argument "field_values" to "replace" of "LabelV3" has incompatible type "dict[str, dict[Any, Any] | list[Any] | str | int | float | bool | None]"; expected "dict[str, dict[str, Any]]"  [arg-type]
anno3d/annofab/specifiers/extended_specs_label_specifiers_v1.py:46: error: Argument "field_values" to "replace" of "LabelV3" has incompatible type "dict[str, dict[Any, Any] | list[Any] | str | int | float | bool | None]"; expected "dict[str, dict[str, Any]]"  [arg-type]

補足

先に #138 をマージしてから、このpull requestをマージします。

],
// "poetry run"コマンドで実行することを想定しているので、venv環境を自動的にactivateしないようにする
"python.terminal.activateEnvironment":false,

"python.formatting.blackPath": ".venv/bin/black",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

VSCode 1.91.1で警告が出るので削除しました。

],
"python.analysis.completeFunctionParens": true,
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

VSCode 1.91.1の警告に従い修正しました。

@@ -20,7 +20,7 @@ def open_resource(self) -> Generator[Resource, None, None]:
endpoint = (
self._annofab_endpoint if self._annofab_endpoint is not None else annofabapi.resource.DEFAULT_ENDPOINT_URL
)
resource = annofabapi.build(self._annofab_id, self._annofab_pass, endpoint)
resource = annofabapi.build(self._annofab_id, self._annofab_pass, endpoint_url=endpoint)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

最新の annofabapi 0.74.0でエラーが出ないように修正しました。

"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Utilities",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

poetry buildでPython関係のclassifiersは自動で生成されるので、削除しました。
https://qiita.com/yuji38kwmt/items/dbf6d20666c054d84e14

@yuji38kwmt yuji38kwmt changed the title Update docker サポートするPythonバージョンを「3.8以上」から「3.9以上」に変更しました。 Aug 2, 2024
@yuji38kwmt yuji38kwmt marked this pull request as ready for review August 2, 2024 02:58
@@ -7,7 +7,7 @@


def camelcase(cls: Type[A]) -> Type[A]:
cls.dataclass_json_config = config(letter_case=LetterCase.CAMEL)["dataclasses_json"] # type: ignore
cls.dataclass_json_config = config(letter_case=LetterCase.CAMEL)["dataclasses_json"] # type: ignore[assignment]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

mypy 1.11では、type: ignoreだけではエラーが出るので、ignore[assignment}と記載する


install:
- pip install pip --upgrade
- pip install poetry==1.1.15 setuptools==50.3.2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Poetryはsetupptolsは必須としていないので、削除しました。
https://python-poetry.org/docs/configuration#virtualenvsoptionsno-setuptools

Copy link
Contributor

@seraphr seraphr left a comment

Choose a reason for hiding this comment

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

直接仮想環境を作って&dev container内で仮想環境をつくって、lint / test が動いていることを確認した

@seraphr seraphr merged commit 91eac6e into master Aug 5, 2024
2 checks passed
@seraphr seraphr deleted the update-docker branch August 5, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants