Skip to content

Commit

Permalink
Python 3.8 as new minimum version
Browse files Browse the repository at this point in the history
Fixes: #16394

Also upgrade code to Python 3.8 syntax with:

```
ack --type=python -f | grep -v '^lib/galaxy/schema/bco/\|^lib/galaxy/schema/drs/\|lib/tool_shed_client/schema/trs.*.py\|^tools/\|^.venv/\|^.tox/' | grep -v '^lib/galaxy/files/sources/\|^lib/galaxy/job_metrics/\|^lib/galaxy/objectstore/\|^lib/galaxy/tool_util/\|^lib/galaxy/util/' | xargs pyupgrade --py38-plus
```
  • Loading branch information
mr-c authored and nsoranzo committed Nov 26, 2023
1 parent d31a812 commit c00967c
Show file tree
Hide file tree
Showing 72 changed files with 101 additions and 143 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ variables:
jobs:
get_code:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
<<: *set_workdir
steps:
# Replace standard code checkout with shallow clone to speed things up.
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- ~/repo
validate_test_tools:
docker:
- image: cimg/python:3.7
- image: cimg/python:3.8
<<: *set_workdir
steps:
- *restore_repo_cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
chunk: [0, 1]
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_test_class_names.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/converter_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- if: github.event_name == 'schedule'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cwl_conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
marker: ['green', 'red and required', 'red and not required']
conformance-version: ['cwl_conformance_v1_0'] #, 'cwl_conformance_v1_1', 'cwl_conformance_v1_2']
services:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/db_indexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
matrix:
db: ['postgresql', 'sqlite']
postgresql-version: ['13']
python-version: ['3.7']
python-version: ['3.8']
include:
- db: postgresql
postgresql-version: '9.6'
python-version: '3.7'
python-version: '3.8'
services:
postgres:
image: postgres:${{ matrix.postgresql-version }}
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
# poetry requires Python >=3.8, but lint requirements currently need
# to be generated with `pip freeze`` on the oldest Python version
# supported by Galaxy.
python-version: |
${{ matrix.python-version }}
3.8
python-version: ${{ matrix.python-version }}
- name: Update dependencies
run: |
python -m venv .venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- name: Get target branch name (push)
if: github.event_name == 'push'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/first_startup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
defaults:
run:
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
services:
postgres:
image: postgres:13
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
chunk: ['0', '1', '2', '3']
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
services:
postgres:
image: postgres:13
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
env:
LINT_PATH: 'lib/galaxy/dependencies/pinned-lint-requirements.txt'
TYPE_PATH: 'lib/galaxy/dependencies/pinned-typecheck-requirements.txt'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint_openapi_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mulled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/osx_startup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
defaults:
run:
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
services:
postgres:
image: postgres:13
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7']
python-version: ['3.8']
steps:
- uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reports_startup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
defaults:
run:
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
chunk: [0, 1, 2]
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_galaxy_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_galaxy_packages_for_pulsar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.7'] # don't upgrade, see https://github.com/galaxyproject/galaxy/pull/16649
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/toolshed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
shed-api: ['v1', 'v2']
test-install-client: ['galaxy_api', 'standalone']
services:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
services:
postgres:
image: postgres:13
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.11']
python-version: ['3.8', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Community support is available at `Galaxy Help <https://help.galaxyproject.org/>
Galaxy Quickstart
=================

Galaxy requires Python 3.7 . To check your Python version, run:
Galaxy requires Python 3.8 . To check your Python version, run:

.. code:: console
$ python -V
Python 3.7.6
Python 3.8.18
Start Galaxy:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/admin/python.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Supported Python versions

Galaxy's core functionality is currently supported on Python **>=3.7** .
Galaxy's core functionality is currently supported on Python **>=3.8** .

If Galaxy complains about the version of Python you are using:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/dev/debugging_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ index 6647588dfb..c8d82957a1 100644
@@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.7']
python-version: ['3.8']
- subset: ['upload_datatype', 'extended_metadata', 'kubernetes', 'not (upload_datatype or extended_metadata or kubernetes)']
+ subset: ['not (upload_datatype or extended_metadata or kubernetes)']
services:
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/app_unittest_utils/tools_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class MockContext:
def __init__(self, model_objects=None):
self.expunged_all = False
self.flushed = False
self.model_objects = model_objects or defaultdict(lambda: {})
self.model_objects = model_objects or defaultdict(dict)
self.created_objects = []
self.current = self

Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/celery/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
log = get_logger(__name__)


@lru_cache()
@lru_cache
def setup_data_table_manager(app):
app._configure_tool_data_tables(from_shed_config=False)


@lru_cache()
@lru_cache
def cached_create_tool_from_representation(app, raw_tool_source):
return create_tool_from_representation(
app=app, raw_tool_source=raw_tool_source, tool_dir="", tool_source_class="XmlToolSource"
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/datatypes/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os
import re
import shlex
import subprocess
import tempfile
from typing import (
Expand Down Expand Up @@ -38,7 +39,6 @@
)
from galaxy.util import (
nice_size,
shlex_join,
string_as_bool,
unicodify,
)
Expand Down Expand Up @@ -242,7 +242,7 @@ def _display_data_trusted(
ofilename = dataset.get_file_name()
log.exception(
'Command "%s" failed. Could not convert the Jupyter Notebook to HTML, defaulting to plain text.',
shlex_join(cmd),
shlex.join(cmd),
)
return open(ofilename, mode="rb"), headers

Expand Down
3 changes: 0 additions & 3 deletions lib/galaxy/datatypes/util/maf_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,6 @@ def get_starts_ends_fields_from_gene_bed(line):
if len(fields) < 12:
raise Exception(f"Not a proper 12 column BED line ({line}).")
tx_start = int(fields[1])
strand = fields[5]
if strand != "-":
strand = "+" # Default strand is +
cds_start = int(fields[6])
cds_end = int(fields[7])

Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

set -e

SUPPORTED_PYTHON_VERSIONS="3.7 3.8 3.9 3.10 3.11"
SUPPORTED_PYTHON_VERSIONS="3.8 3.9 3.10 3.11"
NOT_SUPPORTED_NEXT_PYTHON_VERSION="3.12"

this_directory="$(cd "$(dirname "$0")" > /dev/null && pwd)"
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/update_lint_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ THIS_DIRECTORY="$(cd "$(dirname "$0")" > /dev/null && pwd)"

update_pinned_reqs() {
VENV=$(mktemp -d "${TMPDIR:-/tmp}/$1_venv.XXXXXXXXXX")
python3.7 -m venv "${VENV}"
python3.8 -m venv "${VENV}"
. "${VENV}/bin/activate"
pip install --upgrade pip setuptools
pip install -r "${THIS_DIRECTORY}/$1-requirements.txt"
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/managers/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def resolve_users(self, recipients: NotificationRecipients) -> List[User]:
user_ids_from_roles_stmt = self._get_all_user_ids_from_roles_query(all_role_ids)

union_stmt = union(user_ids_from_groups_stmt, user_ids_from_roles_stmt)
user_ids_from_groups_and_roles = set([id for id, in self.sa_session.execute(union_stmt)])
user_ids_from_groups_and_roles = {id for id, in self.sa_session.execute(union_stmt)}
unique_user_ids.update(user_ids_from_groups_and_roles)

stmt = select(User).where(User.id.in_(unique_user_ids))
Expand Down Expand Up @@ -448,7 +448,7 @@ def _expand_group_and_roles_ids(self, group_ids: Set[int], role_ids: Set[int]) -
.where(GroupRoleAssociation.role_id.in_(role_ids))
.distinct()
)
group_ids_from_roles = set([id for id, in self.sa_session.execute(stmt) if id is not None])
group_ids_from_roles = {id for id, in self.sa_session.execute(stmt) if id is not None}
new_group_ids = group_ids_from_roles - processed_group_ids

# Get role IDs associated with any of the given group IDs
Expand All @@ -458,7 +458,7 @@ def _expand_group_and_roles_ids(self, group_ids: Set[int], role_ids: Set[int]) -
.where(GroupRoleAssociation.group_id.in_(group_ids))
.distinct()
)
role_ids_from_groups = set([id for id, in self.sa_session.execute(stmt) if id is not None])
role_ids_from_groups = {id for id, in self.sa_session.execute(stmt) if id is not None}
new_role_ids = role_ids_from_groups - processed_role_ids

# Stop if there are no new group or role IDs to process
Expand Down
Loading

0 comments on commit c00967c

Please sign in to comment.