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.
Fix the following warning when running unit tests:
```
test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py::test_request_scoped_sa_session_single_request
test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py::test_request_scoped_sa_session_exception
test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py::test_request_scoped_sa_session_concurrent_requests_sync
test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py::test_request_scoped_sa_session_concurrent_requests_async
test/unit/webapps/test_request_scoped_sqlalchemy_sessions.py::test_request_scoped_sa_session_concurrent_requests_and_background_thread
/usr/users/ga002/soranzon/software/nsoranzo_galaxy/.venv/lib/python3.10/site-packages/httpx/_client.py:1426: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=ASGITransport(app=...)' instead.
```
See:
https://github.com/encode/httpx/blob/master/CHANGELOG.md#0270-21st-february-2024
Also:
- Add missing `graphene` and `graphql-core` dependencies to
`pyproject.toml` (already installed as other dependencies' deps,
but explicitly imported by ToolShed code).
- Move `test_tool_validation.py` unit tests to the galaxy-tool-shed
package.
introduced in https://github.com/galaxyproject/galaxy/pull/18003 .
In particular, when using requests in the tests to connect to Galaxy
or the ToolShed it's not needed to use the modified headers.
Also:
- Move some imports after conditional imports.
- Fix type annotations in `lib/tool_shed/test/base/populators.py`
- Fix typo bug in `test/unit/util/test_get_url.py`
The ShortTermStorageManager and related classes should live in their own package eventually and not within galaxy.web nor galaxy.managers as the short term storage microservices it's fairly independent and has way less dependencies than those other packages.
The ShortTermStorageManager is a manager and makes sense to have it live under galaxy.managers instead of galaxy.web.
It will also help reduce the dependency of the manager modules on web related stuff.
ruff (https://github.com/charliermarsh/ruff) is a new and extremely fast
Python linter, written in Rust.
Ruff can be used to replace Flake8 (plus a variety of plugins), isort,
pydocstyle, yesqa, eradicate, pyupgrade, and autoflake.
Here ruff is added to our current linters (flake8, flake8-bugbear and isort)
while we assess its reliability.
I've not enabled the isort rules because many of the options we use are not
implemented yet. I have instead enabled the pyupgrade rules (a tool which I
run manually every few months).
Also:
- Fix new linting errors reported by ruff.