Skip to main content

libimportx-python

Python implementation of libimportx

Usage

this is a very simple library. there are many functions and classes but you are supposed to use these two: importx and exportx. everything else is used under the hood to make it seamless.

exportx

Call this function AFTER all your functions are defined but BEFORE the logic that you want to run when the function is not importx'ed. This function will allow the file to be importx'ed. If the file isnt being importx'ed the function will return False and execution continues as normal. But if it is, the function blocks and does not return (it exits when the thing importing this exits or throws an error).

importx

Use this function to import a file that calls exportx. It takes in the filepath as an argument. To run the file, it tries these in order:

  1. If there is an optional cmd argument, it uses that, replacing $IN with the path to the file and $OUT with the path to a temporary file.
  2. It checks the LIBIMPORTX_DEFAULT_CMD_<extension> (uppercase) env variable for a command replacing $IN $OUT.
  3. If the first line of the file starts with #! or //!, it uses the rest of the line as the command and appends the filename as an argument (without replacing $IN or $OUT).
  4. If the first line of the file starts with ##! or ///!, it uses the rest of the line as a command and replaces $IN $OUT
  5. It checks the file extension and looks for a default command.

Metadata

Release files for libimportx 1.0.4

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

Source distribution (sdist)

Source distribution for libimportx 1.0.4
File Size Uploaded
libimportx-1.0.4.tar.gz 18.1 kB Details

Built distribution (wheel)

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

Total release size: 36.4 kB

Release files / libimportx-1.0.4.tar.gz

Download URL libimportx-1.0.4.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f3f2d973eb94770289e9de95b5e792f03e683e95754b508ac89a2f37884e89b4
BLAKE2b-256 checksum
How to use checksums
0caaeb13bcd4bcfc532df6cd1cd3ccf10a3e277f075893aacd261a3a4a04ba77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / libimportx-1.0.4-py3-none-any.whl

Download URL libimportx-1.0.4-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
027a2cc9d9a81d7b914cc4b721345ed013c7e11bf3cefc2cc183a83511772405
BLAKE2b-256 checksum
How to use checksums
b3a639b92f2a87decbb1a10ad95d2ed884eba1d438e53e02c69dbf5a4167641c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

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