[Cython] Cythonize silently ignores nonexistent files

2014-12-20 Thread Kevin Norris
Is this behavior intentional?

>>> from Cython.Build import cythonize
>>> cythonize('/this/file/doesnt/exist.pyx')
[]

It would be *really* nice if Cython would raise an exception (or
something) in this case.  I just spent 20 minutes trying to puzzle out
Cython/Setuptools compatibility when the actual problem was staring me
in the face.

--
Kevin Norris
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] can we deprecate for-from loops?

2015-10-11 Thread Kevin Norris
Greg Ewing wrote:
> Stefan Behnel wrote:
> > Hi!
> >
> > The syntax construct "for i from 0 <= i < 10" has been silently outdated
> > for years. Can we start issuing a warning that normal range() loops are
> > preferred?
>
> I'd be in favour of replacing it with just 'for 0 <= i < 10',
> but -1 on removing it altogether.
>
> I introduced it in Pyrex for a reason -- to clearly express
> iterations over ranges of integers with arbitrary combinations
> of open/closed endpoints, for use in conjunction with C code.
> I believe that reason is still valid.
>
> --
> Greg

IMHO, either it should be un-deprecated in the documentation[1], or
the compiler should start issuing warnings and eventually errors.  You
can't have it both ways.  Either it's deprecated or it isn't.

[1]: http://docs.cython.org/src/reference/language_basics.html#for-loops

--
Kevin
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Store list of imported modules in .so file

2015-11-27 Thread Kevin Norris
On Tue, Nov 24, 2015 at 12:50 PM, Hartmut Goebel
 wrote:
> Hi,
>
> I'm a core-developer for PyInstaller. We would like to enhance cython
> support in PyInstaller and resolve dependencies of cython-compiled
> modules automatically. This would ease freezing cython modules with
> PyInstaller a lot and thus help users including cythonized-modules into
> their shipped application.
>
> For us, the most elegant way to get the dependencies would be to have
> the list of imported modules in the .so-file. E.g. some simple string
> marked by some cookie which is easily grepped out of the binary.
>
> Is there any chance to get suche a list into the .so/.dll-file?

Import statements are "just code."  They can appear inside functions
and more generally can occur at runtime.  In the absolute worst case,
you could have something like (Python 3.x):

importlib.import_module(input('What should I import today?'))

This is not specific to Cython, but I imagine it's a lot harder to
pull out via static analysis when you don't have Python-like source
(see also: pkgutil.get_data(), any use of __file__, etc.).  OTOH, if
you're dealing with importlib et al., you're already in a bad place
for static analysis since people can do things like:

import importlib as foo; bar = foo.import_module; baz = bar('qux')

(which is roughly equivalent to import qux as baz, but good luck
spotting it automatically)

Anyway, I think it might help to clarify what *exactly* you mean by
"dependency."  If you mean "any module that might possibly get
imported by module X," you're going to have a hard time with this.
Setuptools takes a fully manual approach to this problem, requiring
developers to explicitly list all dependencies.  That may not work for
your needs, but it does seem to be more flexible since it lets you
specify PEP 440 version constraints.
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel