- 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.
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.
Fix the following traceback:
```
lib/galaxy/webapps/galaxy/fast_app.py:178: in initialize_fast_app
add_galaxy_middleware(app, gx_app)
lib/galaxy/webapps/galaxy/fast_app.py:127: in add_galaxy_middleware
async def preflight_handler(request: Request, rest_of_path: str) -> Response:
.venv/lib/python3.7/site-packages/fastapi/routing.py:658: in decorator
generate_unique_id_function=generate_unique_id_function,
.venv/lib/python3.7/site-packages/fastapi/routing.py:598: in add_api_route
generate_unique_id_function=current_generate_unique_id,
.venv/lib/python3.7/site-packages/fastapi/routing.py:401: in __init__
name=response_name, type_=self.response_model
.venv/lib/python3.7/site-packages/fastapi/utils.py:92: in create_response_field
) from None
E fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'starlette.responses.Response'> is a valid pydantic field type
```
tracked upstream in https://github.com/tiangolo/fastapi/issues/5861 .
Fix `pysam.index()` calls which now use samtools 1.16 where
`samtools index input output` doesn't work any more if `output` is the path
of an already existing file, but `samtools index -o output input` works
fine.
Also:
- Pre-create the (empty) index file for mock test datasets as a unit test
reproducer of the above issue.
- Fix `test_cram` unit test that wasn't checking the return value of
`CRAM.set_index_file()`, which was in fact returning False because
`test-data/2.cram` was not sorted (updated now).
FilePrefix reads the first Megabytes of a file, which is much more
than the previously used `check_binary` which read only 1KB.
Since we're re-using FilePrefix instance this shouldn't have any impact
on performace. In addition we're now using `python-magic` to detect
the encoding and mime-type. We're using the mime-type detection
for PDF only at this point, but we're also using the detected encoding
if we encounter non-utf8 content.
Disallow python-irodsclient 1.1.2 due to
https://github.com/irods/python-irodsclient/issues/356
which breaks several integration tests with:
```
File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/irods/message/__init__.py", line 163, in _recv_message_in_len
host, port = sock.getpeername()
ValueError: too many values to unpack (expected 2)
```
Also:
- Remove redundant `galaxy.schema` module from the `app` package (it's
already in `data`)
- Fix requirements of the `app` and `webapps` packages
- Add missing `PyJWT` and `python-dateutil` to `tool.poetry.dependencies`
(which were already included in the pinned requirements as deps of deps)
Also:
- Remove redundant `galaxy.schema` module from the `app` package (it's
already in `data`)
- Fix requirements of the `app` and `webapps` packages
- Add missing `PyJWT` and `python-dateutil` to `tool.poetry.dependencies`
(which were already included in the pinned requirements as deps of deps)