Skip to main content

Python code extractor

Test package Release package PyPI - License codecov Code style: black PyPI version PyPI - Python Version Downloads

Python code extractor

Dependencies

Written in pure Python and has no dependencies other than the base libraries.

Installation

From source code:

pip install .

From PyPI:

pip install code-extractor

Import

Main functions

import code_extractor
from code_extractor import extract_code, load_code

Pickle API

import code_extractor.pickle

or as a drop-in for pickle:

import code_extractor.pickle as pickle

Usage

Given the following:

class Class:
    def __init__(self):
        self.test = 42

def function():
    return 42

Use

>>> import code_extractor
>>> extracted_class = code_extractor.extract_code(Class)
>>> extracted_function = code_extractor.extract_code(function)
>>> reconstructed_class = code_extractor.load_code(extracted_class)
>>> instance = reconstructed_class()
>>> instance.test
42
>>> reconstructed_function = code_extractor.load_code(extracted_function)
>>> reconstructed_function()
42

Pickle module

>>> import code_extractor
>>> code_extractor.dump(...)
>>> code_extractor.dumps(...)
>>> code_extractor.load(...)
>>> code_extractor.loads(...)

Or

>>> import code_extractor.pickle as pickle
>>> pickle.dump(...)
>>> pickle.dumps(...)
>>> pickle.load(...)
>>> pickle.loads(...)

Metadata

Release files for code-extractor 0.4.1

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

Source distribution (sdist)

Source distribution for code-extractor 0.4.1
File Size Uploaded Provenance Actions
code-extractor-0.4.1.tar.gz 21.9 kB Without provenance Details for code-extractor-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for code-extractor 0.4.1
File Interpreter ABI Platform Actions
code_extractor-0.4.1-py3-none-any.whl Python 3 none any Details for code_extractor-0.4.1-py3-none-any.whl

Total release size: 49.1 kB

Release files / code-extractor-0.4.1.tar.gz

Download URL code-extractor-0.4.1.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7da792556b9b7c81b67bd4f97fd565a57e5f899467ec5074cc6428d6a62e062d
BLAKE2b-256 checksum
How to use checksums
a5afefee2038b5381f55ea48091b71453d9b081872ddebd9755cc58aac95e5c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / code_extractor-0.4.1-py3-none-any.whl

Download URL code_extractor-0.4.1-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9aac834b86a04fc0625ae0cdb2f499844bbdfbddff53372f11a0d17fea338f3f
BLAKE2b-256 checksum
How to use checksums
24bbc309f0e5c38bc31a94ba73a8237ef622343fa857d9c58da4bdd6da81f352
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Security for code-extractor 0.4.1

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