Skip to content

Commit

Permalink
Add support for Python 3.11
Browse files Browse the repository at this point in the history
- Update Python dependencies that didn't have a cp311 wheel: h5py and
  psycopg2-binary.
- For packages for which there is no recent version that works on all
  Python versions supported by Galaxy (numpy and scipy), replace old
  requirement with multiple Python-version-specific requirements.
  • Loading branch information
nsoranzo committed Feb 2, 2023
1 parent 27cd9bb commit 4ca163b
Show file tree
Hide file tree
Showing 31 changed files with 404 additions and 335 deletions.
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.10']
python-version: ['3.7', '3.11']
defaults:
run:
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.10']
python-version: ['3.7', '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/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.10']
python-version: ['3.7', '3.11']
defaults:
run:
shell: bash -l {0}
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.10']
python-version: ['3.7', '3.11']
steps:
- uses: actions/checkout@v3
with:
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.10']
python-version: ['3.7', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/conditional-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# These dependencies are only required when certain config options are set
psycopg2-binary==2.9.1
psycopg2-binary==2.9.5
mysqlclient
fluent-logger
sentry-sdk
Expand Down
270 changes: 136 additions & 134 deletions lib/galaxy/dependencies/dev-requirements.txt

Large diffs are not rendered by default.

379 changes: 190 additions & 189 deletions lib/galaxy/dependencies/pinned-requirements.txt

Large diffs are not rendered by default.

55 changes: 50 additions & 5 deletions lib/galaxy/dependencies/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

set -e

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

this_directory="$(cd "$(dirname "$0")" > /dev/null && pwd)"

usage() {
printf "Usage: %s: [-a] [pkg_spec...]\n" ${0##*/} >&2
printf "Usage: %s: [-a] [pkg_spec...]\n" "${0##*/}" >&2
}

add=
Expand All @@ -23,7 +26,7 @@ do
;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))

if [ -n "$add" ] && [ $# -eq 0 ]; then
printf "When adding (-a), you must provide at least one package specification.\n" >&2
Expand All @@ -42,6 +45,48 @@ else
poetry add -vv --lock "$@"
fi

# Update pinned requirements.
poetry export -f requirements.txt --without-hashes --output "$this_directory/pinned-requirements.txt"
poetry export --only dev -f requirements.txt --without-hashes --output "$this_directory/dev-requirements.txt"
# Update pinned requirements files.
PINNED_REQUIREMENTS_FILE=$this_directory/pinned-requirements.txt
PINNED_DEV_REQUIREMENTS_FILE=$this_directory/dev-requirements.txt
poetry export -f requirements.txt --without-hashes --output "$PINNED_REQUIREMENTS_FILE"
poetry export --only dev -f requirements.txt --without-hashes --output "$PINNED_DEV_REQUIREMENTS_FILE"

# Fix requirements

latest_package_version_for_python_version () {
PIP_INDEX_OUT=$(pip index versions --python-version "$2" "$1")
echo "$PIP_INDEX_OUT" | head -n 1 | sed -e 's/.* (\(.*\)).*/\1/'
}

split_requirement () {
PACKAGE_NAME=$1

if ! pip index version --help >/dev/null; then
echo "pip >= 21.2.1 required for the 'index' command"
exit 1
fi

NEW_REQUIREMENTS=
PREVIOUS_LATEST_PACKAGE_VERSION=
for PYTHON_VERSION in $SUPPORTED_PYTHON_VERSIONS; do
LATEST_PACKAGE_VERSION=$(latest_package_version_for_python_version "$PACKAGE_NAME" "$PYTHON_VERSION")
if [ -z "$NEW_REQUIREMENTS" ]; then
NEW_REQUIREMENTS="$PACKAGE_NAME==$LATEST_PACKAGE_VERSION ; python_version >= \"$PYTHON_VERSION\""
elif [ "$LATEST_PACKAGE_VERSION" != "$PREVIOUS_LATEST_PACKAGE_VERSION" ]; then
NEW_REQUIREMENTS="$NEW_REQUIREMENTS and python_version < \"$PYTHON_VERSION\"\n$PACKAGE_NAME==$LATEST_PACKAGE_VERSION ; python_version >= \"$PYTHON_VERSION\""
fi
PREVIOUS_LATEST_PACKAGE_VERSION=$LATEST_PACKAGE_VERSION
done
if [ -n "$NOT_SUPPORTED_NEXT_PYTHON_VERSION" ]; then
NEW_REQUIREMENTS="$NEW_REQUIREMENTS and python_version < \"$NOT_SUPPORTED_NEXT_PYTHON_VERSION\""
fi

sed -i.orig -e "s/^$PACKAGE_NAME==.*/$NEW_REQUIREMENTS/" "$PINNED_REQUIREMENTS_FILE" "$PINNED_DEV_REQUIREMENTS_FILE"
}

# For some packages there is no recent version that works on all Python versions
# supported by Galaxy, so Poetry resorts to an old version that didn't have a
# maximum Python version pin. Here we replace any such requirement with multiple
# Python-version-specific requirements.
split_requirement numpy
split_requirement scipy
1 change: 1 addition & 0 deletions packages/app/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/auth/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/config/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/data/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/files/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/job_execution/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/job_metrics/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/meta/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Scientific/Engineering :: Bio-Informatics
Topic :: Software Development
Topic :: Software Development :: Code Generators
Expand Down
1 change: 1 addition & 0 deletions packages/navigation/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/objectstore/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/selenium/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/test_api/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/test_base/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/test_driver/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/test_selenium/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/tool_util/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/tours/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/util/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/web_framework/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/web_stack/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
1 change: 1 addition & 0 deletions packages/webapps/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Testing
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pykwalify = "*"
pylibmagic = "*"
pyparsing = "*"
pysam = ">=0.20"
python = ">=3.7,<3.11" # Keep maximum version strict to appease numpy and scipy
python = ">=3.7,<3.12" # Keep maximum version strict to appease numpy and scipy
python-dateutil = "*"
python-magic = "*"
python-multipart = "*" # required to support form parsing in FastAPI/Starlette
Expand Down

0 comments on commit 4ca163b

Please sign in to comment.