okonomiyaki 3.0.0
Self-contained library to deal with metadata in Enthought-specific egg and runtime archives
License: BSD-3-Clause
Requires Python: >=3.6

Okonomiyaki is an experimental library aimed at consolidating a lot of our
low-level code used for Enthought's eggs.

The library contains code for the following:

* producing EDM and enpkg-compatible egg from a tree + metadata
* object models for eggs metadata, as well as versions and platform
  representations

It works on Python >= 3.6, It is expected to work on pretty
much any compliant python implementation.

Note
----

* Version instances are available without extra dependencies so use ``pip install okonomiyaki``
* Platform instances are available by installing ``pip install okonomiyaki[platforms]``
* Egg metadata and archive tools are available by installing ``pip install okonomiyaki[formats]``
* The full set of functionality, please use ``pip install okonomiyaki[all]``


Examples
========

Version parsing
---------------

To parse versions::

     from okonomiyaki.versions import EnpkgVersion
     # Every Version class has a from_string constructor
     v1 = EnpkgVersion.from_string("1.3.3-1")
     v2 = EnpkgVersion.from_string("1.3.2-3")

     assert v1 > v2

Version instances are designed to be immutable, and to be used as keys in
dictionaries.

Platform parsing
----------------

To parse epd platform strings (``rh5-64``, ``rh6_x86_64``, etc.) consistently::

    from okonomiyaki.platforms import EPDPlatform
    # Internal representation is normalized.
    rh5_new_name = EPDPlatform.from_string("rh5-x86_64")
    rh5_old_name = EPDPlatform.from_string("rh5-64")

    assert rh5_old_name == rh5_new_name

As for Version instances, ``EPDPlatform`` instances are designed to be
immutable and to be used as keys in dictionaries.

Egg metadata
------------

To parse Enthought eggs::

    from okonomiyaki.file_formats import EggMetadata

    # Only works for Enthought eggs
    metadata = EggMetadata.from_egg("numpy-1.10.1-1.egg")
    print(metadata.metadata_version)
    print(metadata.name)
    print(metadata.version)

This will take care of a lot of low-level, legacy details you don't want to
know about.

2025-02-13     3.0.0
--------------------

Enhancements:

* Support reading and exporting pkg-info metadata 2.2, 2.3 and 2.4 (#487, #488)

Breaking Changes:

* PackageInfo attribute platforms is renamed to platform (#487)
* PackageInfo attribute supported_platforms is renamed to supported_platform (#487)
* PackageInfo default version is now 2.1 (#487)

Bug fixes:

* Fix the `applies` function to correctly work with long platform
  description strings and the new arm platforms (#482)
* Fix known-platforms detection check for testing (#485)
* Fix arm64 arch detection on apple silicon even when running on x86_64 python (#486)
* PackageInfo.to_string will know respect the metadata_version
  attribute instead of always overriding (#487)
* PackageInfo.to_string will produce a better layout of the metadata fields (#487)

Maintenance:

* Run tests on macos 13 (#484)
* Fix author e-mail (#480)

2024-08-23     2.0.0
--------------------

Enhancements:

* Add support for the ARM and ARM64 architectures in Arch (#458)
* Add support for ARM64 in EPDPlatform 	(#458)
* Add sample runtimes and eggs for the ARM64 architecture (#462, #460)
* Add a constructor for Platform from a dictionary (#410, #472)

Breaking Changes:

* Remove Python 2.x code support. Okonomiyaki now supports running on > 3.6 (#380)
* Remove the "short" attribute from the EPDPlatform instance (#485)
* Remove the LagacyEPDPlatform instance (#485)
* Remove okonomiyaki.recipes submodule (#473)
* Move okonomiyaki.recipes.tests.data files to okonomiyaki.utils.test_data (#473)
* Move dependencies to optional extras (#474)
* default_abi will not fail for Python > 3.11 on windows anymore  (#477)

Bug fixes:

* Fix okonomiyaki cli when it is called with no arguments (#459)
* Drop use of deprecated alias assertRaisesRegexp (#486)
* Skip some tests on unsupported systems (#475)

Maintenance:

* Update Github ci to generate the html coverage report as a downloadable artifact (#457)
* Run tests on MacOS M1 runners (#460)
* Run tests on Python 3.11 (#461)
* Run tests on Python 3.12 (#477)
* Simplify setup.py (#476, #477)

2023-06-29     1.4.0
--------------------

Enhancements:

* Add cp311 dummy runtimes (#349)
* Add cp311 dummy eggs (#453)
* Update the code to guess a Platform instance from the running system (#448)
  - Added a NameKind value for Rocky Linux
  - Debian and RHEL compatible systems are now supported by the "uknown" NameKind
  - Add support for the RH8 platform
* Update the PythonImplementation instance to support cp311 (#451)
* Update okonomiyaki code to not use the deprecated LegacyEPDPlatform instance (#452)

Maintenance:

* Remove old Jenkins CI build setup (#440)
* Update the test matrix on github actions and remove testing for Python 2.7 (#441, #447)
* Move most of the package configuration into the setup.cfg (#450)

Bug fixes:

* Fix the behaviour of the pep245 module and the way it is tested (#441, #447)
* Fix the repr output for PEP440Version and RuntimeVersion (#435, #436)
* Fix error message for unsupported platform combinations (#433)
* Fix permissions in the dummy egg archives (#430)

2021-07-01     1.3.2
--------------------

Bug fixes:

* Fix relative imports (#426)
* Fix compute_abi_tag to support Python 3.8 (#424)

2021-06-29     1.3.1
--------------------

Bug fixes:

* Update dummy eggs to hold the correct abi tag for Python 3.8 (#413)
* Pass the runtime version to the from_epd_string constructor (#414)
* Fix _guess_abi_tag and _guess_abi_from_python to support python 3.8 (#418)

2021-03-21     1.3.0
--------------------

Enhancements:

* Add cp38 dummy runtimes (#387)
* Add cp38 dummy eggs (#395, #398)
* Update default abi functions to support python 3.8 (#390)

Maintenance:

* Enable GitHub actions (#384)
* Fix build badge to point to travis-ci.com (#376)
* Fix path to the okonomiyaki test build project (#379)
* Update script that verifies okonomiyaki can read eds eggs (#396)

Bug fixes:

* Add rh6 and rh7 dummy eggs to setup.py (#369)
* EPDPlatform.pep425_tag will always return 10.6 for macos platforms (#374, #387)
* Fix older dummy windows runtime archives to work with recent EDM (#391, #397)
* EPDPlatform.from_string will always return fixed release versions (#375, #387)


2019-11-08     1.2.0
--------------------

Enhancements:

* Run tests against Centos 7. (#359)

Maintenance:

* Run Travis CI on maintenance and tagged branches. (#352)
* Only test branch builds on Appveyor for master and maintenance branches. (#364)

Bug fixes:

* Add the license to the manifest. (#354)
* Fix platform detection on Centos 7. (#161)
* Fix error when '$' is in the Python runtime prefix. (#309)


2019-09-20     1.1.1
--------------------

Bug fixes:

* Fix name of the 2.7.10 dummy runtime for rh6. (#341)


2019-09-19     1.1.0
--------------------

Enhancements:

* Add dummy test runtimes for python 3.6.5. (#327)
* Add dummy test runtimes for rh7. (#331)
* Add dummy test runtimes for rh6. (#330)
* Add dummy test eggs for rh7. (#329)
* Add dummy test eggs for rh6. (#328)


2019-03-15     1.0.0
--------------------

Enhancements:

* Add ability to parse setuptools eggs and wheels with metadata version 2.1 (#312)

Bug fixes:

* Improve error message when hyphens are used in spec requirement string (#319)
* Fix CI errors with jasonschema and attrs incompatibility (#318)
* Fix Travis CI flake8 errors (#316)


2018-03-12    0.17.4
--------------------

Bug fixes:

* fix test data dummy runtime for python 2.7.9 that contained osx system files. (#304)
* fix test data dummy windows runtimes fix_scripts to support python 2 and python 3. (#303)


2017-12-13    0.17.3
--------------------

Enhancements:

* WheelInfo provides properties for the 'scripts' and 'headers'
  prefix scheme. (#298)


2017-07-20    0.17.2
--------------------

bug fixes:

* skip expected failure test_simple_from_running_python when running
  on osx under python 2.7.x. (#295)


2017-07-19    0.17.1
--------------------

Enhancements:

* streamline travis ci testing. (#286)
* run tests on appveyor and python 3. (#288)

bug fixes:

* fix Runtime.executable value for Python 3 on windows. (#288)
* fix compute_abi_tag/compute_python_tag/compute_platform_tag so that
  they can be used in a frozen app. (#284)


2017-07-03    0.17.0
--------------------

Enhancements:

* compute default ABI for ironpython/jython. (#225)
* add support for CPython 3.6 (#229)
* add support for `PKG-INFO` format 1.2 and 2.0 (#261, #271)
* fix support for attrs >= 17.x
* PackageInfo.from_path may parse PKG-INFO metadata from both wheels and eggs. (#274)
* add WheelInfo class for wheel pep425 tags parsing. (#275)
* add compute_abi_tag/compute_python_tag/compute_platform_tag functions to
  compute PEP 425 tags from arbitrary python executables (#278)
* add some basic examples in the README. (#279)
* add commonly used wheel prefixes to WheelInfo. (#280)

bug fixes:

* fix author_* entries in setup.py. (#235)
* test runtimes should include pythonw.exe (#238)
* fix applies("32")/applies("64") (#244)
* fix permissions for egg metadata written through writestr. (#249)
* fix error handling for platform strings with 'remains'. (#253)
* fix invalid trove classifier in setup.py. (#258)
* mark classes we need hashable as immutable. (#266)
* add (long) description into setup.py. (#272)


2016-06-29    0.16.0
--------------------

This release focused on speeding up EggMetadata, and adding json serialization
for EDM.

Enhancements:

  * update dependency on attr >= 16.0.0, which contains some speedups for
    validators (#220)
  * lazily parse PKG-INFO in EggMedata (#216)
  * test runtimes's dummy pythons output the right string and are of the right
    bitness (#215)
  * test runtimes now contains symlinks on Unix (#214)
  * json serialization for EggMetadata (#213)
  * expose Kind enums to okonomiyaki.runtimes (#204)
  * speedup EggMetadata.from_egg (#203)
  * EPDPlatform.from_epd_string is deprecated in favor of
    EPDPlatform.from_string(#199)
  * EggMetadata.from_egg does not re-open a zipfile 3 times (#195)

Bugs:

  * fix flake8 violations (#218)
  * remove spurious dependency on stevedore (#208)
  * missing enum34 dependency (#196)

2016-04-27   0.15.0:
--------------------

Enhancements:

  * add `platform_abi` field to `EggMetadata`

Bug fixes:

  * raise the correct exception for invalid egg metadata (#156)
  * raise the correct exception for missing metadata in runtimes (#165)

Internal changes:

  * enum34 is used instead of traitlets (#55)
  * traitlets is not used anymore (#56, #115, #145)

2015-12-09   0.14.0:
--------------------

Enhancements:

  * Reject incompatible metadata_version in egg metadata, and add API to easily
    tweak the output's metadata_version (#150)
  * `default_abi` now works for alternative implementations (#149).
  * Exception hierarchy for invalid metadata has been improved for
    finer-grained error messages (#151)

Backward incompatible changes:

  * `default_abi` function now takes 3 arguments (#149).

Bug fixes:

  * update python_tag blacklist to handle wrong metadata (#146)

2015-10-02   0.13.0:
--------------------

Enhancements:

  * `abi` attribute for runtime (#134)
  * `metadata_version` attribute for runtime added (#143)

Backward incompatible changes:

  * `language` attribute from runtime removed (#134)
  * `metadata_version_info` attribute from EggMetadata removed (#143)

Bug fixes:

  * update PKG-INFO blacklist to handle every pypi egg (#141)
  * update platform blacklist to handle wrong metadata for windows eggs w/ C
    extensions and no platform set up (#142)
    (#136).
  * fix round-tripping for PEP386 versions with post part without a dev part
    (#136).

2015-09-28   0.12.0:
--------------------

Improvements:

  * blacklist mechanism for invalid python tag of existing eggs (#127)
  * accept filtre function in egg builders now take two arguments to allow
    filtering on the full content of the archive (#128)

2015-09-14   0.11.0:
--------------------

Improvements:

  * SemanticVersion class added
  * MetadataVersion class added to easily manipulate metadata versions.
  * PEP440Version class added.
  * RuntimeVersion class added to model edm runtime versions
  * IRuntimeMetadata.factory_from_path class function to parse and validate
    runtime packages.
  * __str__ is now implemented for EPDPlatform. The implementation support
    EPDPlatform.from_epd_string(str(epd_platform)) == epd_platform (#117)

2015-00-01   0.10.0:
--------------------

Improvements:

  * EnpkgVersion.from_string now handles versions of the form `1.3.0`, with the
    build number being implicitly 0.
  * EggMetadata.from_egg now handles eggs built for RedHat Enterprise
    Linux 3 (#88).
  * Fix decoding errors when parsing PKG-INFO (#86)
  * Fix parsing of spec/depend for RedHat 3 eggs (#88)
  * Special case invalid requirement 'numpy-1.8.0'

Internals:

  * Remove dependency on six
  * Add support for both '-' and '_' as separators between os and arch in
    platform names for EPDPlatform, i.e. both from_epd_string("rh5-x86_64") and
    from_epd_string("rh5_x86_64") work (#83).
  * Black list mechanism to fix invalid PKG-INFO
  * Black list mechanism to handle platform-specific, any-arch eggs
  * Add special 'private' API for brood to bypass checksum computation in
    EggMetadata and PackageInfo

2015-07-06   0.9.0:
-------------------

Improvements:

  * SetuptoolsEggMetadata now can guess ABI for legacy cases. (#74)
  * use PythonImplementation instances instead of strings to store python tag
    (#75).
  * add okonomiyaki.__version_info__ for easy version comparison (#76).

2015-06-30   0.8.0:
-------------------

New features:

  * New EggRewriter class to create Enthought eggs from setuptools eggs.

Improvements:

  * add EPDPlatform.from_running_python ctor (#62)
  * reject unsupported metadata version in PackageInfo (#63)
  * add support for 'py2' python tag (#64)
  * add support for python 3 in SetuptoolsEggMetadata (#70)

Bug fixes:

  * handle Enthought eggs without PKG-INFO in EggMetadata (#65)
  * fix unicode handling of PKG-INFO and EGG-INFO/spec/summary (#72)