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

use python 3.12 #228

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [master]

env:
PYTHON_DEFAULT_VERSION: "3.11"
PYTHON_DEFAULT_VERSION: "3.12"

jobs:
lint:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions b2/console_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down Expand Up @@ -2216,7 +2216,9 @@ 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'
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+python3.12.infrastructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use cpython 3.12 (not 3.11) for integration tests with secrets
10 changes: 4 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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']

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
argcomplete>=2,<4
arrow>=1.0.2,<2.0.0
b2sdk>=1.26.0,<2
b2sdk>=1.27.0,<2
docutils>=0.18.1
idna~=3.4; platform_system == 'Java'
importlib-metadata~=3.3; python_version < '3.8'
Expand Down
Loading