You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pycountry is only used in function is_valid_country_code to validate that a code is a valid ISO-3166-1 two letter code. This logic was added in commit a1589e7.
Depending on pycountry for this task is problematic as pycountry has a wheel size of 6.3MB and a size of 17MB uncompressed. This may not seem much but:
it's a considerable size for docker images (~1/3 of python-slim)
it contributes a sizable bandwidth for the Pypi servers. Based on the Pypy stats and assuming half the installs will also download pycountry, then it would be about 10TB/month. Note that Python has asked some projects to reduce the bandwidth generated.
Note that most of the pycountry packages spaces come from the locales, which are unused in this project. So one alternative could be just to vendor the file https://github.com/pycountry/pycountry/blob/main/src/pycountry/databases/iso3166-1.json which has a size of only 42.3kB. However, given the use we could even go further and generate a set of all ISO codes, which has a size of 1495 bytes.
To generate such list we could even use pycountry itself (as a dev dependency) by doing
pycountry
is only used in function is_valid_country_code to validate that a code is a valid ISO-3166-1 two letter code. This logic was added in commit a1589e7.Depending on pycountry for this task is problematic as pycountry has a wheel size of 6.3MB and a size of 17MB uncompressed. This may not seem much but:
Note that most of the pycountry packages spaces come from the locales, which are unused in this project. So one alternative could be just to vendor the file https://github.com/pycountry/pycountry/blob/main/src/pycountry/databases/iso3166-1.json which has a size of only 42.3kB. However, given the use we could even go further and generate a set of all ISO codes, which has a size of 1495 bytes.
To generate such list we could even use pycountry itself (as a dev dependency) by doing
The text was updated successfully, but these errors were encountered: