pyopensky 2.12__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.
Files changed (39) hide show
  1. {pyopensky-2.12 → pyopensky-2.14}/.github/workflows/run_tests.yml +7 -19
  2. {pyopensky-2.12 → pyopensky-2.14}/.gitignore +1 -0
  3. {pyopensky-2.12 → pyopensky-2.14}/PKG-INFO +4 -2
  4. {pyopensky-2.12 → pyopensky-2.14}/pyproject.toml +2 -1
  5. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/config.py +11 -3
  6. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/tzdata.py +20 -3
  7. pyopensky-2.14/uv.lock +3827 -0
  8. pyopensky-2.12/uv.lock +0 -3233
  9. {pyopensky-2.12 → pyopensky-2.14}/.github/dependabot.yml +0 -0
  10. {pyopensky-2.12 → pyopensky-2.14}/.github/renovate.json5 +0 -0
  11. {pyopensky-2.12 → pyopensky-2.14}/.github/workflows/build-docs.yml +0 -0
  12. {pyopensky-2.12 → pyopensky-2.14}/.github/workflows/pypi_publish.yml +0 -0
  13. {pyopensky-2.12 → pyopensky-2.14}/docs/.gitignore +0 -0
  14. {pyopensky-2.12 → pyopensky-2.14}/docs/Makefile +0 -0
  15. {pyopensky-2.12 → pyopensky-2.14}/docs/make.bat +0 -0
  16. {pyopensky-2.12 → pyopensky-2.14}/docs/source/_static/main_stylesheet.css +0 -0
  17. {pyopensky-2.12 → pyopensky-2.14}/docs/source/api_reference.rst +0 -0
  18. {pyopensky-2.12 → pyopensky-2.14}/docs/source/conf.py +0 -0
  19. {pyopensky-2.12 → pyopensky-2.14}/docs/source/credentials.rst +0 -0
  20. {pyopensky-2.12 → pyopensky-2.14}/docs/source/index.rst +0 -0
  21. {pyopensky-2.12 → pyopensky-2.14}/docs/source/installation.rst +0 -0
  22. {pyopensky-2.12 → pyopensky-2.14}/docs/source/rest.rst +0 -0
  23. {pyopensky-2.12 → pyopensky-2.14}/docs/source/trino.rst +0 -0
  24. {pyopensky-2.12 → pyopensky-2.14}/license.txt +0 -0
  25. {pyopensky-2.12 → pyopensky-2.14}/readme.md +0 -0
  26. {pyopensky-2.12 → pyopensky-2.14}/scripts/decode_pymodes.py +0 -0
  27. {pyopensky-2.12 → pyopensky-2.14}/scripts/decode_rs1090.py +0 -0
  28. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/__init__.py +0 -0
  29. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/api.py +0 -0
  30. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/py.typed +0 -0
  31. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/rest.py +0 -0
  32. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/s3.py +0 -0
  33. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/schema.py +0 -0
  34. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/time.py +0 -0
  35. {pyopensky-2.12 → pyopensky-2.14}/src/pyopensky/trino.py +0 -0
  36. {pyopensky-2.12 → pyopensky-2.14}/tests/test_rest.py +0 -0
  37. {pyopensky-2.12 → pyopensky-2.14}/tests/test_s3.py +0 -0
  38. {pyopensky-2.12 → pyopensky-2.14}/tests/test_trino.py +0 -0
  39. {pyopensky-2.12 → pyopensky-2.14}/tests/test_tzdata.py +0 -0
@@ -36,31 +36,19 @@ jobs:
36
36
  with:
37
37
  fetch-depth: 0
38
38
 
39
- - name: Set up uv
40
- if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
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
- path: /tmp/.uv-cache
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
- ${{ github.workspace }}/cache_opensky
63
- key: opensky-${{ runner.os }}-${{ hashFiles('uv.lock') }}
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 }}
@@ -25,6 +25,7 @@ var/
25
25
  *.egg-info/
26
26
  .installed.cfg
27
27
  *.egg
28
+ .idea/
28
29
 
29
30
  # PyInstaller
30
31
  # Usually these files are written by a python script from a template
@@ -1,9 +1,10 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: pyopensky
3
- Version: 2.12
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>
7
+ License-Expression: MIT
7
8
  Requires-Python: >=3.9
8
9
  Requires-Dist: appdirs>=1.4.4
9
10
  Requires-Dist: httpx>=0.27.2
@@ -11,6 +12,7 @@ Requires-Dist: minio>=7.2.8
11
12
  Requires-Dist: pandas>=2.2.2
12
13
  Requires-Dist: pyarrow>=17.0.0
13
14
  Requires-Dist: pyjwt>=2.9.0
15
+ Requires-Dist: python-dotenv>=1.0.1
14
16
  Requires-Dist: tqdm>=4.66.5
15
17
  Requires-Dist: trino[sqlalchemy]>=0.329.0
16
18
  Requires-Dist: typing-extensions>=4.12.2
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyopensky"
3
- version = "2.12"
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",
@@ -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
- opensky_config_dir = Path(user_config_dir("pyopensky"))
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
- traffic_config_dir = Path(user_config_dir("traffic"))
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():
@@ -12,6 +12,8 @@ from pathlib import Path
12
12
 
13
13
  import httpx
14
14
 
15
+ rk = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
16
+
15
17
 
16
18
  def download_tzdata_windows(
17
19
  year: int = 2022,
@@ -19,9 +21,24 @@ def download_tzdata_windows(
19
21
  name: str = "tzdata",
20
22
  base_dir: None | Path = None,
21
23
  ) -> None:
22
- folder = (
23
- base_dir if base_dir else Path(os.path.expanduser("~")) / "Downloads"
24
- )
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
25
42
 
26
43
  if (folder / name).is_dir():
27
44
  return