The smart and fast way to work with ISO 3166 countries and subdivisions, on
*nix
systems in Elixir.
This library depends upon the widely available pkg-isocodes
linux
package. Most linux distros depend upon the famous Debian
iso-codes repo for this.
Your distro might call this package something else, so here's a handy list of links.
Arch Ubuntu Fedora
And, please help me add links for other distros, I'm a lazy human!
I'm not a genius, I found this is how
pycountry
does it.
Then, ctrl+c ctrl+v
Here's a list of alternative libraries:
- countriex
- Only country data 👎
- Very low maintenance as it simply pulls data from the ruby countries gem.
- Still, the regeneration task has to be run manually.
- Countries
- Has both country and subdivision data 👍
- Very high maintenance as it brings all the data along as
YAML
. 👎 YAML
parsing is soooooo slow 😠 (too many files, parse done serially... it's YAML what do you expect?)
- Worldly
- Very high maintenance as it brings all the data along as
YAML
. 👎 YAML
parsing is soooooo slow 😠 (they even accept it on their README).
- Very high maintenance as it brings all the data along as
I have two unbeatable arguments for ExRegion
,
-
Speed
- Parse just two
JSON
files (< 500KB) using [jason
][jason].
- Parse just two
-
Free maintenance Yes, I have my cake and eat it too. Thanks to the awesome team that maintains the upstream debian repo, and people at ISO.
If you ever notice that the standards got updated, simply upgrade your
iso-codes
package!
Easy, just see if there's something at /usr/share/iso-codes/json/
.
If available in Hex, the package can be installed
by adding exregion
to your list of dependencies in mix.exs
:
def deps do
[
{:exregion, "~> 0.1.0"}
]
end
The goal is primarily speed and leveraging commonly available linux packages.
- So the [debian repo] exposes many ISO standards, and even translations in almost every locale. Wouldn't it be nice if we can get all that?
- Some cool functions to group or filter things?
- Time zone info
- Tests.
- Integrate with CLDR? There are already some repos in the Elixir world like money -- don't wanna compete with them.
- Geo and topological information?
- Demographics?