Found by running:
```
make pyupgrade
ruff check --fix .
ruff check --preview --unsafe-fixes --select=F401 --fix .
make format
make update-client-api-schema
```
The bulk of the changes are replacements of typing deprecated aliases
such as `Dict` and `List` with the standard library classes. These
aliases became redundant in Python 3.9 when the corresponding
pre-existing classes were enhanced to support `[]`, see
https://docs.python.org/3/library/typing.html#deprecated-aliases
Also:
- Update the `pyupgrade` Makefile target to use `--py38-plus` for the
packages needed by Pulsar, including the new galaxy-tool-util-models
package.
That's a much better consumer experience. A model generated for
gx_conditional.xml would look like
```typescript
export type ConditionalType =
| WhenTestParameterA
| WhenTestParameterB
| WhenTestParameterC
export type TestParameter = "a"
export type IntegerParameter = number
export type TestParameter1 = "b"
export type BooleanParameter = boolean
export type TestParameter2 = "c"
export type ColorParameter = string
export interface MySchema {
conditional_parameter: ConditionalType
}
export interface WhenTestParameterA {
test_parameter: TestParameter
integer_parameter: IntegerParameter
}
export interface WhenTestParameterB {
test_parameter: TestParameter1
boolean_parameter: BooleanParameter
}
export interface WhenTestParameterC {
test_parameter: TestParameter2
color_parameter: ColorParameter
}
```
instead of
```typescript
export type ConditionalType =
| WhenTestParameterA
| WhenTestParameterB
| WhenTestParameterC
export type TestParameter = string | boolean
export type IntegerParameter = number
export type TestParameter1 = string | boolean
export type BooleanParameter = boolean
export type TestParameter2 = string | boolean
export type ColorParameter = string
export interface MySchema {
conditional_parameter: ConditionalType
}
export interface WhenTestParameterA {
test_parameter: TestParameter
integer_parameter: IntegerParameter
}
export interface WhenTestParameterB {
test_parameter: TestParameter1
boolean_parameter: BooleanParameter
}
export interface WhenTestParameterC {
test_parameter: TestParameter2
color_parameter: ColorParameter
}
```
With the new model I can write an input object without looking at the
tool source, with the previous one I don't know what string I would need
to supply.
`__package__` is deprecated since Python 3.13, see
https://docs.python.org/3/reference/datamodel.html#module.__package__
`importlib.resources.files()` can be passed a non-package module
since Python 3.12 (or importlib-resources 5.10.0, see
https://importlib-resources.readthedocs.io/en/latest/history.html#v5-10-0 ),
so we can use `__name__` instead of `__package__`.
Also, I noticed that in lib/galaxy/config/__init__.py we are passing
a directory to `importlib.resources.as_file()`, which is supported
only since Python 3.12 (or importlib-resources 5.9.0).
For the reasons above:
- Update conditional imports in `lib/galaxy/util/resources.py` to
import from `importlib.resources` only for Python 3.12,
otherwise from the importlib-resources package.
- Update importlib-resources requirement in galaxy-util package.
- Drop importlib-resources requirement from galaxy-web-apps as it's
not imported directly from its code any more.