Re: [Cython] Cython-0.23.4 build failing on gcc6 for upcoming fedora 24

2016-02-12 Thread Stefan Behnel
Stefan Behnel schrieb am 07.02.2016 um 20:05:
> Robert Bradshaw schrieb am 06.02.2016 um 09:24:
>> ==
>> FAIL: runTest (__main__.EndToEndTest)
>> End-to-end asyncio_generators
>> --
>> Traceback (most recent call last):
>>   File "runtests.py", line 1417, in runTest
>> self.assertEqual(0, res, "non-zero exit status")
>> AssertionError: 0 != 1 : non-zero exit status
>> --
>>
>> Not sure about this one (especially why it would be compiler dependent).
> 
> It's not compiler dependent. It's an incompatibility between Cython and
> CPython's asyncio. Might be related to the fact that asyncio's Future is
> both iterable and awaitable. Or something else... I looked into it but
> couldn't figure it out yet.

Found it:

https://github.com/cython/cython/commit/7eed8d8ff9c872bc993a37438beca0f98e3aba38

Stefan

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


Re: [Cython] import-free setuptools integration

2016-02-12 Thread Nils Werner
I understand. Maybe it is then better to remove the extension-swapping and
ask the developer to specifically decide which extension is a cython_module
and which is an ext_module (and potentially have duplicate definitions of
the same extension):

setuptools.setup(
# ...
ext_modules=[
Extension("pure_c", ["pure_c.c"]),
Extension("mixed", ["mixed.c"]),
],
cython_modules=[
Extension("mixed", ["mixed.pyx"]),
Extension("pure_pyx", ["pure_pyx.pyx"]),
],
)

In this case

 - `pure_c` will never automatically be cythonized
 - `mixed` may be cythonized
 - `pure_pyx` may be cythonized

`pure_c` needs the developer to run `cythonize pure_c.pyx` before `python
setup.py build_sdist`. Shipping a package without the resulting .c file
will fail during installation.

`mixed` may come with both .c and .pyx files

 - If cython is not installed setuptools will simply compile the C code.
 - If cython is installed it is up to `cythonize()` to decide if it wants
to re-compile pyx->c first.

`pure_pyx` is similar to `mixed` but it may run into non-obvious problems
if cython is not installed and not defined as a `setup_requirement`: *It
will silently not be built* and be missing from the final installation. I
guess this won't be much of a problem though as it will most probably be
found out quickly and be fixed with a simple additional line in setup.py.



It might be a bit beyond the scope of what I am suggesting here but I have
also been experimenting with adding another keyword argument and another
command to setuptools:

setuptools.setup(
# ...
cython_manual_modules=[
Extension("pure_c", ["pure_c.pyx"]),
],
)

Combined with

python setup.py build_pyx

we could then automate the cythonization calls during development. This
removes the overhead of remembering each of your pyx files from the
developer and encourages them to *not write cython-related scripting logic*
in their setup.py.

In your case (you cythonize before sdist and dont want users to cythonize
during install) you would define your package as

setuptools.setup(
# ...
ext_modules=[
Extension("mixed", ["mixed.c"]),
],
cython_manual_modules=[
Extension("mixed", ["mixed.pyx"]),
],
)

And would run

python setup.py build_pyx sdist

to create a distribution file.

Again, all these changes are backwards compatible as none of the current
logic needs to be changed (the additional keyword argument and the command
class have been appended to the GitHub PR).

On Sun, Feb 7, 2016 at 9:38 PM, Greg Ewing 
wrote:

> Nils Werner wrote:
>
>>  - Having `cythonize()` internally automatically compile *.pyx files when
>> *.c files
>>are provided is disabled by default and must be enabled using the
>> `replace_extension`
>>keyword argument (`cython_modules` enables that option).
>>
>
> I'd be happier if it were still disabled by default even then.
> If I'm simply installing a package, I do *not* want it to
> try to recompile any .pyx files just because I happen to have
> cython installed.
>
> I know that isn't supposed to happen unless the .pyx is newer
> than the .c, but I wouldn't like to rely on that. There's a
> big difference between using a package and modifying it, and
> I'd rather be explicit about when I'm doing the latter.
>
> --
> Greg
> ___
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel
>
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel