Skip to content

v4.0.0

Latest
Compare
Choose a tag to compare
@jodal jodal released this 07 Apr 20:54
· 13 commits to main since this release
d488b00

This release contains a number of breaking changes, thus the version bump to 4.0. See the upgrade guide for the full details and steps for quickly updating your code to work with Biip 4.0.

Breaking changes

  • Result objects are now immutable. (PR: #393)
  • biip.parse() no longer raises ParseError when all parsers fail. (PR: #376)
  • All configuration options must be passed via the new ParseConfig class. (PR: #385)
  • Several classes and fields in the low-level API have been moved or renamed. (PR: #375, #379, #380, #381, #382, #391, #392)
  • Python 3.9 is no longer supported. (PR: #383)

See the upgrade guide for full details.

Support for GS1 Web URIs

Biip can now work with GS1 Web URIs. (Fixes: #83, PR: #387)

All GS1 Application Identifiers are supported:

>>> import biip
>>> result = biip.parse("https://www.example.com/products/gtin/07032069804988?10=0329&15=210526")
>>> result.gs1_web_uri.as_canonical_uri()
'https://id.gs1.org/01/07032069804988/10/0329?15=210526'

Conversion back and forth between GS1 Web URIs and GS1 Messages are fully supported:

>>> message = result.gs1_web_uri.as_gs1_message()
>>> message.as_hri()
'(01)07032069804988(10)0329(15)210526'
>>> web_uri = message.as_gs1_web_uri()
>>> web_uri.as_uri(domain="example.com", prefix="products")
'https://example.com/products/01/07032069804988/10/0329?15=210526'

See the GS1 Web URIs section in the quickstart guide for an introduction.

Date validation in GS1 element strings can now be disabled

It is now possible to disable validation of the dates in GS1 element strings with the gs1_element_strings_verify_date option. When validation is disabled, invalid date values are still available as text in the GS1ElementString.value field, but the GS1ElementString.date field is None. (Fixes: #247, PR: 386, #389)

Revamped documentation

This release comes with revamped documentation, where all parts of the documentation has been reviewed and polished. Also, the documentation system has been switched from Sphinx to MkDocs.

Support for pretty-printing with Rich

All objects returned from Biip now supports the Rich pretty-printing protocol, making them a lot nicer to work with in the terminal. Biip does not depend on Rich, so you have to install it yourself, and then use Rich's print function to print Biip objects.

>>> from rich import print
>>> import biip
>>> print(biip.parse("7032069804988"))

Fixes

  • Correctly attribute GTIN-8 prefixes assigned to GS1 UK and GS1 Poland. (Fixes: #162, PR: #384)
  • Update GS1 Prefix database. (PR: #382)
  • Update GS1 Company Prefix database. (PR: #382)
  • Update GS1 Application Identifier database. (PR: #382)