pyopensky 2.11__tar.gz → 2.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyopensky-2.11 → pyopensky-2.14}/.github/workflows/run_tests.yml +7 -19
- {pyopensky-2.11 → pyopensky-2.14}/.gitignore +1 -0
- {pyopensky-2.11 → pyopensky-2.14}/PKG-INFO +3 -2
- {pyopensky-2.11 → pyopensky-2.14}/pyproject.toml +2 -1
- pyopensky-2.14/src/pyopensky/__init__.py +13 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/config.py +11 -3
- pyopensky-2.14/src/pyopensky/tzdata.py +65 -0
- pyopensky-2.14/tests/test_tzdata.py +13 -0
- pyopensky-2.14/uv.lock +3827 -0
- pyopensky-2.11/src/pyopensky/__init__.py +0 -3
- pyopensky-2.11/uv.lock +0 -3231
- {pyopensky-2.11 → pyopensky-2.14}/.github/dependabot.yml +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/.github/renovate.json5 +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/.github/workflows/build-docs.yml +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/.github/workflows/pypi_publish.yml +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/.gitignore +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/Makefile +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/make.bat +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/_static/main_stylesheet.css +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/api_reference.rst +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/conf.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/credentials.rst +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/index.rst +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/installation.rst +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/rest.rst +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/docs/source/trino.rst +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/license.txt +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/readme.md +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/scripts/decode_pymodes.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/scripts/decode_rs1090.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/api.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/py.typed +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/rest.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/s3.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/schema.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/time.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/src/pyopensky/trino.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/tests/test_rest.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/tests/test_s3.py +0 -0
- {pyopensky-2.11 → pyopensky-2.14}/tests/test_trino.py +0 -0
|
@@ -36,31 +36,19 @@ jobs:
|
|
|
36
36
|
with:
|
|
37
37
|
fetch-depth: 0
|
|
38
38
|
|
|
39
|
-
- name:
|
|
40
|
-
|
|
41
|
-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
42
|
-
|
|
43
|
-
- name: Set up uv
|
|
44
|
-
if: ${{ matrix.os == 'windows-latest' }}
|
|
45
|
-
run: irm https://astral.sh/uv/install.ps1 | iex
|
|
46
|
-
shell: powershell
|
|
47
|
-
|
|
48
|
-
- name: Cache folder for uv
|
|
49
|
-
uses: actions/cache@v4
|
|
39
|
+
- name: Install uv
|
|
40
|
+
uses: astral-sh/setup-uv@v5
|
|
50
41
|
with:
|
|
51
|
-
|
|
52
|
-
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
53
|
-
restore-keys: |
|
|
54
|
-
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
|
|
55
|
-
uv-${{ runner.os }}
|
|
42
|
+
enable-cache: true
|
|
56
43
|
|
|
57
44
|
- name: Cache folder for data
|
|
58
45
|
uses: actions/cache@v4
|
|
59
46
|
id: cache-folder
|
|
60
47
|
with:
|
|
61
48
|
path: |
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
cache_opensky
|
|
50
|
+
enableCrossOsArchive: true
|
|
51
|
+
key: opensky-${{ hashFiles('uv.lock') }}
|
|
64
52
|
|
|
65
53
|
- name: Install the project
|
|
66
54
|
run: uv sync --all-extras --dev --python ${{ matrix.python-version }}
|
|
@@ -71,7 +59,7 @@ jobs:
|
|
|
71
59
|
uv run ruff format --check
|
|
72
60
|
|
|
73
61
|
- name: Run tests
|
|
74
|
-
if: ${{ matrix.python-version == '3.12' || steps.cache-folder.outputs.cache-hit == 'true' }}
|
|
62
|
+
if: ${{ (matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest') || steps.cache-folder.outputs.cache-hit == 'true' }}
|
|
75
63
|
env:
|
|
76
64
|
OPENSKY_USERNAME: ${{ secrets.OPENSKY_USERNAME }}
|
|
77
65
|
OPENSKY_PASSWORD: ${{ secrets.OPENSKY_PASSWORD }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pyopensky
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.14
|
|
4
4
|
Summary: A Python interface for OpenSky database
|
|
5
5
|
Project-URL: Repository, https://github.com/open-aviation/pyopensky/
|
|
6
6
|
Author-email: Xavier Olive <git@xoolive.org>, Junzi Sun <j.sun-1@tudelft.nl>
|
|
@@ -12,6 +12,7 @@ Requires-Dist: minio>=7.2.8
|
|
|
12
12
|
Requires-Dist: pandas>=2.2.2
|
|
13
13
|
Requires-Dist: pyarrow>=17.0.0
|
|
14
14
|
Requires-Dist: pyjwt>=2.9.0
|
|
15
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
15
16
|
Requires-Dist: tqdm>=4.66.5
|
|
16
17
|
Requires-Dist: trino[sqlalchemy]>=0.329.0
|
|
17
18
|
Requires-Dist: typing-extensions>=4.12.2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyopensky"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.14"
|
|
4
4
|
description = "A Python interface for OpenSky database"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Xavier Olive", email = "git@xoolive.org" },
|
|
@@ -16,6 +16,7 @@ dependencies = [
|
|
|
16
16
|
"pandas >= 2.2.2",
|
|
17
17
|
"pyarrow >= 17.0.0",
|
|
18
18
|
"pyjwt >= 2.9.0",
|
|
19
|
+
"python-dotenv>=1.0.1",
|
|
19
20
|
"tqdm >= 4.66.5",
|
|
20
21
|
"trino[sqlalchemy] >= 0.329.0",
|
|
21
22
|
"typing-extensions >= 4.12.2",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from importlib.metadata import version
|
|
3
|
+
|
|
4
|
+
from .tzdata import download_tzdata_windows
|
|
5
|
+
|
|
6
|
+
__version__ = version("pyopensky")
|
|
7
|
+
|
|
8
|
+
# Despite the 'win32' string, this value is returned on all versions of Windows,
|
|
9
|
+
# including both 32-bit and 64-bit. The 'win32' identifier is a historical
|
|
10
|
+
# artifact that has been retained for compatibility with older versions of
|
|
11
|
+
# Python.
|
|
12
|
+
if sys.platform == "win32":
|
|
13
|
+
download_tzdata_windows(year=2022)
|
|
@@ -6,11 +6,13 @@ import os
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import TypedDict
|
|
8
8
|
|
|
9
|
+
import dotenv
|
|
9
10
|
from appdirs import user_cache_dir, user_config_dir
|
|
10
11
|
|
|
11
12
|
import pandas as pd
|
|
12
13
|
|
|
13
14
|
_log = logging.getLogger(__name__)
|
|
15
|
+
dotenv.load_dotenv()
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
DEFAULT_CONFIG = """
|
|
@@ -32,7 +34,7 @@ password =
|
|
|
32
34
|
## for storing possibly large files.
|
|
33
35
|
## Default settings:
|
|
34
36
|
## - $HOME/.cache/opensky (Linux)
|
|
35
|
-
## - $HOME/Library/Caches/opensky (MacOS)
|
|
37
|
+
## - $HOME/Library/Caches/opensky (MacOS) (unless XDG_CONFIG_HOME is set)
|
|
36
38
|
## - C:\\Users\\<username>\\AppData\\Local\\opensky\\Cache (Windows)
|
|
37
39
|
##
|
|
38
40
|
# path =
|
|
@@ -44,7 +46,10 @@ password =
|
|
|
44
46
|
purge = 90 days
|
|
45
47
|
"""
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
if (xdg_config := os.environ.get("XDG_CONFIG_HOME")) is not None:
|
|
50
|
+
opensky_config_dir = Path(xdg_config) / "pyopensky"
|
|
51
|
+
else:
|
|
52
|
+
opensky_config_dir = Path(user_config_dir("pyopensky"))
|
|
48
53
|
opensky_config = configparser.ConfigParser()
|
|
49
54
|
|
|
50
55
|
if (opensky_config_file := opensky_config_dir / "settings.conf").exists():
|
|
@@ -57,7 +62,10 @@ else:
|
|
|
57
62
|
opensky_config_dir.mkdir(parents=True)
|
|
58
63
|
opensky_config_file.write_text(DEFAULT_CONFIG)
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
if xdg_config is not None:
|
|
66
|
+
traffic_config_dir = Path(xdg_config) / "traffic"
|
|
67
|
+
else:
|
|
68
|
+
traffic_config_dir = Path(user_config_dir("traffic"))
|
|
61
69
|
traffic_config = configparser.ConfigParser()
|
|
62
70
|
|
|
63
71
|
if (traffic_config_file := traffic_config_dir / "traffic.conf").exists():
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# While Arrow uses the OS-provided timezone database on Linux and macOS, it
|
|
2
|
+
# requires a user-provided database on Windows. You must download and extract
|
|
3
|
+
# the text version of the IANA timezone database and add the Windows timezone
|
|
4
|
+
# mapping XML.
|
|
5
|
+
# https://arrow.apache.org/docs/cpp/build_system.html#runtime-dependencies
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import tarfile
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
import httpx
|
|
14
|
+
|
|
15
|
+
rk = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def download_tzdata_windows(
|
|
19
|
+
year: int = 2022,
|
|
20
|
+
*,
|
|
21
|
+
name: str = "tzdata",
|
|
22
|
+
base_dir: None | Path = None,
|
|
23
|
+
) -> None:
|
|
24
|
+
# This module only exists in Windows
|
|
25
|
+
from winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx # type: ignore
|
|
26
|
+
|
|
27
|
+
if base_dir is None:
|
|
28
|
+
conda_env_path = os.getenv("CONDA_PREFIX", None)
|
|
29
|
+
if conda_env_path:
|
|
30
|
+
base_dir = Path(conda_env_path) / "Lib" / "site-packages" / "tzdata"
|
|
31
|
+
else:
|
|
32
|
+
# This \o/ line finds the Downloads directory for the current user
|
|
33
|
+
with OpenKey(HKEY_CURRENT_USER, rk) as key:
|
|
34
|
+
download_path, _ = QueryValueEx(
|
|
35
|
+
key,
|
|
36
|
+
# don't ask what this uuid stands for...
|
|
37
|
+
"{374DE290-123F-4565-9164-39C4925E467B}",
|
|
38
|
+
)
|
|
39
|
+
base_dir = Path(download_path)
|
|
40
|
+
|
|
41
|
+
folder = base_dir
|
|
42
|
+
|
|
43
|
+
if (folder / name).is_dir():
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
tz_path = folder / "tzdata.tar.gz"
|
|
47
|
+
|
|
48
|
+
c = httpx.get(
|
|
49
|
+
f"https://data.iana.org/time-zones/releases/tzdata{year}f.tar.gz"
|
|
50
|
+
)
|
|
51
|
+
c.raise_for_status()
|
|
52
|
+
tz_path.write_bytes(c.content)
|
|
53
|
+
|
|
54
|
+
extracted_folder = folder / name
|
|
55
|
+
|
|
56
|
+
if not extracted_folder.exists():
|
|
57
|
+
extracted_folder.mkdir(parents=True)
|
|
58
|
+
|
|
59
|
+
tarfile.open(tz_path).extractall(extracted_folder)
|
|
60
|
+
|
|
61
|
+
c = httpx.get(
|
|
62
|
+
"https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml"
|
|
63
|
+
)
|
|
64
|
+
c.raise_for_status()
|
|
65
|
+
(extracted_folder / "windowsZones.xml").write_bytes(c.content)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from pyopensky.trino import Trino # noqa: F401
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.skipif(sys.platform != "win32", reason="Only relevant for Windows")
|
|
11
|
+
def test_tzdata() -> None:
|
|
12
|
+
folder = Path(os.path.expanduser("~")) / "Downloads" / "tzdata"
|
|
13
|
+
assert (folder / "windowsZones.xml").exists()
|