Skip to content

Commit

Permalink
Added Python 3.12 support by removing the urlpath dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Oct 24, 2024
1 parent 0ff1b5a commit 743c309
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
windows-latest,
macOS-latest,
]
python-version: ["3.10", "3.11",]
python-version: ["3.10", "3.12",]
name: ${{ matrix.os }}, Python ${{ matrix.python-version }} tests
steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 4 additions & 6 deletions iris/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import pathlib
import shutil
import requests
import urlpath
import astropy.time

__all__ = [
Expand Down Expand Up @@ -97,7 +96,7 @@ def urls_hek(
sji: bool = True,
deconvolved: bool = False,
num_retry: int = 5,
) -> list[urlpath.URL]:
) -> list[str]:
"""
Find a list of URLs to download matching the given parameters.
Expand Down Expand Up @@ -168,8 +167,7 @@ def urls_hek(
for group in event["groups"]:

url = group["comp_data_url"]
url = urlpath.URL(url)
url = urlpath.URL(*["data" if p == "data_lmsal" else p for p in url.parts])
url = url.replace("data_lmsal", "data")

url_str = str(url)

Expand All @@ -188,7 +186,7 @@ def urls_hek(


def download(
urls: list[urlpath.URL],
urls: list[str],
directory: None | pathlib.Path = None,
overwrite: bool = False,
) -> list[pathlib.Path]:
Expand Down Expand Up @@ -230,7 +228,7 @@ def download(
result = []
for url in urls:

file = directory / url.name
file = directory / url.split("/")[~0]

if overwrite or not file.exists():
r = requests.get(url, stream=True)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ classifiers = [
dependencies = [
"astropy",
"requests",
"urlpath",
"named-arrays==0.10.0",
]
dynamic = ["version"]
Expand Down

0 comments on commit 743c309

Please sign in to comment.