Skip to main content

Import from other languages

Project description

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.

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

libimportx-1.0.3.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libimportx-1.0.3-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file libimportx-1.0.3.tar.gz.

File metadata

  • Download URL: libimportx-1.0.3.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for libimportx-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f80acec27e40ce8cc88b8db80979c1b6f2aeee0f6884b77f5da5c4002359ee04
MD5 b18c26eca0d8af62f729011251a31585
BLAKE2b-256 40fd2a7bdfe2fcf4b16a3d49e89c40e6b0d446f53d97ffc5adbf31f2296c35d0

See more details on using hashes here.

File details

Details for the file libimportx-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: libimportx-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for libimportx-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54395d12d70120cc5c142a4b235e27bf86faa5fc0fbd36bfdf280a1717051bfc
MD5 fa378b902835507f0aa0751241212c56
BLAKE2b-256 efae2fca2cb4a92308d32b478cbc17f0dc5e8250d3f232f66b494a3e32f3a03c

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