Changes
=======

22.3.5 (2022-03-05)
-------------------

- Update to iso-codes 4.9.0.


22.1.10 (2022-01-10)
--------------------

- Update to iso-codes 4.8.0. (Thanks to llimeht!)


20.7.3 (2020-07-03)
-------------------

- Fix bug #37: (accidental) unconditional pkg_resources import.
  (thanks, crbunney)

20.7.2 (2020-07-02)
-------------------

- Add (auto-generated) __version__ attribute to the main module.
  (Fixes issue #4)

- Add fuzzy search to historic countries. (Fixe issue #26)

- Update to iso-codes 4.5.0.

- PR 9: Clean up the normalization (lower casing) of values in indexes and searches.
  See PR https://github.com/flyingcircusio/pycountry/pull/9 for detailed
  discussion. This also fixed issue #8.

- Smaller cleanups and build environment version bumps.

- PR 35: Python 3-only cleanups and updated Python minor version compatibility
  (thanks, Djailla)

- PR 33: Remove defunct bugtracker link from README (thanks, jwilk)

- P3 32: (Somewhat hilarious) Typo (thanks, jwilk)

- Moved to Git/Github; switched from Bitbucket Pipelines to Travis builds.


19.8.18 (2019-08-18)
--------------------

- Fix installation on systems that don't have UTF-8
  as default encoding. (#13422)

- Remove superfluous print debugging output. (#13424)


19.7.15 (2019-07-15)
--------------------

- Update to iso-codes 4.3.

- Add support for ISO 639-5 (Language Families and Groups).

- Drop support for Python 2.

- Add `search_fuzzy()` function to the countries database. This allows
  for dealing with user searches that aren't really aware of ISO 3166 (so,
  like, actual human beings). A bit of character normalization and prioritizing
  matches between multiple criteria allows building somewhat reasonable
  suggestion/autocompletion lists. (#13418)

  Caveat emptor: no attention has been paid to performance in this feature.


18.12.8 (2018-12-08)
--------------------

WARNING: This release contains a subtle but important API change that may break
integrations!

Looking at #13416 I realized that I made a terrible API design choice with
respect to how the `get` function should behave in Python. Probably under the
influence of either too little or too much whiskey I went and implemented `get`
so that it raises a KeyError instead of doing the Pythonic thing and returning
None and allowing to customize the `default`. There was a bit of back-and-forth
around this code in previous releases (specifically touching edge cases to
have the Subdivision API behave "reasonably", although there doesn't seem
to be *one* right way there.)

Anyway, when preparing this release and reviewing #13416 and the other related
issues and changes from the past I noticed my mistake an decide to fix it
going forward.

So, from now on `get` will behave as expected in Python and yes, this means
you will have to update your integration code carefully now checking for
`None` returns instead of expecting KeyErrors. This is work, but I think it's
worthwhile to uphold this convention within the Python community.

- Switch API from "get + KeyError" to " get + default=None". This is
  a subtle API-breaking change. Please update carefully. (#13416)

- Update to iso-codes 4.1.


18.5.26 (2018-05-26)
--------------------

- Fix #13394: incorrect KeyError shadowing in Subdivisions.get()
- Fix #13398: make lazy loading thread-safe.

18.5.20 (2018-05-20)
--------------------

- Update to iso-codes 3.79.


18.2.23 (2018-02-23)
--------------------

- Update to iso-codes 3.78.


17.9.23 (2017-09-23)
--------------------

- Update to iso-codes 3.76, which fixes #13398.


17.5.14 (2017-05-14)
--------------------

- Update to iso-codes 3.75, which fixes #13389 again.
  (bad parent codes for GB).

- Switch from building on drone.io (discontinued service) to
  bitbucket's Pipelines.

- Update pytest dependencies to get rid of API warnings.

17.01.08 (2017-01-08)
---------------------

- Update to iso-codes 3.73, which fixes #13389 (bad parent codes for CZ).


17.01.02 (2017-01-02)
---------------------

- Return empty lists from the subdivision database if the country exists
  but does not have any subdivisions. Fixes #13374.

- Some typo fixes. Thanks to @VictorMireyev.

- Update to iso-codes-3.72.


16.11.27.1 (2016-11-27)
-----------------------

- 16.11.27 was a brown bag release. I merged the PRs online, but didn't
  pull them. Well. This is what 16.11.27 actually should have been.


16.11.27 (2016-11-27)
---------------------

- Fix encoding issue on Python 3 (which seems to have been limited to
  some platforms.) Via PR17, fixes #13386.
  Thanks to @masroore and @hiaselhans.

- Documentation fix: iso639_1_code is not a valid key for languages any
  more. Fixes #13387, thanks to @jmitzka.

- Update to iso-codes-3.71.


16.11.08 (2016-11-08)
---------------------

This release was heavily supported by @zware who fixed some of the issues
I overlooked in the last releases and a few enhancements.

* All data objects now have a repr() that includes all values. (@zware)

* All database objects now have a lookup method that takes a value and
  returns the first data object that has an attribute that matches the value.
  Note that searching is halted when the first match is found. (@zware)

* Clean up historical countries: the deleted flag is gone and there is no
  database that holds both historical and present countries any longer.
  The record formats are too different to keep this facade up reasonably well.

* Fix parent lookup for subdivisions.

* Update README to correctly show the updated field names.

* Update pins for the packages we depend on.

* Reduce Python test coverage to Python 2.7 and 3.5 -- I can't sustain
  running a bazillion Python versions all the time forever.

* Fix Python 3 compatibility (@zware)



16.10.23rc3 (2016-10-23)
------------------------

- Incorporate some typos and suggested README improvements from @Pander in #13375.


16.10.23rc2 (2016-10-23)
------------------------

- Adapt README to the new attributes.


16.10.23rc1 (2016-10-23)
------------------------

This is a major change. The upstream packages have been revamped from the
former XML databases to use JSON. They adapted their schemata a bit and thus
made some of the structures in pycountry superfluous (yay!). Memory usage went
down when all databases are loaded (32.7 MiB down from 83.6 MiB) and
performance has gone up (not measured scientifically, but it's noticable when
loading the DBs in an interactive session).

To mark this major change, I'm also switch from the existing (not useful)
SemVer-based version numbers to CalVer-based numbers using YY.MM.DD.micro as
the pattern.

To avoid adding more complexity I have removed code that really only was
necessary because of the complexity of using the XML databases.

Here's what you need to know:

- I updated to iso-codes 3.70 which is a lot fresher than the
  last release.

- Attribute names have changed. There is no longer a mapping
  going on between the sources and the object attributes. Take
  a look at the JSON files (or inspect the objects) to see
  which fields are supported.

  You can also inspect the automatically build indexes (db.indices) to see all
  keys in a database. Not every object supports every attribute - this depends
  on the quality of the data from pkg-isocodes.

  Attribute names are more coherent now, too. Note that "alpha2", "alpha4",
  etc. are now using an underscore as that's the pattern in the upstream
  packages. So it's "alpha_2" now.

- HistoricCountries no longer includes countries that still
  exist. I removed the computed fields that were meant to
  make it easy to filter.
