Skip to content

Commit eeb4fa3

Browse files
committed
python 3.12 wip
1 parent f61854d commit eeb4fa3

File tree

9 files changed

+45
-13
lines changed

9 files changed

+45
-13
lines changed

Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM python:3.9-slim
1+
FROM python:3.12-slim
22

3-
MAINTAINER brian <[email protected]>
3+
LABEL org.opencontainers.image.authors="brian <[email protected]>"
44

5-
ENV LANG C.UTF-8
6-
ENV LC_ALL C.UTF-8
5+
ENV LANG=C.UTF-8
6+
ENV LC_ALL=C.UTF-8
77

88
# TODO: keep requirements in one place
99
RUN pip install \
@@ -29,20 +29,26 @@ RUN pip install \
2929
pyinotify>=0.9.4, \
3030
raven>=5.0.0 \
3131
'tox>4,<5' \
32+
# v80 removes many setup.py develop otions
33+
'setuptools<80.0.0' \
3234
'datalake<2'
3335

36+
# RUN pip install -U pip
37+
3438
RUN mkdir -p /opt/
3539
COPY . /opt/
3640

41+
# RUN pip install -e /opt/client[test]
42+
3743
# Take care to install clients such that the source code can be mounted into
3844
# the container and used for development. That is, the python paths and paths
3945
# to console scripts Just Work (TM)
4046
ENV PYTHONPATH=/opt/client:/opt/ingester:/opt/api
4147
RUN for d in ingester api; do \
4248
cd /opt/$d && \
43-
python setup.py develop -s /usr/local/bin \
49+
python setup.py develop --script-dir /usr/local/bin \
4450
--egg-path ../../../../../opt/$d/ \
45-
-d /usr/local/lib/python3.9/site-packages/ \
51+
-d /usr/local/lib/python3.12/site-packages/ \
4652
--no-deps; \
4753
done
4854

api/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_version_from_pyver():
3030
if 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
3131
raise ImportError('You must install pyver to create a package')
3232
else:
33-
return 'noversion'
33+
return '0.dev'
3434
version, version_info = pyver.get_version(pkg="datalake_api",
3535
public=True)
3636
return version

client/datalake/scripts/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def wrapped(*args, **kwargs):
6868
'environment variables, which can be overridden by '
6969
'command-line arguments.'),
7070
envvar='DATALAKE_CONFIG')
71-
@click.option('-u', '--storage-url',
71+
@click.option('-U', '--storage-url',
7272
help=('The URL to the top-level storage resource where '
7373
'datalake will archive all the files (e.g., '
7474
's3://my-datalake). DATALAKE_STORAGE_URL is the '

client/datalake/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
try:
23-
from moto import mock_s3
23+
from moto import mock_aws
2424
import boto3
2525
from six.moves.urllib.parse import urlparse
2626
import json
@@ -142,7 +142,7 @@ def tear_down():
142142

143143
@pytest.fixture
144144
def s3_connection(aws_connector):
145-
with mock_s3():
145+
with mock_aws():
146146
yield boto3.resource('s3')
147147

148148

client/got.txt

Lines changed: 3 additions & 0 deletions
Large diffs are not rendered by default.

client/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ dynamic = ["version"]
3737
test = [
3838
'pytest<8.0.0',
3939
'pytest-cov>=2.5.1,<4',
40-
'moto[s3]>4,<5',
40+
'moto[s3]>5',
4141
'twine<4.0.0',
42-
'pip>=20.0.0,<22.0.0',
42+
# 'pip>=20.0.0,<22.0.0',
43+
'pip>=20.0.0',
4344
'wheel<0.38.0',
4445
'flake8>=2.5.0,<4.1',
4546
'responses<0.22.0',

client/test/test_archive.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ def test_push_file(archive, random_metadata, tmpfile, s3_object):
3636
def test_push_large_file(
3737
monkeypatch, archive, random_metadata, tmpfile, s3_object):
3838
monkeypatch.setenv('DATALAKE_CHUNK_SIZE_MB', '5')
39+
from botocore.httpchecksum import StreamingChecksumBody
40+
41+
# When testing with Moto, newer versions of boto3/botocore cause a
42+
# FlexibleChecksumError because Moto doesn't supply the checksum headers
43+
# that boto3 now expects. The standard config objects can fail to apply
44+
# to the underlying S3 transfer manager.
45+
# The most reliable way to disable this for tests is to directly patch
46+
# the validation function in botocore to do nothing.
47+
monkeypatch.setattr(
48+
StreamingChecksumBody,
49+
"_validate_checksum",
50+
lambda _: None)
51+
3952
expected_content = ('big data' * 1024 * 1024).encode('utf-8')
4053
f = tmpfile(expected_content)
4154
url = archive.prepare_metadata_and_push(f, **random_metadata)

client/test/test_cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,12 @@ def test_push_with_translation_expression(cli_tester, tmpdir):
101101
cmd += '--what=job --start=now --end=now --where=hostname '
102102
cmd += str(f)
103103
cli_tester(cmd)
104+
105+
106+
@pytest.mark.xfail(reason="We don't want the CLI to raise warnings.",
107+
strict=True)
108+
def test_no_duplicate_parameters(cli_tester):
109+
# Unfortunately there is no clean way to test if a warning is NOT emitted.
110+
# So we have to test that a warning IS emitted and XFAIL.
111+
with pytest.warns(UserWarning, match='Remove its duplicate as parameters'):
112+
cli_tester('--help')

ingester/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_version_from_pyver():
3030
if 'sdist' in sys.argv or 'bdist_wheel' in sys.argv:
3131
raise ImportError('You must install pyver to create a package')
3232
else:
33-
return 'noversion'
33+
return '0.dev'
3434
version, version_info = pyver.get_version(pkg="datalake_ingester",
3535
public=True)
3636
return version

0 commit comments

Comments
 (0)