diff --git a/.github/workflows/base_benchmarks.yml b/.github/workflows/base_benchmarks.yml index 7e9e3446a..b2e368a2e 100644 --- a/.github/workflows/base_benchmarks.yml +++ b/.github/workflows/base_benchmarks.yml @@ -22,7 +22,7 @@ jobs: - uses: ./.github/actions/setup-hathor-env name: Setup Hathor node environment with: - python: 3.11 + python: 3.12 os: ubuntu-22.04 - name: Set env vars run: cat ./extras/benchmarking/sync_v2/.env >> $GITHUB_ENV diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 88d8898df..f64c79d3a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,7 +23,6 @@ jobs: python-impl: - python python-version: - - '3.10' - '3.11' - '3.12' steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 12c57b0fa..687ec9317 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: import os import json full_matrix = { - 'python': ['3.10', '3.11', '3.12'], + 'python': ['3.11', '3.12'], # available OS's: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on 'os': ['ubuntu-22.04', 'macos-13'], } @@ -83,6 +83,6 @@ jobs: run: poetry run make tests - name: Upload coverage uses: codecov/codecov-action@v4 - if: matrix.python == 3.11 && startsWith(matrix.os, 'ubuntu') + if: matrix.python == 3.12 && startsWith(matrix.os, 'ubuntu') env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/pr_benchmarks.yml b/.github/workflows/pr_benchmarks.yml index a8d9e9dc0..a4aa0fc1e 100644 --- a/.github/workflows/pr_benchmarks.yml +++ b/.github/workflows/pr_benchmarks.yml @@ -26,7 +26,7 @@ jobs: - uses: ./.github/actions/setup-hathor-env name: Setup Hathor node environment with: - python: 3.11 + python: 3.12 os: ubuntu-22.04 - name: Set env vars run: cat ./extras/benchmarking/sync_v2/.env >> $GITHUB_ENV diff --git a/Dockerfile b/Dockerfile index f1fa13f38..507a2ac46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -# before changing these variables, make sure the tag $PYTHON-alpine$ALPINE exists first +# before changing these variables, make sure the tag $PYTHON-slim-$DEBIAN exists first # list of valid tags hese: https://hub.docker.com/_/python -ARG PYTHON=3.11 +ARG PYTHON=3.12 ARG DEBIAN=bullseye # stage-0: copy pyproject.toml/poetry.lock and install the production set of dependencies diff --git a/extras/github/test_docker.py b/extras/github/test_docker.py index b5db27e67..6a5cadc3a 100644 --- a/extras/github/test_docker.py +++ b/extras/github/test_docker.py @@ -3,8 +3,8 @@ from extras.github.docker import prep_base_version, prep_tags -DEFAULT_PYTHON_VERSION = '3.11' -NON_DEFAULT_PYTHON_VERSION = '3.10' +DEFAULT_PYTHON_VERSION = '3.12' +NON_DEFAULT_PYTHON_VERSION = '3.11' class DockerWorkflowTest(unittest.TestCase): diff --git a/flake.nix b/flake.nix index ba17e7ef4..ad53f7d81 100644 --- a/flake.nix +++ b/flake.nix @@ -33,7 +33,7 @@ shellHook = '' export CFLAGS="-I${pkgs.rocksdb}/include" export LDFLAGS="-L${pkgs.rocksdb}/lib" - poetry env use python3.10 + poetry env use python3.11 ''; }; }); diff --git a/hathor/cli/run_node.py b/hathor/cli/run_node.py index 31151363d..07bc93b25 100644 --- a/hathor/cli/run_node.py +++ b/hathor/cli/run_node.py @@ -456,9 +456,9 @@ def check_unsafe_arguments(self) -> None: def check_python_version(self) -> None: # comments to help grep's - MIN_VER = (3, 10) # Python-3.10 - MIN_STABLE = (3, 10) # Python-3.10 - RECOMMENDED_VER = (3, 10) # Python-3.10 + MIN_VER = (3, 11) # Python-3.11 + MIN_STABLE = (3, 12) # Python-3.12 + RECOMMENDED_VER = (3, 12) # Python-3.12 cur = sys.version_info cur_pretty = '.'.join(map(str, cur)) min_pretty = '.'.join(map(str, MIN_VER)) diff --git a/hathor/p2p/protocol.py b/hathor/p2p/protocol.py index b582fcb77..b8e9429ac 100644 --- a/hathor/p2p/protocol.py +++ b/hathor/p2p/protocol.py @@ -315,11 +315,6 @@ def recv_message(self, cmd: ProtocolMessages, payload: str) -> None: self.peer.info.last_seen = now if not self.ratelimit.add_hit(self.RateLimitKeys.GLOBAL): - # XXX: on Python 3.11 the result of the following expression: - # '{}'.format(HathorProtocol.RateLimitKeys.GLOBAL) - # is not 'global' but 'RateLimitKeys.GLOBAL', even though the enum value *is* a string, but it seems - # that something like `str(value)` is called which results in a different value (usually not the case - # for regular strings, but it is for enum+str), using `enum_variant.value` side-steps this problem self.state.send_throttle(self.RateLimitKeys.GLOBAL.value) return diff --git a/poetry.lock b/poetry.lock index 930bf7942..f7c20c21e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -101,7 +101,6 @@ files = [ [package.dependencies] aiohappyeyeballs = ">=2.3.0" aiosignal = ">=1.1.2" -async-timeout = {version = ">=4.0,<5.0", markers = "python_version < \"3.11\""} attrs = ">=17.3.0" frozenlist = ">=1.1.1" multidict = ">=4.5,<7.0" @@ -157,19 +156,6 @@ six = ">=1.12.0" astroid = ["astroid (>=1,<2) ; python_version < \"3\"", "astroid (>=2,<4) ; python_version >= \"3\""] test = ["astroid (>=1,<2) ; python_version < \"3\"", "astroid (>=2,<4) ; python_version >= \"3\"", "pytest"] -[[package]] -name = "async-timeout" -version = "4.0.3" -description = "Timeout context manager for asyncio programs" -optional = false -python-versions = ">=3.7" -groups = ["main"] -markers = "python_version == \"3.10\"" -files = [ - {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, - {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, -] - [[package]] name = "attrs" version = "23.1.0" @@ -478,9 +464,6 @@ files = [ {file = "coverage-7.4.0.tar.gz", hash = "sha256:707c0f58cb1712b8809ece32b68996ee1e609f71bd14615bd8f87a1293cb610e"}, ] -[package.dependencies] -tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} - [package.extras] toml = ["tomli ; python_full_version <= \"3.11.0a6\""] @@ -579,22 +562,6 @@ files = [ {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, ] -[[package]] -name = "exceptiongroup" -version = "1.2.0" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -groups = ["dev"] -markers = "python_version == \"3.10\"" -files = [ - {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, - {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, -] - -[package.extras] -test = ["pytest (>=6)"] - [[package]] name = "execnet" version = "2.1.1" @@ -819,7 +786,6 @@ files = [ [package.dependencies] setuptools = ">=61.0" -tomli = {version = "*", markers = "python_version < \"3.11\""} [package.extras] scripts = ["click (>=6.0)"] @@ -1169,7 +1135,6 @@ files = [ [package.dependencies] mypy-extensions = ">=1.0.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typing-extensions = ">=4.1.0" [package.extras] @@ -1592,11 +1557,9 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=1.5,<2" -tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] @@ -2171,19 +2134,6 @@ files = [ [package.dependencies] sentry-sdk = "*" -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -groups = ["main", "dev"] -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] -markers = {main = "python_version == \"3.10\"", dev = "python_full_version <= \"3.11.0a6\""} - [[package]] name = "tornado" version = "6.4" @@ -2606,5 +2556,5 @@ sentry = ["sentry-sdk", "structlog-sentry"] [metadata] lock-version = "2.1" -python-versions = ">=3.10,<4" -content-hash = "6d9f6d43e3bf109d181f3bf5e5ceaa340824ad07576f3411d8bf74b3eee933a8" +python-versions = ">=3.11,<4" +content-hash = "013eb68a302d99d8ac58bcd488f016fbb0543af9340b130c43691308cdf97c58" diff --git a/pyproject.toml b/pyproject.toml index 82a780a9f..094f1ea4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ homepage = "https://hathor.network/" repository = "https://github.com/HathorNetwork/hathor-core/" # https://pypi.org/classifiers/ classifiers = [ - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", @@ -51,7 +50,7 @@ types-pyopenssl = "=22.1.0.2" types-pyyaml = "=6.0.12.9" [tool.poetry.dependencies] -python = ">=3.10,<4" +python = ">=3.11,<4" twisted = "~24.7.0" autobahn = "~24.4.2" base58 = "~2.1.1"