Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies = [
"cogent3==2026.1.12a1",
"cogent3-h5seqs==0.7.3",
"duckdb",
"httpx",
Comment thread
GavinHuttley marked this conversation as resolved.
Outdated
"numba",
"numpy",
"polars",
Expand Down
14 changes: 8 additions & 6 deletions src/ensembl_tui/_ftp_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from collections.abc import Callable
from ftplib import FTP, error_perm

import httpx
Comment thread
GavinHuttley marked this conversation as resolved.
Outdated

from rich.progress import Progress, track
from unsync import unsync

Expand Down Expand Up @@ -52,12 +54,12 @@ def _copy_to_local(
) -> eti_util.PathType:
if dest.exists():
return dest
ftp = configured_ftp(host=host)
# pass in checksum and keep going until it's correct?
with eti_util.atomic_write(dest, mode="wb") as outfile:
ftp.retrbinary(f"RETR {src}", outfile.write)

ftp.close()
url = f"https://{host}/{str(src).lstrip('/')}"
with httpx.stream("GET", url, follow_redirects=True, timeout=300.0) as response:
response.raise_for_status()
with eti_util.atomic_write(dest, mode="wb") as outfile:
for chunk in response.iter_bytes(chunk_size=1024 * 1024):
outfile.write(chunk)
return dest


Expand Down
3 changes: 2 additions & 1 deletion src/ensembl_tui/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def demo_config(outpath: pathlib.Path, domain: str, force_overwrite: bool) -> No
if outpath.exists():
shutil.rmtree(outpath)
outpath.mkdir(parents=True, exist_ok=True)
shutil.copytree(eti_util.ENSEMBLDBRC, outpath, dirs_exist_ok=True)
shutil.copytree(eti_util.ENSEMBLDBRC, outpath, dirs_exist_ok=True,
copy_function=shutil.copyfile) # install may be read only
Comment thread
GavinHuttley marked this conversation as resolved.
# we assume all files starting with alphabetical characters are valid
for fn in pathlib.Path(outpath).glob("*"):
if not fn.stem.isalpha():
Expand Down