classification
Title: Packages containing only extension modules have to contain __init__.py
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Peaker, alexis, eric.araujo, mikehoy, python-dev, tarek
Priority: normal Keywords: easy, patch

Created on 2008-09-18 18:11 by Peaker, last changed 2011-10-21 14:02 by eric.araujo. This issue is now closed.

Files
File name Uploaded Description Edit
distutils-init.py-apiref-setup.diff mikehoy, 2011-10-07 21:23 review
apiref-setupscript-v2.diff mikehoy, 2011-10-09 16:15 Version 2 review
apiref-setupscript-v3.diff mikehoy, 2011-10-10 18:47 v3 with line wrapping at 80th char and response to question in apiref review review
apiref-setupscript-v4.diff mikehoy, 2011-10-12 01:18 review
Messages (13)
msg73393 - (view) Author: Eyal Lotem (Peaker) Date: 2008-09-18 18:11
When using either the ext_package keyword argument to setup, or when
using the "pkg.name" module name notation to Extension instances,
distutils installs the compiled extensions into the appropriate package
directory.

However, distutils does not create an __init__.py file in that
directory, so it is not actually a package and is not importable.
msg119366 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-22 08:35
Thanks for the report.  To the best of my knowledge, distutils never generates Python files, and the docs for ext_modules or ext_package don’t imply __init__.py will be generated.  IOW, for “pkg.foo”, you’re supposed to have pkg/__init__.py and pkg/foo.c.

I think this bug is invalid, or is a request for a small doc improvement.  Do you agree?
msg120586 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-06 06:26
Reclassifying as request for doc enhancement.  I’ll check the distutils2 doc and add a line about this problem if I find the text is not clear enough.

Someone finding this report thanks to the “easy” keyword can feel free to propose a patch.
msg144773 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-02 14:14
We’re working on a patch on the core-mentorship list.
msg145146 - (view) Author: Mike Hoy (mikehoy) * Date: 2011-10-07 21:23
> We’re working on a patch on the core-mentorship list.

Éric, I emailed the diff to the Core-Mentorship list, but since there was no reply I will just attach it here. Please review patch and let me know if you want any changes.
msg145209 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-09 03:44
>> We’re working on a patch on the core-mentorship list.
> I emailed the diff to the Core-Mentorship list, but since there
> was no reply I will just attach it here.
I added that message here to avoid someone else working on the same bug.  I did not reply to the mailing list because it’s not easy to review emailed patches and I don’t have Internet access each day.

> Please review patch and let me know if you want any changes.
Done.  You should have received an email; if not, follow the link titled “review” on the right of your patch.
msg145272 - (view) Author: Mike Hoy (mikehoy) * Date: 2011-10-09 16:15
Submitted v2 of my patch after reading Éric's review of my first.
msg145303 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-10 15:35
You did not reply to my first question on apiref.rst, and you did not rewrap your lines to 80 chars :)
msg145311 - (view) Author: Mike Hoy (mikehoy) * Date: 2011-10-10 18:47
Responded to first question in apiref and uploaded a new patch that wraps lines at 80 characters.
msg145382 - (view) Author: Mike Hoy (mikehoy) * Date: 2011-10-12 01:18
setupscript did not have the changes that were made in apiref. v4 is now consistent and line wrapping at 80 chars.
msg145416 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-12 16:56
Looks good, will commit.
msg146082 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-21 13:52
New changeset f84040b11211 by Éric Araujo in branch 'default':
Document that packaging doesn’t create __init__.py files (#3902).
http://hg.python.org/cpython/rev/f84040b11211
msg146088 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-21 14:02
I thought about the wording again and committed a different version.  I also decided not to backport to distutils; see the commit message for a rationale.  Thanks for the help!
History
Date User Action Args
2011-10-21 14:02:51eric.araujosetstatus: open -> closed
versions: - 3rd party, Python 2.7, Python 3.2
messages: + msg146088

components: - Distutils, Distutils2
resolution: fixed
stage: patch review -> resolved
2011-10-21 13:52:28python-devsetnosy: + python-dev
messages: + msg146082
2011-10-12 16:56:48eric.araujosetmessages: + msg145416
2011-10-12 01:18:13mikehoysetfiles: + apiref-setupscript-v4.diff

messages: + msg145382
2011-10-10 18:47:39mikehoysetfiles: + apiref-setupscript-v3.diff

messages: + msg145311
2011-10-10 15:35:19eric.araujosetmessages: + msg145303
2011-10-09 16:15:53mikehoysetfiles: + apiref-setupscript-v2.diff

messages: + msg145272
2011-10-09 03:44:22eric.araujosetmessages: + msg145209
2011-10-07 21:23:27mikehoysetfiles: + distutils-init.py-apiref-setup.diff

nosy: + mikehoy
messages: + msg145146

keywords: + patch
2011-10-02 14:14:31eric.araujosetversions: + Python 2.7, Python 3.2, Python 3.3
nosy: + alexis

messages: + msg144773

components: + Distutils
stage: needs patch -> patch review
2010-11-06 06:26:33eric.araujosetcomponents: + Documentation, Distutils2, - Distutils
versions: + 3rd party, - Python 3.1, Python 2.7, Python 3.2
keywords: + easy
nosy: tarek, eric.araujo, Peaker
title: distutils does not create __init__.py for packages containing extension modules -> Packages containing only extension modules have to contain __init__.py
messages: + msg120586
stage: needs patch
2010-10-22 08:35:33eric.araujosetmessages: - msg113049
2010-10-22 08:35:27eric.araujosetassignee: tarek -> eric.araujo
messages: + msg119366
nosy: + eric.araujo, - terry.reedy
title: distutils does not correctly create packages for compiled extensions -> distutils does not create __init__.py for packages containing extension modules
2010-08-05 20:44:44terry.reedysetnosy: + terry.reedy
messages: + msg113049
2010-07-11 11:07:05BreamoreBoysetversions: + Python 3.2, - Python 2.6, Python 3.0
2009-02-06 09:17:05tareksetassignee: tarek
nosy: + tarek
versions: + Python 2.6, Python 3.0, Python 3.1, Python 2.7, - Python 2.5
2008-09-18 18:11:45Peakercreate