From 743c3096cc5764c83f349581db3e79866a22eff9 Mon Sep 17 00:00:00 2001 From: Roy Smart Date: Wed, 23 Oct 2024 20:57:09 -0600 Subject: [PATCH] Added Python 3.12 support by removing the `urlpath` dependency. --- .github/workflows/tests.yml | 2 +- iris/data.py | 10 ++++------ pyproject.toml | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8548d38..4050e7c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/iris/data.py b/iris/data.py index 6d71451..96fdd57 100644 --- a/iris/data.py +++ b/iris/data.py @@ -7,7 +7,6 @@ import pathlib import shutil import requests -import urlpath import astropy.time __all__ = [ @@ -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. @@ -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) @@ -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]: @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 697d308..45828df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ classifiers = [ dependencies = [ "astropy", "requests", - "urlpath", "named-arrays==0.10.0", ] dynamic = ["version"]