qualify
A Python package that allows you to import top-level modules which
reside in a directory that is not on sys.path.
Rationale
This is for scenarios where you have a collection of top-level
modules but you want to keep their parent directory off sys.path.
Example:
You have a directory d that contains two top-level modules with
the rather generic names main and utils.
You want to import these modules but also keep their parent
directory d off sys.path to keep the global namespace of
top-level modules from being polluted with these generic names.
However, main refers to utils by its top-level name. So if you
just run import d.main, you’d get an error:
ModuleNotFoundError: No module named 'utils'
Running enable_submodules('d') will allow you to import d.main
successfully.
Running import d.main will add the following modules to
sys.modules:
dd.maind.utils
Note that unlike similar implementations, the python_qualify package
does not touch sys.path. This helps prevent unwanted modules from
being exposed to the global namespace.
Installation
Installing from PyPI
To install qualify from PyPI, open a shell and run:
pip install python-qualify
If that doesn’t work, try:
python3 -m pip install python-qualify
Installing from the AUR
Direct your favorite
AUR helper to the
python-qualify package.
Usage
See USAGE.md
or man python_qualify for details.
Contributing to qualify
See CONTRIBUTING.md.
License
Copyright (c) 2024 Claudia Pellegrino
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. For a copy of the License, see LICENSE.
Configuration
Paste into __init__.py of the affected package:
import python_qualify
python_qualify.enable_submodules(__name__)
Description
A Python package that allows you to import top-level modules which
reside in a directory that is not on sys.path.
This is for scenarios where you have a collection of top-level
modules but you want to keep their parent directory off sys.path.
Example
You have a directory d that contains two top-level modules with
the rather generic names main and utils.
You want to import these modules but also keep their parent
directory d off sys.path to keep the global namespace of
top-level modules from being polluted with these generic names.
However, main refers to utils by its top-level name. So if you
just run import d.main, you’d get an error:
ModuleNotFoundError: No module named 'utils'
Running enable_submodules('d') will allow you to import d.main
successfully.
Notes
Running import d.main will add the following modules to
sys.modules:
dd.maind.utils
Note that unlike similar implementations, the python_qualify package
does not touch sys.path. This helps prevent unwanted modules from
being exposed to the global namespace.
Metadata
Release files for python-qualify 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_qualify-0.1.1.tar.gz | 9.7 kB | Without provenance | Details for python_qualify-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_qualify-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for python_qualify-0.1.1-py3-none-any.whl |
Total release size: 21.0 kB
Release files / python_qualify-0.1.1.tar.gz
| Download URL | python_qualify-0.1.1.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66ed4dfd7eca09388542f37dc4b0274a925eead5e6e2d7f7e3424428ae11ea03
|
|
BLAKE2b-256 checksum How to use checksums |
9ce5ad08a2bf948b648089ec39c1cc36b128fc465a266298bbb525b823497bbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / python_qualify-0.1.1-py3-none-any.whl
| Download URL | python_qualify-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb51b95b956afd2a024fea91c474fb430f113ca911afb19fe088575636b1e20c
|
|
BLAKE2b-256 checksum How to use checksums |
e152a0dbe4e00176304f1ce5a5440db003b4188bf416803a3c8c5460e59f3d22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for python-qualify 0.1.1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.