airportsdata 20240806__tar.gz → 20250204__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,63 +1,44 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: airportsdata
3
- Version: 20240806
3
+ Version: 20250204
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>
7
- License: The MIT License (MIT)
8
-
9
- Copyright (c) 2020- Mike Borsetti <mike@borsetti.com>
10
-
11
- This project includes data from https://github.com/mwgg/Airports Copyright
12
- (c) 2014 mwgg
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- The above copyright notice and this permission notice shall be included in all
22
- copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- SOFTWARE.
31
-
7
+ License-Expression: MIT
32
8
  Project-URL: Documentation, https://github.com/mborsetti/airportsdata/blob/main/README.rst
33
9
  Project-URL: Repository, https://github.com/mborsetti/airportsdata/
34
10
  Project-URL: Database (csv), https://github.com/mborsetti/airportsdata/blob/main/airportsdata/airports.csv
35
11
  Project-URL: Changelog, https://github.com/mborsetti/airportsdata/blob/main/CHANGELOG.rst
36
12
  Project-URL: Issues, https://github.com/mborsetti/airportsdata/issues
13
+ Project-URL: CI, https://github.com/mborsetti/airportsdata/actions
37
14
  Keywords: airports,aerodromes,ICAO,IATA
38
15
  Classifier: Development Status :: 5 - Production/Stable
39
- Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Natural Language :: English
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python
40
20
  Classifier: Programming Language :: Python :: 3
41
- Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3 :: Only
42
22
  Classifier: Programming Language :: Python :: 3.10
43
23
  Classifier: Programming Language :: Python :: 3.11
44
24
  Classifier: Programming Language :: Python :: 3.12
45
- Classifier: Operating System :: OS Independent
46
- Classifier: Topic :: Database
47
- Classifier: Intended Audience :: Developers
48
- Requires-Python: >=3.9
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Programming Language :: Python :: Implementation :: CPython
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.10
49
29
  Description-Content-Type: text/x-rst
50
30
  License-File: LICENSE
31
+ Dynamic: license-file
51
32
 
52
33
  ========================
53
34
  airportsdata |downloads|
54
35
  ========================
55
36
 
56
- .. |ICAO| replace:: 28,226
37
+ .. |ICAO| replace:: 28,274
57
38
 
58
- .. |IATA| replace:: 7,867
39
+ .. |IATA| replace:: 7,865
59
40
 
60
- .. |LID| replace:: 12,604
41
+ .. |LID| replace:: 12,610
61
42
 
62
43
  .. |pyversion| image:: https://img.shields.io/pypi/v/airportsdata.svg
63
44
  :target: https://pypi.org/project/airportsdata/
@@ -102,16 +83,16 @@ Each entry consists of the following data:
102
83
  entries);
103
84
  * ``iata``: IATA 3-letter Location Code (|IATA| entries) or an empty string [#]_;
104
85
  * ``name``: Official name (diacritized latin script);
105
- * ``city``: City (diacritized latin script), ideally using the local language;
86
+ * ``city``: City (diacritized latin script), ideally using the local language or English;
106
87
  * ``subd``: Subdivision (e.g. state, province, region, etc.), ideally using the local-language or English names of
107
88
  `ISO 3166-2 <https://en.wikipedia.org/wiki/ISO_3166-2#Current_codes>`__;
108
89
  * ``country``: `ISO 3166-1 <https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes>`__ alpha-2 country code
109
90
  (plus ``XK`` for Kosovo);
110
91
  * ``elevation``: MSL elevation of the highest point of the landing area, in feet (warning: it is often wrong);
111
92
  * ``lat``: Latitude (decimal) of the `airport reference point
112
- <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 decimal digits);
93
+ <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 or 6 decimal digits);
113
94
  * ``lon``: Longitude (decimal) of the `airport reference point
114
- <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 decimal digits);
95
+ <https://en.wikipedia.org/wiki/Airport_reference_point>`__ (max 5 or 6 decimal digits);
115
96
  * ``tz``: Timezone expressed as a `tz database name <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>`__
116
97
  (IANA-compliant);
117
98
  * ``lid``: U.S. FAA Location Identifier (|LID| entries), or an empty string.
@@ -120,8 +101,8 @@ Each entry consists of the following data:
120
101
  how the Pseudo-ICAO Identifier is generated for airports and seaplane bases without an ICAO 4-letter Location
121
102
  Indicator.
122
103
 
