Here's an example directory structure:

one/
one/__init__.py
one/two/
one/two/__init__.py
one/two/foo.pyx
one/two/bar.pxd
one/two/bar.pyx
one/two/baz.pxd

foo *cimport*s bar and baz.
baz defined some *struct*s, and so has to be *cimport*ed by bar.pxd

In order to do this, in *foo.pyx *and *bar.pyx*

> from one.two.baz cimport *

whereas in *bar.pxd*

> from baz cimport *


I believe it should be consistent -- require the full package namespacing in
pxd files.
**

On Mon, Jun 28, 2010 at 3:30 PM, Lisandro Dalcin <[email protected]> wrote:

> On 28 June 2010 18:18, Jared Forsyth <[email protected]> wrote:
> > So, ignore that patch. I realize now that package level importing is
> > required for c modules -- why?? -- anyway, the real inconsistency is that
> > relative importing is required in the pxd files... I would rather all one
> > way or all the other.
> >
>
> Sorry, could you elaborate a bit more about your complains? Could you
> provide a few little examples?
>
>
> > On Mon, Jun 28, 2010 at 8:43 AM, Jared Forsyth <[email protected]>
> > wrote:
> >>
> >> Apparently, if your .pyx is inside a "package" -- nested inside a few
> >> directories -- cython's searching protocol changes -- without telling
> you.
> >> It *won't look in the current directory*, instead opting for the base
> >> package dir.
> >> I've fixed it to first look in the package base, and then in the current
> >> directory.
> >> diff -r 8bff3332e34f Cython/Compiler/Main.py
> >> --- a/Cython/Compiler/Main.py   Tue Feb 02 02:10:32 2010 -0800
> >> +++ b/Cython/Compiler/Main.py   Mon Jun 28 08:42:42 2010 -0600
> >> @@ -337,7 +337,7 @@
> >>              if include:
> >>                  dirs = [os.path.dirname(file_desc.filename)] + dirs
> >>              else:
> >> -                dirs = [self.find_root_package_dir(file_desc.filename)]
> +
> >> dirs
> >> +                dirs = [self.find_root_package_dir(file_desc.filename),
> >> os.path.dirname(file_desc.filename)] + dirs
> >>
> >>          dotted_filename = qualified_name
> >>          if suffix:
> >
> >
> > _______________________________________________
> > Cython-dev mailing list
> > [email protected]
> > http://codespeak.net/mailman/listinfo/cython-dev
> >
> >
>
>
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to