Skip to main content

This package provides a native XPLINK wrapper for z/OS that exposes the inotify_* symbols required by asyncinotify

Project description

asyncinotify wrapper for z/OS

Project Status: Active – The project has reached a stable, usable state and is being actively developed. builds.sr.ht status z/OS

Due to z/OS-specific DLL constraints, asyncinotify needs this tiny wrapper written in C.

Install

A C compiler is required to install this package from source. See this page for supported compilers and required environment variables to use them.

# Install from PyPI
pip3 install asyncinotify_zos
# Install from source
pip3 install asyncinotify_zos_<version>.tar.gz

Why is it needed?

Python can load C functions from files in the Unix filesystem hierarchy. Unfortunately, on z/OS most functions are not located in Unix files but in MVS data sets. As of April 2026, Python on z/OS is not able to load functions directly from MVS data sets.

There is an idea (PY-I-14) already opened for IBM to implement an alternative loader so that Python can load functions from MVS data sets. Once this functionality is implemented, this wrapper will no longer be necessary. Note that this will also require modifications to the asyncinotify upstream package.

Quickstart

Using asyncinotify is very simple:

from pathlib import Path
from asyncinotify import Inotify, Mask
import asyncio

async def main():
    # Context manager to close the inotify handle after use
    with Inotify() as inotify:
        # Adding the watch can also be done outside of the context manager.
        # __enter__ doesn't actually do anything except return self.
        # This returns an asyncinotify.inotify.Watch instance
        inotify.add_watch('/tmp', Mask.ACCESS | Mask.MODIFY | Mask.OPEN | Mask.CREATE | Mask.DELETE | Mask.ATTRIB | Mask.CLOSE | Mask.MOVE | Mask.ONLYDIR)
        # Iterate events forever, yielding them one at a time
        async for event in inotify:
            # Events have a helpful __repr__.  They also have a reference to
            # their Watch instance.
            print(event)

            # the contained path may or may not be valid UTF-8.  See the note
            # below
            print(repr(event.path))

asyncio.run(main())

This will asynchronously watch the /tmp directory and report events it encounters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncinotify_zos-0.2.5.tar.gz (15.4 kB view details)

Uploaded Source

File details

Details for the file asyncinotify_zos-0.2.5.tar.gz.

File metadata

  • Download URL: asyncinotify_zos-0.2.5.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.13 Linux/6.12.81-0-lts

File hashes

Hashes for asyncinotify_zos-0.2.5.tar.gz
Algorithm Hash digest
SHA256 325116c203c7a4a2ef9221784ae23e8024974e43ff5bec2ee31561f38bde20e7
MD5 e90607653121ec95afca2a0996545eb2
BLAKE2b-256 4d58f0aab4df698cc7e0ffb86932e38bbe165dbed01edce7f971372a0c99d285

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page