Skip to main content

Convenience module, which allows to use pyglotaran as alias in the CLI and imports

Project description

pyglotaran-alias

PyPi Version Conda Version Supported Python Versions

Convenience module which allows to use pyglotaran as an alias in the CLI and imports, when working with pyglotaran.

Since the python implementation of glotaran was renamed to pyglotaran to prevent ambiguity, about which glotaran was used, at times one might be tempted to use import pyglotaran instead of import glotaran.

Usage

import pyglotaran

Or

from pyglotaran import ParameterGroup

For autocompletion to work in an interactive session (i.e. python repl, jupyter-console or jupyter-notebooks) you need to first import the pyglotaran-alias i.e. with import pyglotaran. After this is done glotaran is registered under the alias pyglotaran, and autocomplete should work.

How does it work?

When you use import pyglotaran the following happens:

  • pyglotaran-alias's __init__.py is called.
  • The module cache (sys.modules) is populated with all glotaran modules.
  • For each glotaran module an additional corresponding entry with pyglotaran is added to the module cache.
  • The local variables used to modify the module cache are deleted, so they won't pollute your globals.
  • The pyglotaran global variable replaces itself with the glotaran package.

Known problems

Linter shows error "No name '<module or attribute name>' in module 'pyglotaran'", when using a text editor

Since most linters use a static file analysis, they won't understand the live swapping of modules at runtime and think that pyglotaran is defined inpyglotaran-alias, where <module or attribute name> most likely doesn't exist. Thus you have a Schrödinger-Linter, which is right and wrong at the same time.

Autocomplete doesn't work, when using a text editor

This is due to the fact that autocomplete engines (similar to linters) use a static file analysis and thus think that pyglotaran is defined in pyglotaran-alias. Sadly I didn't find a way to fix this issue yet, since it also strongly depends on the used autocomplete engine.

Autocomplete in interactive session shows attributes on pyglotaran which aren't part of glotaran

When using an interactive session (i.e. python repl, jupyter-console or jupyter-notebooks), the autocomplete will pick up the replaced module and allow you to get autocompletion for modules and attributes defined in glotaran. But due to static file analysis it will also pick up modules and attributes defined in pyglotaran-alias

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

pyglotaran-alias-0.0.2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

pyglotaran_alias-0.0.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pyglotaran-alias-0.0.2.tar.gz.

File metadata

  • Download URL: pyglotaran-alias-0.0.2.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for pyglotaran-alias-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4a7684b64ffe35445c8d4e9507de9752f3b2c2b9c73623f32be921e82dbd013f
MD5 905a01b8b759df7b2e74e53acfb20778
BLAKE2b-256 b4df154413b7a5d961e5c247c65541870410226133a5325eb972225d8520c8f9

See more details on using hashes here.

Provenance

File details

Details for the file pyglotaran_alias-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyglotaran_alias-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.6

File hashes

Hashes for pyglotaran_alias-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e50de1974ef8505b604f5209466ce7801d354067d47dde819009cab2a70d8d8b
MD5 c0af2eaabed3a058372a0861a61f4a32
BLAKE2b-256 9cf51929dfa84b799ce631353c7280dc5baacf1641432106df187a38c6c1595e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page