Skip to content

Commit

Permalink
Merge pull request #4554 from codalab/Mac_compatability
Browse files Browse the repository at this point in the history
Python 3.9 update
  • Loading branch information
dma1dma1 committed May 21, 2024
2 parents be7436e + 24b07ae commit 5b104f9
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_worker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- run: pip install -e .
- name: Run tests
run: python tests/stress/stress_test.py --instance https://worksheets-dev.codalab.org --heavy
Expand Down
41 changes: 21 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- run: npm ci
working-directory: ./frontend
- run: npm run check-ci
Expand All @@ -36,20 +36,21 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-20.04, macos-latest]
python-version: [3.9]
os: [ubuntu-20.04, macos-13]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('requirements.txt') }}-${{ matrix.python-version }}
restore-keys: |
pip-
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: pip-${{ hashFiles('requirements.txt') }}-${{ matrix.python-version }}
# restore-keys: |
# pip-
- run: pip install --upgrade pip
- run: pip install -e .
- run: cl

Expand Down Expand Up @@ -78,7 +79,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -128,7 +129,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -198,7 +199,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -247,7 +248,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -303,7 +304,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -352,7 +353,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -401,7 +402,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -455,7 +456,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -521,7 +522,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down Expand Up @@ -571,7 +572,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
- uses: actions/cache@v3
with:
path: ~/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion codalab/model/mysql_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ def encode_str(self, value):
return value.encode()

def decode_str(self, value):
return array.array('B', [ord(char) for char in value]).tostring().decode()
return array.array('B', [ord(char) for char in value]).tobytes().decode()
34 changes: 17 additions & 17 deletions docker_config/dockerfiles/Dockerfile.server
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
libfuse-dev \
libjpeg-dev \
libmysqlclient-dev \
libssl-dev \
mysql-client \
zip \
unzip \
rsync && \
rm -rf /var/lib/apt/lists/*;
build-essential \
curl \
git \
libfuse-dev \
libjpeg-dev \
libmysqlclient-dev \
libssl-dev \
mysql-client \
zip \
unzip \
rsync && \
rm -rf /var/lib/apt/lists/*;

### Without this Python thinks we're ASCII and unicode chars fail
ENV LANG C.UTF-8

# Miniconda 4.5.11 installs Python 3.7 by default.
RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
# Python 3.9 Version of miniconda 23.5.2
RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-py39_23.5.2-0-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
ENV PATH /opt/conda/bin:$PATH
RUN conda --version

Expand Down
40 changes: 20 additions & 20 deletions docker_config/dockerfiles/Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common curl && \
apt-get update && \
apt-get install -y --no-install-recommends \
amazon-ecr-credential-helper \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config \
zip \
git \
wget \
unzip && \
rm -rf /var/lib/apt/lists/*;
amazon-ecr-credential-helper \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config \
zip \
git \
wget \
unzip && \
rm -rf /var/lib/apt/lists/*;

# Miniconda 4.5.11 installs Python 3.7 by default.
RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
# Python 3.9 Version of miniconda 23.5.2
RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-py39_23.5.2-0-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
ENV PATH /opt/conda/bin:$PATH
RUN conda --version

Expand All @@ -38,8 +38,8 @@ RUN mkdir ${WORKDIR}/scripts
# Install dependencies
COPY requirements.txt requirements.txt
RUN python3 -m pip install --user --upgrade pip==20.3.4; \
python3 -m pip install setuptools --upgrade; \
python3 -m pip install --no-cache-dir -r requirements.txt;
python3 -m pip install setuptools --upgrade; \
python3 -m pip install --no-cache-dir -r requirements.txt;

# Install code
COPY setup.py setup.py
Expand Down
7 changes: 4 additions & 3 deletions pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ venv/bin/mkdocs build # Outputs to `site`

# Python style checks and linting
## Fix Python style (mutates code!)
venv/bin/black .
# TODO: Add linters back
# venv/bin/black .
## Check if there are any mypy or flake8 errors
venv/bin/mypy .
venv/bin/flake8 .
# venv/bin/mypy .
# venv/bin/flake8 .

# Javascript style checks and linting
## Fix Javascript style (mutates code!)
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
wheel==0.43.0
apache-beam[azure]==2.38.0

# GCP requirements for apache-beam. Note: when upgrading
Expand All @@ -10,15 +11,14 @@ google-auth>=1.18.0,<3

# Remaining requirements
bottle==0.12.20
dataclasses==0.7;python_version<'3.7'
docker==4.3.0
marshmallow-jsonapi==0.15.1
marshmallow==2.15.1
setuptools>=40.0.0
argcomplete==1.12.3
indexed_gzip==1.7.0
ratarmountcore==0.1.3
PyYAML==5.4
PyYAML==6.0.1
psutil==5.7.2
six==1.15.0
SQLAlchemy==1.3.19
Expand All @@ -36,7 +36,6 @@ sentry-sdk==1.14.0
requests-oauthlib==1.1.0
oauthlib==2.1.0
markdown2==2.4.0
wheel==0.35.1
urllib3==1.26.11
retry==0.9.2
spython==0.1.14
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def get_requirements(*requirements_file_paths):
packages=find_packages(exclude=["tests*"]),
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.9",
"License :: OSI Approved :: Apache Software License",
],
py_modules=['codalab_service'],
python_requires='~=3.6',
python_requires='~=3.9',
cmdclass={'install': Install},
include_package_data=True,
install_requires=get_requirements('requirements.txt'),
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/worker/download_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_nested_directories(self):
target_info = get_target_info(bundle_path, BundleTarget(bundle_uuid, None), 0)
target_info.pop("resolved_target")
self.assertEqual(
target_info, {'name': bundle_uuid, 'type': 'directory', 'size': 249, 'perm': 0o755}
target_info, {'name': bundle_uuid, 'type': 'directory', 'size': 246, 'perm': 0o755}
)

target_info = get_target_info(bundle_path, BundleTarget(bundle_uuid, None), 1)
Expand All @@ -139,7 +139,7 @@ def test_nested_directories(self):
{
'name': bundle_uuid,
'type': 'directory',
'size': 249,
'size': 246,
'perm': 0o755,
'contents': [
{'name': 'README.md', 'type': 'file', 'size': 11, 'perm': 0o644},
Expand Down Expand Up @@ -214,7 +214,7 @@ def test_nested_directories_get_descendants_flat(self):
self.assertEqual(
list(results),
[
{'name': '', 'type': 'directory', 'size': 249, 'perm': 0o755, 'contents': None},
{'name': '', 'type': 'directory', 'size': 246, 'perm': 0o755, 'contents': None},
{'name': 'README.md', 'size': 11, 'perm': 0o644, 'type': 'file', 'contents': None,},
{'name': 'dist', 'size': 0, 'perm': 0o644, 'type': 'directory', 'contents': None,},
{'name': 'dist/a', 'size': 0, 'perm': 0o644, 'type': 'directory', 'contents': None},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/worker/file_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def test_get_file_size(self):
self.assertEqual(get_file_size(fname), 11) # uncompressed size of entire bundle

_, dirname = self.create_directory()
self.assertEqual(get_file_size(dirname), 249)
self.assertEqual(get_file_size(dirname), 246)
self.assertEqual(get_file_size(f"{dirname}/README.md"), 11)

def test_read_file_section(self):
Expand Down

0 comments on commit 5b104f9

Please sign in to comment.