Skip to main content

apply

An apply function for Python 2 and 3

Package Contents

apply(object, args=None, kwargs=None)

Call object with args and kwargs; return its results.

Overview

Python 3 has no apply. We like apply. If you like apply as well, have no fear. This version of apply works across all versions of Python.

Examples

apply allows to create read/write properties in a very compact way:

from apply import apply

class X509:

    def __init__(self, store):
        self.store = store

    @apply
    def CN():
        doc = 'The common name attribute'
        def get(self):
            return self.store.get('CN')
        def set(self, value):
            self.store.put('CN', value)
        return property(get, set, None, doc)

record = X509(LDAP())
record.CN = 'Slate Rock and Gravel Company'

Documentation

For further details please refer to the API Documentation.

Changelog

2.0 - 2026-07-06

  • Remove deprecated license classifier. [stefan]

  • Upgrade GitHub workflow. [stefan]

  • Upgrade .readthedocs.yaml. [stefan]

  • Upgrade sphinx and sphinx-rtd-theme in docs extra. [stefan]

  • Require Python >= 3.5. [stefan]

1.7 - 2023-09-14

  • Update tox.ini for latest tox. [stefan]

  • Add GitHub CI workflow. [stefan]

  • Add .readthedocs.yaml file. [stefan]

  • Pin sphinx and sphinx-rtd-theme versions in docs extra. [stefan]

1.6 - 2022-03-09

  • Add Python 3.8-3.10 to tox.ini. Remove old Python versions. [stefan]

  • Replace deprecated python setup.py test in tox.ini. [stefan]

  • Remove deprecated test_suite from setup.py. [stefan]

  • Move metadata to setup.cfg and add a pyproject.toml file. [stefan]

  • Include tests in sdist but not in wheel. [stefan]

1.5 - 2019-01-28

  • Add MANIFEST.in. [stefan]

  • Release as wheel. [stefan]

1.4 - 2017-02-05

  • Support Python 2.6-3.6 without 2to3. [stefan]

  • Add a LICENSE file. [stefan]

1.3 - 2014-04-19

  • Remove setuptools from install_requires because it isn’t. [stefan]

1.2 - 2011-11-26

  • Update README. [stefan]

1.1 - 2011-11-26

  • Fix function signature. [stefan]

1.0 - 2011-11-25

  • Initial release. [stefan]

Metadata

Release files for apply 2.0

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

Source distribution (sdist)

Source distribution for apply 2.0
File Size Uploaded Provenance Actions
apply-2.0.tar.gz 4.5 kB Without provenance Details for apply-2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apply 2.0
File Interpreter ABI Platform Actions
apply-2.0-py3-none-any.whl Python 3 none any Details for apply-2.0-py3-none-any.whl

Total release size: 8.2 kB

Release files / apply-2.0.tar.gz

Download URL apply-2.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3b24f80fece9ff4034c551c8d9278760419e5cac69d712538943ce4c26fdcb74
BLAKE2b-256 checksum
How to use checksums
3dc7057edda54cb10f47c5042e8f7f2207c0e850025058bd353f3217854b5b2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.2

Release files / apply-2.0-py3-none-any.whl

Download URL apply-2.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f284fe7f6964631b88026f71e1d10b9cf2ed96fba9e30e731336df7da1c81b36
BLAKE2b-256 checksum
How to use checksums
41efa196359bff3e5f6022bfea831ec354fe8a46f11fb6c7c78f72cf73e9a67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.2

Security for apply 2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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