Commit Graph
31 Commits
Author SHA1 Message Date
paperbenni bec3d3ad9c Drop support for Python 3.8
Drop Python 3.8 support in 5 Pulsar-compatible packages
(job_metrics, tool_util, tool_util_models, util, objectstore)
and run pyupgrade --py310-plus on their source code.

- Bump requires-python from >=3.8 to >=3.10 in all 5 packages
- Remove Python 3.8 and 3.9 classifiers
- Remove ruff per-file-ignores for UP rules on these paths
- Remove backports.zoneinfo conditional dependency
- Remove pydyf<0.11 pin from conditional-requirements.txt
- Update Makefile pyupgrade target (remove PY38_PYUPGRADE_PATHS)
- Update CI workflow to test with Python 3.10 instead of 3.8

Clean up unused deprecated typing imports after pyupgrade

Remove now-unused typing imports (Dict, List, Optional, Set, Tuple,
Type, Union) that became dead after pyupgrade --py310-plus converted
annotations to use built-in types and | syntax.

Also run ruff check --fix --select=UP007,UP045 across the entire
codebase to convert remaining Optional[X] -> X | None and
Union[X, Y] -> X | Y patterns.

Enable ruff UP007/UP045 for Python 3.10 union syntax

Remove UP007 (Union[X,Y] -> X | Y) and UP045 (Optional[X] -> X | None)
from the ruff ignore list and convert all type aliases across the
codebase. These rules were deferred while Python 3.9 was supported;
requires-python is now >=3.10.

A custom script was used because neither ruff --fix nor
pyupgrade --py310-plus converts Optional[X]/Union[X,Y] in type alias
positions (e.g. X = Union[A, B]) — they only handle annotation
positions (e.g. def f(x: Optional[int])). All 167 violations were
module-level type aliases. A few edge cases were fixed manually:
single-element Union[X,], typing.Union qualified refs, runtime
Optional[type] calls, and Annotated[Optional[...]] pydantic fields.

Fix UP007 autofix regression with string forward reference type aliases

Commit fa6bd955a0 enabled ruff UP007/UP045 and auto-fixed
module-level type aliases using Union with string forward
references, producing invalid 'str | str' expressions.

This was a known ruff bug (charliermarsh/ruff#826) that has since
been fixed in later ruff versions, but this codebase was
converted before the fix was in place.

Revert to Union syntax and restore TYPE_CHECKING imports that
ruff's TCH rule cleaned up as a side effect when it thought the
forward references were unused.
2026-06-25 15:12:05 +01:00
Nicola Soranzo eb9fde1dcd Drop support for Python 3.9 2026-01-19 18:39:16 +00:00
Nicola Soranzo edd8bccf4f Drop support for Python 3.8 2025-02-25 19:20:46 +00:00
Nicola Soranzo 0629908541 Fix new UP031 errors from ruff 0.4.2 2024-04-29 00:09:38 +01:00
Michael R. Crusoe c00967cca4 Python 3.8 as new minimum version
Fixes: https://github.com/galaxyproject/galaxy/issues/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
```
2023-11-26 18:34:09 +00:00
Nicola Soranzo 45fb60c530 Ignore UP036 ruff check in check_python.py 2023-10-28 17:35:12 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
Nicola Soranzo 0bdc93a7cc Drop support for Python 3.6, add Python 3.10 2021-12-08 08:14:10 +00:00
Nicola Soranzo 9d74bba7fb Drop support for retired Python 3.5
Upgrade syntax using `pyupgrade --py36-plus` .

Manually drop several `six` imports.

Also:
- Remove broken pr_cache in scripts/bootstrap_history.py
- Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
2020-10-07 11:52:13 +01:00
Nicola Soranzo e8466d002a Python 2.7 is officially unsupported on 20.05 2020-06-20 19:04:57 +01:00
Nicola Soranzo 437f51c2a6 Create Python3 virtualenv by default
- Allow specifying Python to use to create virtualenv using GALAXY_PYTHON
  environment variable.
- Integrate Python support docs from https://galaxyproject.org/admin/python/
- Update virtualenv installation to use v16.7.9
2020-02-09 02:54:24 +00:00
Nicola Soranzo 6589bf3314 Drop support for Python 3.4. Officially support Python >=3.5
xref. https://github.com/galaxyproject/galaxy/issues/7260
2019-01-31 23:31:44 +00:00
Nicola Soranzo f4203ca051 Fix errors reported by flake8 3.6.0
Ignore W504.
2018-10-24 23:22:19 +01:00
mvdbeek 6120183182 Allow Python 3 if in a virtualenv 2018-06-13 03:12:45 +01:00
Nicola Soranzo 21b44bf348 Fix all E201 and E202 style errors
using the following command:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E201,E202 .
```
2017-08-17 11:35:39 +01:00
Nicola Soranzo 3d57c22b63 Fix I201 errors from flake8-import-order
Also fix Python3 compatibility.
Remove unused method
galaxy.tools.parameters.sanitize.ToolParameterSanitizer.restore_param() .
2016-11-23 18:31:04 +00:00
Nicola Soranzo 1d17a29c79 Fixes for pycodestyle 2.2.0 2016-11-15 16:56:50 +00:00
Junzhou Wang f68a8198da Python3: scripts/cleanup_datasets scripts/data_libraries 2016-06-25 21:49:25 -04:00
peterjc 7e5d99ebb2 Update check_python.py now dropping Python 2.6
Closes #1596
2016-03-07 15:50:05 +00:00
Nicola Soranzo 6569c2dcc3 Partially lint scripts/ . 2015-07-13 20:13:28 +01:00
James Taylor d02155ad7b Require Python 2.6+ and remove various compatibility patches for 2.4 and 2.5 2013-04-09 11:57:38 -04:00
Carl Eberhard d97ada4bb5 minor docstring adds in /scripts 2012-08-03 13:31:48 -04:00
Peter Cock e6628b9b66 Update scripts/check_python.py (Python 2.4 not supported) 2012-04-17 13:48:51 +01:00
Nate Coraor 478470e8b0 Testing Python 2.7. 2011-06-08 23:50:07 -04:00
Nate Coraor 006716f53a Egg support overhaul, introduces a number of fixes to the ABI recognition, better build scripts, a rewrite of the eggs library and eliminition of the need for python -ES 2010-03-01 15:41:30 -05:00
Nate Coraor 96a4144bc3 Fix another exception error (only in 2.4) with check_python.py 2010-01-28 13:37:53 -05:00
Nate Coraor ae12fd7d5b Prevent sys.exit() from being caught by the try-except block in check_galaxy.py (since sys.exit() actually raises an exception, but one not derived from Exception). 2010-01-05 15:17:10 -05:00
Nate Coraor 1f5e079a3a python run from virtualenv sets up site.py to pull things from the real python's lib directory, so 'python -S' breaks it. To fix this, have the check_python.py script check for virtualenv and output the arguments that should be used to start python ('python -E' for virtualenv, 'python -ES' for real), then use these arguments anywhere 'python -ES' was used in the past. 2010-01-04 12:51:34 -05:00
Nate Coraor 531e8043ad Officially support Python 2.6. 2009-11-13 10:39:15 -05:00
Nate Coraor 1561cd8af8 Upgrade Paste/PasteDeploy/PasteScript. Paste can go no further without changing the way we stream templates and tarballs. 2009-11-12 13:12:12 -05:00
Nate Coraor c9e0e1ea17 A get_platform() monkeypatch for fat versions of python on Mac. Also do more explicit version checking ( >= 2.4, <= 2.5 ) and provide helpful messages if the version is not supported. 2009-10-27 11:36:57 -04:00