Skip to content

Commit

Permalink
Dropping Python 3.8, add support for 3.12 & 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWilkie committed Nov 18, 2024
1 parent 364f2ce commit c476a19
Show file tree
Hide file tree
Showing 16 changed files with 1,376 additions and 984 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/JOB_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
python-version: ["3.12"]
poetry-version: ["1.3.1"]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Free Disk space
shell: bash
if: matrix.os == 'ubuntu-latest'
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/JOB_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.11"
python-version: "3.12"

- name: Show filenames
run: echo ${{ inputs.files }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/JOB_generate_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/JOB_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.10"
python-version: "3.12"

- name: Show filenames
run: echo ${{ inputs.files }}
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/JOB_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
exclude:
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.9"
include:
- os: macos-13
python-version: "3.8"
- os: macos-13
python-version: "3.9"
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Free Disk space
shell: bash
if: matrix.os == 'ubuntu-latest'
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
Expand All @@ -35,7 +31,6 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref || github.ref }}

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/JOB_typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.10"
python-version: "3.12"

- name: Show filenames
run: echo ${{ inputs.files }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Main functions are (but not limited to):
- Upload/download data to/from remote datasets
- Direct integration with PyTorch dataloaders

Support tested for python 3.8 - 3.10
Support tested for python 3.9 - 3.12

## 🏁 Installation

Expand Down
37 changes: 19 additions & 18 deletions darwin/importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,10 @@ def _import_properties(
metadata_property_classes, metadata_item_props = _parse_metadata_file(metadata_path)

# Get team properties
team_properties_annotation_lookup, team_item_properties_lookup = (
_get_team_properties_annotation_lookup(client, dataset.team)
)
(
team_properties_annotation_lookup,
team_item_properties_lookup,
) = _get_team_properties_annotation_lookup(client, dataset.team)

# Build metadata lookups
(
Expand Down Expand Up @@ -748,12 +749,13 @@ def _import_properties(
].add(t_prop_val.id)

# Create/Update team item properties based on metadata
item_properties_to_create_from_metadata, item_properties_to_update_from_metadata = (
_create_update_item_properties(
_normalize_item_properties(metadata_item_prop_lookup),
team_item_properties_lookup,
client,
)
(
item_properties_to_create_from_metadata,
item_properties_to_update_from_metadata,
) = _create_update_item_properties(
_normalize_item_properties(metadata_item_prop_lookup),
team_item_properties_lookup,
client,
)

console = Console(theme=_console_theme())
Expand Down Expand Up @@ -804,9 +806,10 @@ def _import_properties(
updated_properties.append(prop)

# get latest team properties
team_properties_annotation_lookup, team_item_properties_lookup = (
_get_team_properties_annotation_lookup(client, dataset.team)
)
(
team_properties_annotation_lookup,
team_item_properties_lookup,
) = _get_team_properties_annotation_lookup(client, dataset.team)

# Update item-level properties from annotations
_, item_properties_to_update_from_annotations = _create_update_item_properties(
Expand Down Expand Up @@ -835,9 +838,10 @@ def _import_properties(
updated_properties.append(prop)

# get latest team properties
team_properties_annotation_lookup, team_item_properties_lookup = (
_get_team_properties_annotation_lookup(client, dataset.team)
)
(
team_properties_annotation_lookup,
team_item_properties_lookup,
) = _get_team_properties_annotation_lookup(client, dataset.team)

# loop over metadata_cls_id_prop_lookup, and update additional metadata property values
for (annotation_class_id, prop_name), m_prop in metadata_cls_id_prop_lookup.items():
Expand Down Expand Up @@ -987,7 +991,6 @@ def _create_update_item_properties(

# If the property exists in the team, check that all values are present
if item_prop_name in team_item_properties_lookup:

t_prop = team_item_properties_lookup[item_prop_name]
# If the property is a text property it won't have predefined values, so continue
if t_prop.type == "text":
Expand All @@ -1014,7 +1017,6 @@ def _create_update_item_properties(

# If the property does not exist in the team, create it
else:

# If we've already planned to create this property, simply extend the property values
for prop in create_properties:
if prop.name == item_prop_name:
Expand Down Expand Up @@ -1957,7 +1959,6 @@ def _overwrite_warning(
files_with_item_properties_to_overwrite.append(local_file.full_path)

if files_with_annotations_to_overwrite or files_with_item_properties_to_overwrite:

# Overwriting of annotations
if files_with_annotations_to_overwrite:
console.print(
Expand Down
8 changes: 4 additions & 4 deletions deploy/check_python.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Confirm that python 3.8 or higher is installed and pip installed
# Confirm that python 3.9 or higher is installed and pip installed

# Check python is installed
if ! command -v python3 &> /dev/null
Expand All @@ -8,10 +8,10 @@ then
exit 1
fi

# Check python version is 3.8 or higher
if [[ $(python3 -c 'import sys; print(sys.version_info >= (3, 8))') != "True" ]]
# Check python version is 3.9 or higher
if [[ $(python3 -c 'import sys; print(sys.version_info >= (3, 9))') != "True" ]]
then
echo "Python version 3.8 or higher is required"
echo "Python version 3.9 or higher is required"
exit 2
fi

Expand Down
2 changes: 1 addition & 1 deletion docs/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This doesn't represent the only way to develop on darwin-py, but does represent
No requirement for any particular shell, [zsh](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) + [oh my zsh](https://ohmyz.sh/) is a good setup commonly used, but whatever environment you use make sure to install the recommended alias's and path exports that the below systems require for your particular shell environment, particularly pertinent for poetry which has an added step that it prints to console but isn't included on the webpage.
## Pyenv
Pyenv manages system python versions, install instructions can be found [here](https://github.com/pyenv/pyenv).
After installation of pyenv, install a python version that is compatible with darwin-py (3.8-3.10 as of writing)
After installation of pyenv, install a python version that is compatible with darwin-py (3.9-3.12 as of writing)

`pyenv install 3.10`

Expand Down
17 changes: 9 additions & 8 deletions e2e_tests/cli/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,15 @@ def compare_annotations_export(
actual_filename = get_actual_annotation_filename(
expected_filename, actual_annotation_files
)
expected_annotation_data, actual_annotation_data = (
parse_expected_and_actual_annotations(
expected_annotation_files,
actual_annotation_files,
expected_filename,
actual_filename,
annotation_format,
)
(
expected_annotation_data,
actual_annotation_data,
) = parse_expected_and_actual_annotations(
expected_annotation_files,
actual_annotation_files,
expected_filename,
actual_filename,
annotation_format,
)
for idx, expected_annotation_file in enumerate(expected_annotation_data):
actual_annotation_file = actual_annotation_data[idx]
Expand Down
Loading

0 comments on commit c476a19

Please sign in to comment.