logicbankutils


Namelogicbankutils JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/valhuber/logicbankutils
SummaryUtility functions for LogicBase
upload_time2020-12-11 04:26:32
maintainer
docs_urlNone
authorVal Huber
requires_python~=3.8
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
****************************
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 <https://stackoverflow.com/questions/40304117/import-statement-works-on-pycharm-but-not-from-terminal/63487350?noredirect=1#comment113296551_63487350>`_.  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:

.. code-block:: Python

    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```:

.. code-block:: Python

    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)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/valhuber/logicbankutils",
    "name": "logicbankutils",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Val Huber",
    "author_email": "valjhuber@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d5/c8/3190492d41ea0c6a4f36f96e7883fef846b7327e3465bff470d709d8dbb5/logicbankutils-0.6.0.tar.gz",
    "platform": "any",
    "description": "\n****************************\nLogic Bank Utility Functions\n****************************\n\nUtility Functions for Logic Bank, and others (no Logic Bank dependencies).\n\nAddressing Python Path, for proper import operation\n===================================================\n\nThis is from `stackoverflow <https://stackoverflow.com/questions/40304117/import-statement-works-on-pycharm-but-not-from-terminal/63487350?noredirect=1#comment113296551_63487350>`_.  Essentially, many of us have discovered the hard way is that:\n\n* import statements often work in PyCharm\n\n* but fail in VSCode, Command Line, etc\n\nSetting ```PYTHONPATH``` is what makes imports work. I use the following VSCODE `.env` content so that it works for any project:\n\n\n    PYTHONPATH=${PROJ_DIR}:${PYTHONPATH}\n\n\nThis 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.\n\nOr, if you run in terminal, first export:\n\n    export PYTHONPATH=...\n\n\n\nadd_python_path\n###############\n\nYou may find it easier to address this in your application, by calling the following:\n\n.. code-block:: Python\n\n    def add_python_path(project_dir: str, my_file: str) -> (str, str):\n        \"\"\"\n        @param project_dir: enclosing path node, with optional \"*\" for starts-with (e.g., LogicBank, LogicBank*)\n        @param my_file: callers __file__ variable\n        @result (path_was_fixed, path)\n\nFor example, if you are several levels deep in a project were the root is ```MyProjectRoot```:\n\n.. code-block:: Python\n\n    import logic_bank_utils.util as logic_bank_utils\n\n    (did_fix_path, sys_env_info) = \\\n        logic_bank_utils.add_python_path(project_dir=\"MyProjectRoot\", my_file=__file__)\n    print(\"\\n\" + did_fix_path + \"\\n\\n\" + sys_env_info + \"\\n\\n\")\n\n\nDepends on:\n-----------\n- Python 3.8\n\n\n\nChange Log\n----------\n\n0.3.0 - Initial Version\n\n0.4.0 - Improved doc\n\n0.5.0 - More formatting on return string\n\n0.6.0 - Provide for my-project* (startsWith)\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Utility functions for LogicBase",
    "version": "0.6.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "d87e2a0e9ae7ff2ce8263b4e85ebd70f",
                "sha256": "16de713b061d27ea4a8b01dda9749ee3c5e2323a1ee1f178931fc38dcbc13bcf"
            },
            "downloads": -1,
            "filename": "logicbankutils-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d87e2a0e9ae7ff2ce8263b4e85ebd70f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 4824,
            "upload_time": "2020-12-11T04:26:31",
            "upload_time_iso_8601": "2020-12-11T04:26:31.519091Z",
            "url": "https://files.pythonhosted.org/packages/dc/05/dc32559d19e27758c15e05edb2a24ad0a8de6bb1866f9cfddec952ee11eb/logicbankutils-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "4ec6f13b1903e389a1efcdd95998d209",
                "sha256": "6b3640c1bd82218f96cf2e2fd052bf962510e1bf173cd9be4d8cf042ad3eee33"
            },
            "downloads": -1,
            "filename": "logicbankutils-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4ec6f13b1903e389a1efcdd95998d209",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 3871,
            "upload_time": "2020-12-11T04:26:32",
            "upload_time_iso_8601": "2020-12-11T04:26:32.697981Z",
            "url": "https://files.pythonhosted.org/packages/d5/c8/3190492d41ea0c6a4f36f96e7883fef846b7327e3465bff470d709d8dbb5/logicbankutils-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-12-11 04:26:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "valhuber",
    "github_project": "logicbankutils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "logicbankutils"
}
        
Elapsed time: 0.06114s