airportsdata 20241001__tar.gz → 20250523__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: airportsdata
3
- Version: 20241001
3
+ Version: 20250523
4
4
  Summary: Extensive database of location and timezone data for nearly every airport and landing strip in the world.
5
5
  Author-email: Mike Borsetti <mike+airportsdata@borsetti.com>
6
6
  Maintainer-email: Mike Borsetti <mike+airportsdata@borsetti.com>
@@ -40,7 +40,6 @@ Classifier: Development Status :: 5 - Production/Stable
40
40
  Classifier: License :: OSI Approved :: MIT License
41
41
  Classifier: Programming Language :: Python
42
42
  Classifier: Programming Language :: Python :: 3
43
- Classifier: Programming Language :: Python :: 3.9
44
43
  Classifier: Programming Language :: Python :: 3.10
45
44
  Classifier: Programming Language :: Python :: 3.11
46
45
  Classifier: Programming Language :: Python :: 3.12
@@ -52,16 +51,17 @@ Classifier: Typing :: Typed
52
51
  Requires-Python: >=3.9
53
52
  Description-Content-Type: text/x-rst
54
53
  License-File: LICENSE
54
+ Dynamic: license-file
55
55
 
56
56
  ========================
57
57
  airportsdata |downloads|
58
58
  ========================
59
59
 
60
- .. |ICAO| replace:: 28,237
60
+ .. |ICAO| replace:: 28,223
61
61
 
62
- .. |IATA| replace:: 7,876
62
+ .. |IATA| replace:: 7,859
63
63
 
64
- .. |LID| replace:: 12,604
64
+ .. |LID| replace:: 12,609
65
65
 
66
66
  .. |pyversion| image:: https://img.shields.io/pypi/v/airportsdata.svg
67
67
  :target: https://pypi.org/project/airportsdata/
@@ -106,16 +106,16 @@ Each entry consists of the following data:
106
106
  entries);
107
107
  * ``iata``: IATA 3-letter Location Code (|IATA| entries) or an empty string [#]_;
108
108
  * ``name``: Official name (diacritized latin script);
109
- * ``city``: City (diacritized latin script), ideally using the local language;
109
+ * ``city``: City (diacritized latin script), ideally using the local language or English;
110
110
  * ``subd``: Subdivision (e.g. state, province, region, etc.), ideally using the local-language or English names of
111
111
  `ISO 3166-2 <https://en.wikipedia.org/wiki/ISO_3166-2#Current_codes>`__;
112
112
  * ``country``: `ISO 3166-1 <https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes>`__ alpha-2 country code
113
113
  (plus ``XK`` for Kosovo);
114
114
  * ``elevation``: MSL elevation of the highest point of the landing area, in feet (warning: it is often wrong);
115
115
  * ``lat``: Latitude (decimal) of the `airport reference point
116
- <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 decimal digits);
116
+ <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 or 6 decimal digits);
117
117
  * ``lon``: Longitude (decimal) of the `airport reference point
118
- <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 decimal digits);
118
+ <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 or 6 decimal digits);
119
119
  * ``tz``: Timezone expressed as a `tz database name <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>`__
120
120
  (IANA-compliant);
121
121
  * ``lid``: U.S. FAA Location Identifier (|LID| entries), or an empty string.
@@ -124,8 +124,8 @@ Each entry consists of the following data:
124
124
  how the Pseudo-ICAO Identifier is generated for airports and seaplane bases without an ICAO 4-letter Location
125
125
  Indicator.
126
126
 
127
- .. [#] IATA Multi Airport Cities are not not airports and therfore not included, but we provide a database and a Python
128
- function that returns the above data for all the airports of a IATA MAC. Please see documentation `here
127
+ .. [#] IATA Multi Airport Cities (MAC) are not not airports and therfore not included, but we provide a database and a
128
+ Python function that returns the above data for all the airports of a IATA MAC. Please see documentation `here
129
129
  <https://github.com/mborsetti/airportsdata/blob/main/README_IATA.rst>`__.
130
130
 
131
131
  Best efforts are placed to review all contributions for accuracy, but accuracy cannot be guaranteed nor should be
@@ -134,7 +134,10 @@ expected by users.
134
134
  Important notes:
135
135
 
136
136
  * Timezone was originally sourced from `TimeZoneDB <https://timezonedb.com>`__;
137
- * No historical data (closed airports are removed).
137
+ * No historical data (closed airports are removed);
138
+ * No heliports without a IATA code;
139
+ * No sea bases without a IATA code;
140
+ * No surface transportation stations, even if they have an official IATA code.
138
141
 
139
142
  Please report any issues you may find `here
140
143
  <https://github.com/mborsetti/airportsdata/blob/main/CONTRIBUTING.rst>`__.
@@ -2,11 +2,11 @@
2
2
  airportsdata |downloads|
3
3
  ========================
4
4
 
5
- .. |ICAO| replace:: 28,237
5
+ .. |ICAO| replace:: 28,223
6
6
 
7
- .. |IATA| replace:: 7,876
7
+ .. |IATA| replace:: 7,859
8
8
 
9
- .. |LID| replace:: 12,604
9
+ .. |LID| replace:: 12,609
10
10
 
11
11
  .. |pyversion| image:: https://img.shields.io/pypi/v/airportsdata.svg
12
12
  :target: https://pypi.org/project/airportsdata/
@@ -51,16 +51,16 @@ Each entry consists of the following data:
51
51
  entries);
