Questions tagged [namespace-package]

In Python, namespace packages have subpackages different locations. It allows different projects to use the same package name.

Namespace packages are Python packages whose subpackages are in different directories.

It allows different projects to use the same package. For example, many components of are developed in different projects with different release cycles. Yet, all of them are expected to be imported from a submodule of a zope package. Without namespace packages, it would be impossible: Python does not allow a package to have its code in multiple locations.

provides namespace packages. PEP 420 proposes a way of adding it into Python 3.3.

More can be found in setuptools documentation.

49 questions
1
vote
1 answer

Packaging and building python namespace packages

What I am trying to do? Have one large package with several installable parts, which need to work together, but specific parts can be used on their own. I decided to use namespace package, as it seems to do what I want. Problem How do I actually…
1
vote
0 answers

Conflicting names in Python namespace plugins

I'm following the plugins packaging guide, using the 'namespace packages' approach. I've written two plugins, with the following structure: plugin_1 ├── pyproject.toml ├── setup.py └── myapp └── plugins └── plugin_1.py plugin_2 ├──…
bavaza
  • 10,319
  • 10
  • 64
  • 103
1
vote
2 answers

Matlab paths and file handling with packages and class folders

So I have the following (simplified) project structure. scripts/ client.m src/ +estimators/ @estimator1/ 3party/ shell_script.sh estimator1.m Basically, what I try to do is,…
Zeitproblem
  • 165
  • 1
  • 12
1
vote
1 answer

Namespaces packages several levels deep, and sphinx

I'm trying to use packages like "project-a" in a namespace like "com.company", with implicit namespaces. I'm finding that sphinx-apidoc isn't putting my packages in to the toc in the docs, I suspect because both the com and company namespaces have…
1
vote
1 answer

PyPI packaging, namespace packages and subpackaging problems

I've uploaded my personnal generic functions called ofunctions to github in order to share them between my projects, and having separate CI and coverage tests. Link to github project here. So far so good, I have a package called ofunctions which has…
Orsiris de Jong
  • 2,819
  • 1
  • 26
  • 48
1
vote
1 answer

Python how to remove path from sys.path_importer_cache (invalid namespace import)

I have a weird phenomenon (Windows, python 3.8.5): I have a folder: c:\myfolder. Somehow this folder got into the sys.path_importer_cache, and now every subfolder in c:\myfolder can be imported as namespace packages. So for example, there is this…
waszil
  • 390
  • 2
  • 5
  • 15
1
vote
1 answer

Can objects be pulled into the top namespace level when using Python's implicit namespace support?

I have a project that I'd like to restructure to use Python's native implicit namespacing. I have code that I'd like to interface with like this: from mypackage import Foo from mypackage.admin import Bar The admin sub-package is in a completely…
Demitri
  • 13,134
  • 4
  • 40
  • 41
1
vote
1 answer

Python namespace packages

I'm following this instructions to create multiple small (independent) Python2 packages from a big one - https://packaging.python.org/guides/packaging-namespace-packages/#pkg-resources-style-namespace-packages Now I have multiple sub(packages) with…
d-d
  • 1,775
  • 3
  • 20
  • 29
1
vote
0 answers

python setup tools creates unwanted implicit namespace package?

I am using setup tools to install a custom package. When I install it, it works fine but if I go to python I am able to import things I didn't intend to make available and I'd like to prevent this. My setup.py looks like this: from setuptools…
Indigo
  • 962
  • 1
  • 8
  • 23
1
vote
1 answer

Error: Namespace packages not yet supported: Skipping package 'pywintypes'

I am trying to use Py2exe to create a executable file for a app that uses webview to load a website, created using pywebview package on pip but I keep on getting this error that says:- running py2exe Error: Namespace packages not yet supported:…
bor
  • 2,211
  • 4
  • 22
  • 37
1
vote
0 answers

Build a namespace package for use via $PYTHONPATH

It's a slightly awkwardly worded question, but basically: I can only activate python packages by adding to $PYTHONPATH I want to be able to use arbitrary python packages this way Some python packages use package namespaces I've got a wrapper…
gfxmonk
  • 8,614
  • 5
  • 42
  • 53
1
vote
1 answer

Python setuptools: __init__.py does not call declare_namespace()

I am trying to install the zope2.zodbbrowser 0.2 package (https://pypi.python.org/pypi/zope2.zodbbrowser/0.2). The setup script fails with the following error: Namespace package problem: zope2 is a namespace package, but its __init__.py does not…
Michael
  • 407
  • 2
  • 6
  • 11
0
votes
0 answers

Package data not included when installing custom Python package on Google Cloud Functions

I have a custom namespace package with additional data files that are included via the package_data argument of setuptools.setup. When I install this custom package for my Google Cloud Function, the data files are not included. I tried installing…
0
votes
1 answer

"Package init file not found (or not a regular file)" - error when building sdist for namespace package

I have a namespace package with folder structure as: CompanyName\DepartmentName\SubDepartmentName\PkgName Python 3.3 onwards supports namespace packages so I have not place the __init__.py files in the following…
0
votes
0 answers

How to pass arguments to __init__.py?

Considering a namespace package in python 3.7, how would I pass an argument to my package when I initialise it? my_package __init__.py I wish to be able to call my_package(arg). Thank you,
Kourosh
  • 608
  • 2
  • 14
  • 34