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
3
votes
0 answers

Installing python 3.6 namespace package in site-packages directory structure

Problem: I cannot get a source distribution namespace package to install in a 3.6.4 virtual environment in the directory structure expected (under Lib/site-packages). Background: I'm working with namespace packages in 2 different versions of…
Matt_G
  • 506
  • 4
  • 14
3
votes
2 answers

List all sub-packages of a namespace package

Python has the ability to create a namespace packages. How do you get a list of installed packages under a namespace? i.e. something like: import namespace_package dir(namespace_pageage)
MinchinWeb
  • 631
  • 1
  • 9
  • 18
3
votes
0 answers

pip uninstall namespace subpackage

How can I uninstall with pip one of the distributions which provide subpackages of a namespace package without breaking programs which only use subpackages of this namespace package from the remaining distributions? I have 2 distributions…
someone
  • 91
  • 2
3
votes
0 answers

Importing directly from a namespace package in setuptools

How to use a module as both a namespace package and as a container for classes in a specific subproject? That is, how can I import something directly from a namespace package instead of its subpackages? An example can make the question…
brandizzi
  • 26,083
  • 8
  • 103
  • 158
2
votes
1 answer

How to load implicit namespace package by adding the package egg to sys.path?

Since python 3.3, implicit namespace packages are supported, so that I can have two packages: a ├── b ├── __init__.py a ├── c ├── __init__.py and import a.b and a.c without problems. But it seems that I can only do it with pip install; if…
2
votes
1 answer

Is it possible to create docs for multiple packages within the same git repository with sphinx-apidoc?

I have a git repository which includes multiple packages which follow a namespace (i.e PEP 420. I am trying to create a ReadTheDocs documentation using Sphinx. The git repository looks like this repo:…
2
votes
2 answers

Python's Namespace Packages are not Visible in Local Development Project

I'm trying to split a big (almost monolithic) Python project into multiple pieces by utilizing Pythons namespace packages. Therefore I extracted a parser for *.rules files into a namespace package. Python calls this a distribution. I followed that…
Paebbels
  • 15,573
  • 13
  • 70
  • 139
2
votes
2 answers

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

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 ->…
hoefling
  • 59,418
  • 12
  • 147
  • 194
2
votes
2 answers

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

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 =…
2
votes
1 answer

Should I create new python packages by default as namespace packages?

Python 3.3 has implicit namespace packages (PEP420) and in Python 2.7 packages can be marked as namespace packages through adding two lines into __init__py. See How do I create a namespace package in python. Given the features the packages enable,…
JE42
  • 4,881
  • 6
  • 41
  • 51
2
votes
1 answer

Import local testing version of a Python namespace package

I am wondering how I can import a local testing version of a Python 2.7 namespace package. In this example the package Ska.engarchive is a namespace package under the Ska root. (This structure is forced on me by legacy). This example shows that…
Tom Aldcroft
  • 2,339
  • 1
  • 14
  • 16
2
votes
1 answer

Strange file being created automatically after installing a Python library

I have a Python library that depends on a C library, so I'm using Cython to deal with it. While I've managed to wrap the library and it's ready for installation, I've been facing a strange problem (note: for the sake of non-advertising I'm not using…
Himanshu Mishra
  • 8,510
  • 12
  • 37
  • 74
2
votes
2 answers

pyinstaller with namespace packages

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…
thorsan
  • 1,034
  • 8
  • 19
2
votes
1 answer

Import problems with Python namespace packages

I am trying to use Python namespace packages concept to split my library across multiple directories. In general, it works, but I have a problem regarding importing names to projects package level. My project structure is…
Timo
  • 5,188
  • 6
  • 35
  • 38
2
votes
3 answers

Cannot install two packages that use the same namespace

UPDATE: When installing both packages using setup.py alone they install just fine. When extracting the tarballs generated by sdist and installing them the same error occurs. This means that the problem is somewhere inside setuptools I guess. I…
the_drow
  • 18,571
  • 25
  • 126
  • 193