123
- .. [#] IATA Multi Airport Cities are not not airports and therfore not included, but we provide a database and a Python
124
- function that returns the above data for all the airports of a IATA MAC. Please see documentation `here
104
+ .. [#] IATA Multi Airport Cities (MAC) are not not airports and therfore not included, but we provide a database and a
105
+ Python function that returns the above data for all the airports of a IATA MAC. Please see documentation `here
125
106
  <https://github.com/mborsetti/airportsdata/blob/main/README_IATA.rst>`__.
126
107
 
127
108
  Best efforts are placed to review all contributions for accuracy, but accuracy cannot be guaranteed nor should be
@@ -130,7 +111,10 @@ expected by users.
130
111
  Important notes:
131
112
 
132
113
  * Timezone was originally sourced from `TimeZoneDB <https://timezonedb.com>`__;
133
- * No historical data (closed airports are removed).
114
+ * No historical data (closed airports are removed);
115
+ * No heliports without a IATA code;
116
+ * No sea bases without a IATA code;
117
+ * No surface transportation stations, even if they have an official IATA code.
134
118
 
135
119
  Please report any issues you may find `here
136
120
  <https://github.com/mborsetti/airportsdata/blob/main/CONTRIBUTING.rst>`__.
@@ -138,7 +122,10 @@ Please report any issues you may find `here
138
122
  This project is a fork of https://github.com/mwgg/Airports. All new data submitted in this fork have been validated
139
123
  against national `Aeronautical Information Publications (AIP) or equivalent
140
124
  <https://github.com/mborsetti/airportsdata/blob/main/README_AIP.rst>`__ (or
141
- ARINC database) and `IATA <https://www.iata.org/en/publications/directories/code-search/>`__ before publishing.
125
+ ARINC database) and `IATA <https://www.iata.org/en/publications/directories/code-search/>`__ or
126
+ `<https://www.ch-aviation.com/airports/{IATA}>`__ before publishing.
127
+ ARINC database) and `IATA <https://www.iata.org/en/publications/directories/code-search/>`__ or
128
+ `<https://www.ch-aviation.com/airports/{IATA}>`_ before publishing.
142
129
 
143
130
  Raw data
144
131
  ========
@@ -150,35 +137,41 @@ Python
150
137
  ======
151
138
  |pyversion| |support| |format| |status| |security| |CI| |coveralls| |issues|
152
139
 
153
- Install from `PyPi <https://pypi.org/project/airportsdata/>`__ using pip:
140
+ Install from `PyPi <https://pypi.org/project/airportsdata/>`__ using ``uv`` (recommended):
141
+
142
+ .. code-block:: bash
143
+
144
+ uv pip install --update airportsdata
145
+
146
+ Or, using ``pip``:
154
147
 
155
148
  .. code-block:: bash
156
149
 
157
- pip install -U airportsdata
150
+ pip install --update airportsdata
158
151
 
159
152
  Once installed, to load the data into a dict:
160
153
 
161
154
  .. code-block:: python
162
155
 
163
156
  import airportsdata
164
- airports = airportsdata.load() # key is the ICAO identifier (the default)
165
- print(airports['KJFK'])
157
+ icao_airports = airportsdata.load() # key is the ICAO identifier (the default)
158
+ print(icao_airports['KJFK'])
166
159
 
167
160
  or
168
161
 
169
162
  .. code-block:: python
170
163
 
171
164
  import airportsdata
172
- airports = airportsdata.load('IATA') # key is the IATA location code
173
- print(airports['JFK'])
165
+ iata_airports = airportsdata.load('IATA') # key is the IATA location code
166
+ print(iata_airports['JFK'])
174
167
 
175
168
  or
176
169
 
177
170
  .. code-block:: python
178
171
 
179
172
  import airportsdata
180
- airports = airportsdata.load('LID') # key is the FAA LID
181
- print(airports['01AA'])
173
+ lid_airports = airportsdata.load('LID') # key is the FAA LID
174
+ print(lid_airports['01AA'])
182
175
 
183
176
  Older Python versions are supported for 3 years after being obsoleted by a new major release (i.e. about 4 years
184
177
  since their original release).
@@ -2,11 +2,11 @@
2
2
  airportsdata |downloads|
3
3
  ========================
4
4
 
5
- .. |ICAO| replace:: 28,226
5
+ .. |ICAO| replace:: 28,274
6
6
 
7
- .. |IATA| replace:: 7,867
7
+ .. |IATA| replace:: 7,865
8
8
 
9
- .. |LID| replace:: 12,604
9
+ .. |LID| replace:: 12,610
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>`__.
@@ -87,7 +90,10 @@ Please report any issues you may find `here
87
90
  This project is a fork of https://github.com/mwgg/Airports. All new data submitted in this fork have been validated
88
91
  against national `Aeronautical Information Publications (AIP) or equivalent
89
92
  <https://github.com/mborsetti/airportsdata/blob/main/README_AIP.rst>`__ (or
90
- ARINC database) and `IATA <https://www.iata.org/en/publications/directories/code-search/>`__ before publishing.
93
+ ARINC database) and `IATA <https://www.iata.org/en/publications/directories/code-search/>`__ or
94
+ `<https://www.ch-aviation.com/airports/{IATA}>`__ before publishing.
95
+ ARINC database) and `IATA <https://www.iata.org/en/publications/directories/code-search/>`__ or
96
+ `<https://www.ch-aviation.com/airports/{IATA}>`_ before publishing.
91
97
 
92
98
  Raw data
93
99
  ========
@@ -99,35 +105,41 @@ Python
99
105
  ======
100
106
  |pyversion| |support| |format| |status| |security| |CI| |coveralls| |issues|
