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.4.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pyglotaran_alias-0.0.4.tar.gz.

File metadata

  • Download URL: pyglotaran_alias-0.0.4.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.2 CPython/3.8.6

File hashes

Hashes for pyglotaran_alias-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7d6a62c40f316b6189c22a74a7fb303879b90c36ca2156720a9ff001d0a5d78c
MD5 326c9f35acf4a4ad8c9e78998bf64377
BLAKE2b-256 189fd6728a098229fe3c0f8677316eef6bd5e38d46917532a357bb0601249f63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyglotaran_alias-0.0.4-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.2 CPython/3.8.6

File hashes

Hashes for pyglotaran_alias-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8e782c7850c49fcf56ad39ee60a89574c4ea1df16b0447fa79deea177f457f83
MD5 417b465d5e83f19f2fc99ee7cb950e1c
BLAKE2b-256 f201f1cad51f8c2db29a10cd32984505f2f33742bfd9520ff51931babae301f4

See more details on using hashes here.

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