Skip to main content

Logic Bank Utility Functions

Utility Functions for Logic Bank, and others (no Logic Bank dependencies).

Addressing Python Path, for proper import operation

This is from stackoverflow. Essentially, many of us have discovered the hard way is that:

  • import statements often work in PyCharm

  • but fail in VSCode, Command Line, etc

Setting `PYTHONPATH` is what makes imports work. I use the following VSCODE .env content so that it works for any project:

PYTHONPATH=${PROJ_DIR}:${PYTHONPATH}

This is essentially what PyCharm does when you check Add Content Roots to PYTHONPATH in your run/debug configuration. It’s a helpful setting, but it spoils you because your code fails outside PyCharm.

Or, if you run in terminal, first export:

export PYTHONPATH=…

add_python_path

You may find it easier to address this in your application, by calling the following:

def add_python_path(project_dir: str, my_file: str) -> (str, str):
    """
    @param project_dir: enclosing path node, with optional "*" for starts-with (e.g., LogicBank, LogicBank*)
    @param my_file: callers __file__ variable
    @result (path_was_fixed, path)

For example, if you are several levels deep in a project were the root is `MyProjectRoot`:

import logic_bank_utils.util as logic_bank_utils

(did_fix_path, sys_env_info) = \
    logic_bank_utils.add_python_path(project_dir="MyProjectRoot", my_file=__file__)
print("\n" + did_fix_path + "\n\n" + sys_env_info + "\n\n")

Depends on:

  • Python 3.8

Change Log

0.3.0 - Initial Version

0.4.0 - Improved doc

0.5.0 - More formatting on return string

0.6.0 - Provide for my-project* (startsWith)

Metadata

Release files for logicbankutils 0.6.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 logicbankutils 0.6.0
File Size Uploaded Provenance
logicbankutils-0.6.0.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 8.7 kB

Release files / logicbankutils-0.6.0.tar.gz

Download URL logicbankutils-0.6.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6b3640c1bd82218f96cf2e2fd052bf962510e1bf173cd9be4d8cf042ad3eee33
BLAKE2b-256 checksum
How to use checksums
d5c83190492d41ea0c6a4f36f96e7883fef846b7327e3465bff470d709d8dbb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Release files / logicbankutils-0.6.0-py3-none-any.whl

Download URL logicbankutils-0.6.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16de713b061d27ea4a8b01dda9749ee3c5e2323a1ee1f178931fc38dcbc13bcf
BLAKE2b-256 checksum
How to use checksums
dc05dc32559d19e27758c15e05edb2a24ad0a8de6bb1866f9cfddec952ee11eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Security for logicbankutils 0.6.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.

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