namespace-package

relative position and content of namespace packages in Python >= 3.3

拜拜、爱过 提交于 2021-02-19 03:48:45
问题 I read the docs and quite some stackoverflow posts, but did not find an explicit answer to my doubts. I think I understand what namespace packages are for. I am only interested in Python>=3.3 and the implicit namespace packages - folders without the __init__.py . Questions Are namespace packages supposed to contain only other packages, or modules (i.e. .py files) are also "allowed"? Are namespace packages supposed to be used only as "container" packages, or can they also be contained in

python namespaces vs packages: making a package the default namespace

╄→尐↘猪︶ㄣ 提交于 2021-02-05 11:26:00
问题 I have a project with an overarching namespace, with packages inside it. Here's the folder structure: pypackage ├── pypackage <-- Source code for use in this project. | | │ ├── bin <-- Module: Cli entry point into pyproject. | | ├── __init__.py | | └── pypackage.py | | | └── core <-- Module: Core functionality. | ├── __init__.py | └── pypackage.py | ├── tests ├── README.md └── setup.py Pretty simple. If I want to import it I use: from pypackage.core import pypackage and it works great because

python namespaces vs packages: making a package the default namespace

爷,独闯天下 提交于 2021-02-05 11:25:23
问题 I have a project with an overarching namespace, with packages inside it. Here's the folder structure: pypackage ├── pypackage <-- Source code for use in this project. | | │ ├── bin <-- Module: Cli entry point into pyproject. | | ├── __init__.py | | └── pypackage.py | | | └── core <-- Module: Core functionality. | ├── __init__.py | └── pypackage.py | ├── tests ├── README.md └── setup.py Pretty simple. If I want to import it I use: from pypackage.core import pypackage and it works great because

pyinstaller with namespace packages

依然范特西╮ 提交于 2021-01-28 03:40:46
问题 I have a module/package structure where I am using namespace packages, I have multiple user made libraries which I keep in separate repositories, and they have fairly generic names like db, io, utils and so on. To avoid conflict with other packages I have a top level/namespace package named acme, i.e. my packages are acme.io, acme.db, acme.utils and so on. To make this work, the __init__.py in all the acme folders has the following lines from pkgutil import extend_path __path__ = extend_path(

Python Namespace Packages in Python3

こ雲淡風輕ζ 提交于 2020-02-26 11:12:57
问题 The topic of namespace packages seems a bit confusing for the uninitiated, and it doesn't help that prior versions of Python have implemented it in a few different ways or that a lot of the Q&A on StackOverflow are dated. I am looking for a solution in Python 3.5 or later . The scenario: I'm in the process of refactoring a bunch of Python code into modules and submodules, and working to get each of these projects set up to operate independently of each other while sitting in the same

Python Namespace Packages in Python3

情到浓时终转凉″ 提交于 2020-02-26 11:12:33
问题 The topic of namespace packages seems a bit confusing for the uninitiated, and it doesn't help that prior versions of Python have implemented it in a few different ways or that a lot of the Q&A on StackOverflow are dated. I am looking for a solution in Python 3.5 or later . The scenario: I'm in the process of refactoring a bunch of Python code into modules and submodules, and working to get each of these projects set up to operate independently of each other while sitting in the same

Namespace packages with a core part?

∥☆過路亽.° 提交于 2019-12-22 04:09:31
问题 This question follows up The way to make namespace packages in Python and How do I create a namespace package in Python?. Note PEP 420, and the distribute docs, which state: You must NOT include any other code and data in a namespace package’s __init__.py . Even though it may appear to work during development, or when projects are installed as .egg files, it will not work when the projects are installed using “system” packaging tools – in such cases the __init__.py files will not be installed

The way to make namespace packages in Python

主宰稳场 提交于 2019-12-20 10:33:55
问题 From Namespace Packages in distribute, I know I can make use of namespace packages to separate a big Python package into several smaller ones. It is really awesome. The document also mentions: Note, by the way, that your project’s source tree must include the namespace packages’ __init__.py files (and the __init__.py of any parent packages), in a normal Python package layout. These __init__ .py files must contain the line: __import__('pkg_resources').declare_namespace(__name__) This code

Py2exe Error: Namespace packages not yet supported : Skipping package 'snowflake'

末鹿安然 提交于 2019-12-11 01:33:23
问题 I have been trying to generate an .exe for the following script using py2exe : import snowflake.connector import os import sys # Setting your account information ACCOUNT = '########' USER = '#######' PASSWORD = '#######' ROLES=[] DATABASE=[] ROLES.append(sys.argv[1]) DATABASE.append(sys.argv[2]) print(ROLES) print(DATABASE) cnx = snowflake.connector.connect( user=USER, password=PASSWORD, account=ACCOUNT, ) cur = cnx.cursor() list_of_grants=[] for rl in ROLES: print("Role: "+rl ) db_res=cur

Packages in same namespace: can't import module in setup script

*爱你&永不变心* 提交于 2019-12-10 11:31:35
问题 I'm curious about the following situation. Let's say I have two projects named project_alpha and project_bravo , both defining a top-level namespace package mymeta . The layout: project_alpha/ -> mymeta/ -> __init__.py -> project_alpha/ -> __init__.py -> version.py -> setup.py project_bravo/ -> mymeta/ -> __init__.py -> project_bravo/ -> __init__.py -> version.py -> setup.py Both mymeta/__init__.py s contain only the line __import__('pkg_resources').declare_namespace(__name__) (according to