101
107
 
102
- Install from `PyPi <https://pypi.org/project/airportsdata/>`__ using pip:
108
+ Install from `PyPi <https://pypi.org/project/airportsdata/>`__ using ``uv`` (recommended):
103
109
 
104
110
  .. code-block:: bash
105
111
 
106
- pip install -U airportsdata
112
+ uv pip install --update airportsdata
113
+
114
+ Or, using ``pip``:
115
+
116
+ .. code-block:: bash
117
+
118
+ pip install --update airportsdata
107
119
 
108
120
  Once installed, to load the data into a dict:
109
121
 
110
122
  .. code-block:: python
111
123
 
112
124
  import airportsdata
113
- airports = airportsdata.load() # key is the ICAO identifier (the default)
114
- print(airports['KJFK'])
125
+ icao_airports = airportsdata.load() # key is the ICAO identifier (the default)
126
+ print(icao_airports['KJFK'])
115
127
 
116
128
  or
117
129
 
118
130
  .. code-block:: python
119
131
 
120
132
  import airportsdata
121
- airports = airportsdata.load('IATA') # key is the IATA location code
122
- print(airports['JFK'])
133
+ iata_airports = airportsdata.load('IATA') # key is the IATA location code
134
+ print(iata_airports['JFK'])
123
135
 
124
136
  or
125
137
 
126
138
  .. code-block:: python
127
139
 
128
140
  import airportsdata
129
- airports = airportsdata.load('LID') # key is the FAA LID
130
- print(airports['01AA'])
141
+ lid_airports = airportsdata.load('LID') # key is the FAA LID
142
+ print(lid_airports['01AA'])
131
143
 
132
144
  Older Python versions are supported for 3 years after being obsoleted by a new major release (i.e. about 4 years
133
145
  since their original release).
@@ -3,6 +3,7 @@
3
3
  """
4
4
  Extensive database of location and timezone data for nearly every airport and landing strip in the world.
5
5
  """
6
+
6
7
  from __future__ import annotations
7
8
 
8
9
  import csv
@@ -10,8 +11,8 @@ from pathlib import Path
10
11
  from typing import Dict, Literal, TypedDict
11
12
 
12
13
  __project_name__ = __package__
13
- __min_python_version__ = (3, 9) # minimum version of Python required to run; supported until 4 October 2024
14
- __version__ = '20240806' # numbering follows the release date
14
+ __min_python_version__ = (3, 10) # minimum version of Python required to run; supported until October 2025
15
+ __version__ = '20250204' # numbering follows the release date (UTC)
15
16
  __author__ = 'Mike Borsetti <mike@borsetti.com>'
16
17
  __copyright__ = 'Copyright 2020- Mike Borsetti'
17
18
  __license__ = 'MIT'
@@ -57,14 +58,6 @@ def load(code_type: CodeType = 'ICAO') -> Dict[str, 'Airport']:
57
58
  Originally sourced from [TimeZoneDB](https://timezonedb.com)
58
59
  'lid': The FAA Location Identifier (for US country only; others is blank)
59
60
  """
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
61
  key = code_type.lower()
69
62
  if key not in ('icao', 'iata', 'lid'):
70
63
  raise ValueError(f'code_type must be one of ICAO, IATA or LID; received {code_type}')
@@ -73,7 +66,9 @@ def load(code_type: CodeType = 'ICAO') -> Dict[str, 'Airport']:
73
66
  with this_dir.joinpath('airports.csv').open(encoding='utf8') as f:
74
67
  reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
75
68
  for row in reader:
76
- airports[row[key]] = row # type: ignore[assignment]
69
+ # if row[key] and row[key] in airports:
70
+ # raise ValueError(f"Duplicate key in csv: '{row[key]}'")
71
+ airports[row[key]] = row
77
72
  airports.pop('', None)
78
73
  return airports
79
74
 
@@ -88,18 +83,14 @@ def load_iata_macs() -> dict[str, IATAMAC]:
88
83
  'airports': a dict with the same data returned by load() for each airport that makes up the Multi Airport
89
84
  City, where the key is the airport's IATA code.
90
85
  """
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
86
  airports = load('IATA')
100
87
  this_dir = Path(__file__).parent
101
88
  iata_macs: dict[str, IATAMAC] = {}
102
89
  row_d: dict[str, str]
90
+ multi_airport_city_code = ''
91
+ name = ''
92
+ country = ''
93
+ airport = ''
103
94
  with this_dir.joinpath('iata_macs.csv').open(encoding='utf8') as f:
104
95
  reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
105
96
  for row_d in reader:
@@ -113,7 +104,7 @@ def load_iata_macs() -> dict[str, IATAMAC]:
113
104
  elif key == 'Airport Code':
114
105
  airport = value
115
106
  if multi_airport_city_code not in iata_macs:
116
- iata_macs[multi_airport_city_code] = { # type: ignore[assignment]
107
+ iata_macs[multi_airport_city_code] = {
117
108
  'name': name,
118
109
  'country': country,
119
110
  'airports': {airport: airports[airport]},