52
52
  * ``iata``: IATA 3-letter Location Code (|IATA| entries) or an empty string [#]_;
53
53
  * ``name``: Official name (diacritized latin script);
54
- * ``city``: City (diacritized latin script), ideally using the local language;
54
+ * ``city``: City (diacritized latin script), ideally using the local language or English;
55
55
  * ``subd``: Subdivision (e.g. state, province, region, etc.), ideally using the local-language or English names of
56
56
  `ISO 3166-2 <https://en.wikipedia.org/wiki/ISO_3166-2#Current_codes>`__;
57
57
  * ``country``: `ISO 3166-1 <https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes>`__ alpha-2 country code
58
58
  (plus ``XK`` for Kosovo);
59
59
  * ``elevation``: MSL elevation of the highest point of the landing area, in feet (warning: it is often wrong);
60
60
  * ``lat``: Latitude (decimal) of the `airport reference point
61
- <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 decimal digits);
61
+ <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 or 6 decimal digits);
62
62
  * ``lon``: Longitude (decimal) of the `airport reference point
63
- <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 decimal digits);
63
+ <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 or 6 decimal digits);
64
64
  * ``tz``: Timezone expressed as a `tz database name <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>`__
65
65
  (IANA-compliant);
66
66
  * ``lid``: U.S. FAA Location Identifier (|LID| entries), or an empty string.
@@ -69,8 +69,8 @@ Each entry consists of the following data:
69
69
  how the Pseudo-ICAO Identifier is generated for airports and seaplane bases without an ICAO 4-letter Location
70
70
  Indicator.
71
71
 
72
- .. [#] IATA Multi Airport Cities are not not airports and therfore not included, but we provide a database and a Python
73
- function that returns the above data for all the airports of a IATA MAC. Please see documentation `here
72
+ .. [#] IATA Multi Airport Cities (MAC) are not not airports and therfore not included, but we provide a database and a
73
+ Python function that returns the above data for all the airports of a IATA MAC. Please see documentation `here
74
74
  <https://github.com/mborsetti/airportsdata/blob/main/README_IATA.rst>`__.
75
75
 
76
76
  Best efforts are placed to review all contributions for accuracy, but accuracy cannot be guaranteed nor should be
@@ -79,7 +79,10 @@ expected by users.
79
79
  Important notes:
80
80
 
81
81
  * Timezone was originally sourced from `TimeZoneDB <https://timezonedb.com>`__;
82
- * No historical data (closed airports are removed).
82
+ * No historical data (closed airports are removed);
83
+ * No heliports without a IATA code;
84
+ * No sea bases without a IATA code;
85
+ * No surface transportation stations, even if they have an official IATA code.
83
86
 
84
87
  Please report any issues you may find `here
85
88
  <https://github.com/mborsetti/airportsdata/blob/main/CONTRIBUTING.rst>`__.
@@ -10,8 +10,8 @@ from pathlib import Path
10
10
  from typing import Dict, Literal, TypedDict
11
11
 
12
12
  __project_name__ = __package__
13
- __min_python_version__ = (3, 9) # minimum version of Python required to run; supported until 4 October 2024
14
- __version__ = '20241001' # numbering follows the release date
13
+ __min_python_version__ = (3, 10) # minimum version of Python required to run; supported until October 2025
14
+ __version__ = '20250523' # numbering follows the release date
15
15
  __author__ = 'Mike Borsetti <mike@borsetti.com>'
16
16
  __copyright__ = 'Copyright 2020- Mike Borsetti'
17
17
  __license__ = 'MIT'
@@ -57,14 +57,6 @@ def load(code_type: CodeType = 'ICAO') -> Dict[str, 'Airport']:
57
57
  Originally sourced from [TimeZoneDB](https://timezonedb.com)
58
58
  'lid': The FAA Location Identifier (for US country only; others is blank)
59
59
  """
60
- # with open(os.path.join(dir, 'airports.json'), encoding='utf8') as f:
61
- # airports = json.load(f)
62
- # if code_type.lower() == 'icao':
63
- # return airports
64
- # else:
65
- # return {airport['iata']: airport for airport in dict(airports).values() if airport['iata']}
66
- #
67
- #
68
60
  key = code_type.lower()
69
61
  if key not in ('icao', 'iata', 'lid'):
70
62
  raise ValueError(f'code_type must be one of ICAO, IATA or LID; received {code_type}')
@@ -73,6 +65,8 @@ def load(code_type: CodeType = 'ICAO') -> Dict[str, 'Airport']:
73
65
  with this_dir.joinpath('airports.csv').open(encoding='utf8') as f:
74
66
  reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
75
67
  for row in reader:
68
+ # if row[key] and row[key] in airports:
69
+ # raise ValueError(f"Duplicate key in csv: '{row[key]}'")
76
70
  airports[row[key]] = row # type: ignore[assignment]
77
71
  airports.pop('', None)
78
72
  return airports
@@ -88,18 +82,14 @@ def load_iata_macs() -> dict[str, IATAMAC]:
88
82
  'airports': a dict with the same data returned by load() for each airport that makes up the Multi Airport
89
83
  City, where the key is the airport's IATA code.
90
84
  """
91
- # with open(os.path.join(dir, 'airports.json'), encoding='utf8') as f:
92
- # airports = json.load(f)
93
- # if code_type.lower() == 'icao':
94
- # return airports
95
- # else:
96
- # return {airport['iata']: airport for airport in dict(airports).values() if airport['iata']}
97
- #
98
- #
99
85
  airports = load('IATA')
100
86
  this_dir = Path(__file__).parent
101
87
  iata_macs: dict[str, IATAMAC] = {}
102
88
  row_d: dict[str, str]
89
+ multi_airport_city_code = ''
90
+ name = ''
91
+ country = ''
92
+ airport = ''
103
93
  with this_dir.joinpath('iata_macs.csv').open(encoding='utf8') as f:
104
94
  reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
105
95
  for row_d in reader: