Okonomiyaki
Okonomiyaki is a self-contained Python library designed to handle metadata specifically for Enthought-specific egg and runtime archives. It provides tools for creating, reading, and manipulating package information, platforms, and versions. The current version is 3.0.0, with major versions introducing significant breaking changes and an irregular release cadence.
Common errors
-
AttributeError: 'PackageInfo' object has no attribute 'platforms'
cause In version 3.0.0, the `platforms` attribute on `PackageInfo` was renamed to `platform`.fixChange `package_info.platforms` to `package_info.platform`. -
AttributeError: 'EPDPlatform' object has no attribute 'short'
cause The `short` attribute was removed from `EPDPlatform` in version 2.0.0.fixRemove any usage of the `short` attribute from `EPDPlatform` instances. -
ImportError: cannot import name 'LegacyEPDPlatform' from 'okonomiyaki.platforms'
cause The `LegacyEPDPlatform` class was removed in version 2.0.0.fixReplace `LegacyEPDPlatform` with `EPDPlatform` and adjust your code to the modern `EPDPlatform` API. -
SyntaxError: invalid syntax (if you try to run on Python 2.x)
cause Okonomiyaki versions 2.0.0 and above dropped Python 2.x support and use Python 3-specific syntax (e.g., f-strings).fixUpgrade your Python interpreter to version 3.6 or higher.
Warnings
- breaking The `PackageInfo` attribute `platforms` was renamed to `platform`. Accessing the old attribute will result in an `AttributeError`.
- breaking The `PackageInfo` attribute `supported_platforms` was renamed to `supported_platform`. Accessing the old attribute will result in an `AttributeError`.
- breaking The default `package_info_version` for `PackageInfo` objects is now 2.1. Code that expects older default versions (e.g., 2.0) might behave differently, especially when serializing/deserializing.
- breaking Python 2.x support was completely removed. Okonomiyaki now requires Python 3.6 or newer.
- breaking The `EPDPlatform` class had its 'short' attribute removed, and `LegacyEPDPlatform` was entirely removed.
Install
-
pip install okonomiyaki
Imports
- PackageInfo
from okonomiyaki.package_info import PackageInfo
- EPDPlatform
from okonomiyaki.platforms import EPDPlatform
- PythonVersion
from okonomiyaki.versions import PythonVersion
- PEP440Version
from okonomiyaki.versions import PEP440Version
Quickstart
from okonomiyaki.package_info import PackageInfo, PackageInfoVersion
from okonomiyaki.platforms import EPDPlatform
from okonomiyaki.versions import PythonVersion, PEP440Version
# Create a PackageInfo object
package_info = PackageInfo(
name="scipy",
version=PEP440Version("1.7.3"),
build=2,
os_name="win",
arch="x86_64",
python_version=PythonVersion(3, 9, 7),
platform_version="", # For Windows, platform_version is often empty
package_info_version=PackageInfoVersion.from_string("2.1") # Default for v3.0.0
)
print(f"Package Name: {package_info.name}")
print(f"Package Version: {package_info.version}")
print(f"Platform: {package_info.platform.full_string}")
print(f"Python Version: {package_info.python_version.api_string}")
# Note: In Okonomiyaki 3.0.0, 'platforms' attribute was renamed to 'platform'
# And 'supported_platforms' was renamed to 'supported_platform'
# If this was an older version (pre-3.0.0), you might use package_info.platforms