diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index adafe1f5b..51f241d9d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,7 +8,7 @@ env: CD: "true" ACTIONS_STEP_DEBUG: ${{ secrets.ACTIONS_STEP_DEBUG }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PYTHON_DEFAULT_VERSION: "3.11" + PYTHON_DEFAULT_VERSION: "3.12" jobs: deploy: @@ -54,7 +54,7 @@ jobs: needs: deploy runs-on: ubuntu-latest container: - image: "python:3.11" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here + image: "python:3.12" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here env: DEBIAN_FRONTEND: noninteractive steps: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64d7b7883..cc21f907a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [master] env: - PYTHON_DEFAULT_VERSION: "3.11" + PYTHON_DEFAULT_VERSION: "3.12" jobs: lint: @@ -104,7 +104,7 @@ jobs: run: nox -vs integration -- -m "not require_secrets" - name: Run integration tests (with secrets) # Limit CI workload by running integration tests with secrets only on edge Python versions. - if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.7", "pypy-3.10-nightly", "3.11"]'), matrix.python-version) }} + if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.7", "pypy-3.10-nightly", "3.12"]'), matrix.python-version) }} run: nox -vs integration -- -m "require_secrets" --cleanup test-docker: needs: cleanup_buckets @@ -147,7 +147,7 @@ jobs: B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} runs-on: ubuntu-latest container: - image: "python:3.11" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here + image: "python:3.12" # can not use ${{ env.PYTHON_DEFAULT_VERSION }} here env: DEBIAN_FRONTEND: noninteractive steps: diff --git a/b2/console_tool.py b/b2/console_tool.py index 37564fe1a..812dcdc9f 100644 --- a/b2/console_tool.py +++ b/b2/console_tool.py @@ -2004,7 +2004,7 @@ def timestamp_display(self, timestamp_or_none): return '-', '-' else: timestamp = timestamp_or_none - dt = datetime.datetime.utcfromtimestamp(timestamp / 1000) + dt = datetime.datetime.fromtimestamp(timestamp / 1000, datetime.timezone.utc) return dt.strftime('%Y-%m-%d'), dt.strftime('%H:%M:%S') @@ -2216,7 +2216,7 @@ def format_folder_ls_entry(self, name, replication: bool): return self.LS_ENTRY_TEMPLATE % ('-', '-', '-', '-', 0, name) def format_ls_entry(self, file_version: FileVersion, replication: bool): - dt = datetime.datetime.utcfromtimestamp(file_version.upload_timestamp / 1000) + dt = datetime.datetime.fromtimestamp(file_version.upload_timestamp / 1000, datetime.timezone.utc) date_str = dt.strftime('%Y-%m-%d') time_str = dt.strftime('%H:%M:%S') size = file_version.size or 0 # required if self.action == 'hide' diff --git a/changelog.d/+python3.12.infrastructure.md b/changelog.d/+python3.12.infrastructure.md new file mode 100644 index 000000000..6b96af83a --- /dev/null +++ b/changelog.d/+python3.12.infrastructure.md @@ -0,0 +1 @@ +Use cpython 3.12 (not 3.11) for integration tests with secrets \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index 2c0d5c974..cf3ac7b67 100644 --- a/noxfile.py +++ b/noxfile.py @@ -19,7 +19,6 @@ from typing import List, Tuple import nox -import pkg_resources CI = os.environ.get('CI') is not None CD = CI and (os.environ.get('CD') is not None) @@ -33,9 +32,9 @@ '3.9', '3.10', '3.11', + '3.12', ] if NOX_PYTHONS is None else NOX_PYTHONS.split(',') PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-1] -PYTHON_VERSIONS += ['3.12'] # move this into PYTHON_VERSION above after official 3.12 release PY_PATHS = ['b2', 'test', 'noxfile.py', 'setup.py'] @@ -114,7 +113,7 @@ def install_myself(session, extras=None): cwd = os.getcwd() os.chdir(INSTALL_SDK_FROM) session.run('pip', 'uninstall', 'b2sdk', '-y') - session.run('python', 'setup.py', 'develop') + session.run('pip', 'install', '-e', '.') os.chdir(cwd) elif CI and not CD: # In CI, install B2 SDK from the master branch @@ -164,9 +163,8 @@ def lint(session): updated_requirements = os.path.join(session.create_tmp(), 'requirements.txt') with open('requirements.txt') as orig_req_file, \ open(updated_requirements, 'w') as updated_req_file: - requirements = pkg_resources.parse_requirements(orig_req_file) - for requirement in requirements: - if requirement.project_name == "b2sdk": + for requirement in orig_req_file.readlines(): + if requirement.startswith("b2sdk"): updated_req_file.write("b2sdk\n") else: updated_req_file.write(f"{requirement}\n") diff --git a/requirements.txt b/requirements.txt index 79f6c88b3..431d5a6be 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ argcomplete>=2,<4 arrow>=1.0.2,<2.0.0 -b2sdk>=1.26.0,<2 +b2sdk @ git+https://github.com/reef-technologies/b2-sdk-python@32cd40e93458ed359000b21456a75226ac85c539 docutils>=0.18.1 idna~=3.4; platform_system == 'Java' importlib-metadata~=3.3; python_version < '3.8'