Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Project is Archived

Consider using https://github.com/jontyms/neo-passes-rs

Neo-Airpress

AirPress lets you create, sign and zip PKPass archives for Apple Wallet in runtime memory without a need for temporary files or directories.

Installation

From PyPI:

pip install neo-airpress

Quickstart

from neo_airpress import PKPass

# PKPass compressor operates on `bytes` objects as input/output
p = PKPass(
    ('icon.png', bytes(...)),
    ('logo.png', bytes(...)),
    ('pass.json', bytes(...)),
    ...
)
p.sign(cert=bytes(...), key=bytes(...), password=bytes(...))  # `password` argument is optional
_ = bytes(p)  # Creates `bytes` object containing signed and compressed `.pkpass` archive

In most cases you're likely to return pkpass as http response and bytes object is exactly what you need. PKPass will raise human-readable errors in case something is wrong with pass package you're trying to sign and compress.

Manage assets in pass package

Accessing PKPass assets that are already added to pass package is as easy as working with dictionary.

Retrieve asset:

icon = p['icon.png']

It can also be used as alternative to add/update asset:

p['icon.png'] = bytes(...)

Remove asset from pass package:

del p['logo.png']

Prepare Pass Type ID certificate

If you don't have your pass type certificate, follow this guide to create one.

Export your developer certificate as .p12 file and convert it into a pair of cert and key .pem files:

openssl pkcs12 -in "Certificates.p12" -clcerts -nokeys -out certificate.pem

openssl pkcs12 -in "Certificates.p12" -nocerts -out key.pem

You will be asked for an export password (or export phrase), you may leave it blank or provide a passphrase. It's this value that you later should supply to PKPass compressor (or leave blank).

Example with local files

In case you'd like to play around with locally stored files, or your server keeps assets in the same file storage as source code, this example shows you how to read locally stored assets as bytes objects, compress pkpass archive and save it to script's parent directory.

import os
from neo_airpress import PKPass


# Create empty pass package
p = PKPass()

# Add locally stored assets
for filename in os.listdir('your_dir_with_assets'):
    with open(os.path.join(os.path.dirname(__file__), 'your_dir_with_assets', filename), 'rb') as file:
        data = file.read()
        # Add each individual asset to pass package
        p.add_to_pass_package((filename, data))

# Add locally stored credentials
with open(
        os.path.join(os.path.dirname(__file__), 'your_dir_with_credentials/key.pem'), 'rb'
) as key, open(
    os.path.join(os.path.dirname(__file__), 'your_dir_with_credentials/certificate.pem'), 'rb'
) as cert:
    # Add credentials to pass package
    p.key = key.read()
    p.cert = cert.read()
    p.password = bytes('passpass', 'utf8')

# As we've added credentials to pass package earlier we don't need to supply them to `.sign()`
# This is an alternative to calling .sign() method with credentials as arguments.
p.sign()

# Create pkpass file with pass data
with open('your_dir_for_output/data.pkpass', 'wb') as file:
    file.write(bytes(p))

Hope you find this package useful! I'd love to hear your feedback and suggestions for this tiny library as there's always room for improvement.

Metadata

Release files for neo-airpress 2.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neo-airpress 2.0.5
File Size Uploaded Provenance Actions
neo_airpress-2.0.5.tar.gz 16.7 kB With provenance Details for neo_airpress-2.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neo-airpress 2.0.5
File Interpreter ABI Platform Actions
neo_airpress-2.0.5-py3-none-any.whl Python 3 none any Details for neo_airpress-2.0.5-py3-none-any.whl

Total release size: 27.1 kB

Release files / neo_airpress-2.0.5.tar.gz

Download URL neo_airpress-2.0.5.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a1723f35927488019633c8ca63b04c1e06967e1fb5ee9c4d9b5e317797a6e65a
BLAKE2b-256 checksum
How to use checksums
8e24404429137a893290322cc95dafe9f0f1dedf3bd38acdd80c56d1a6978338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 8, 2025.

Transparency log

Release files / neo_airpress-2.0.5-py3-none-any.whl

Download URL neo_airpress-2.0.5-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef52237d96ddd0d92e1278fb454a4a0d007dcb4910ab222c6ae467900eb76dbf
BLAKE2b-256 checksum
How to use checksums
efc7746e80de9042f99d6bf5ca8f35cd5a10709ea89536f9d4a29dececfa414d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 8, 2025.

Transparency log

Security for neo-airpress 2.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for neo_airpress-2.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 8, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page