[Cython] Pure python mode
Robert Bradshaw
robertwb at math.washington.edu
Tue Oct 7 01:21:48 CEST 2008
On Oct 6, 2008, at 3:54 PM, Robert Kern wrote:
> Robert Bradshaw wrote:
>> On Oct 6, 2008, at 11:51 AM, Robert Kern wrote:
>>
>>> Robert Bradshaw wrote:
>>>> On Oct 6, 2008, at 10:38 AM, Dag Sverre Seljebotn wrote:
>>>>
>>>>>> Robert Kern wrote:
>>>>>> Oh, never mind. I see what you're saying. But then why do we need
>>>>>> cython.py if
>>>>>> everything is provided by Cython/__init__.py?
>>>>>>
>>>>> At least for me, Python cannot import it by the name "cython" if
>>>>> only
>>>>> Cython/... is available. And I think we want "import cython" (not
>>>>> "import
>>>>> Cython") to work, as lowercase is more consistent with common
>>>>> Python
>>>>> naming schemes in general and just "feels more right" for such
>>>>> core
>>>>> language functionality.
>>>>>
>>>>> (Also the module name would otherwise need to change in a lot of
>>>>> places --
>>>>> when compiling under Cython, as opposed to running in Python,
>>>>> "cython" is
>>>>> a magic, hard-wired module and "Cython" will not work, at least
>>>>> currently
>>>>> (and my opinion is it never should))
>>>> My thoughts exactly. I think the "cython compiler codebase" and the
>>>> "cython magic module" as completely separate concepts. The only
>>>> reason Cython/__init__.py does anything is to be a workaround for
>>>> case insensitive filesystems.
>>> In that case, I would recommend not using "cython" and pick another
>>> name that
>>> won't cause problems on such systems.
>>
>> But it doesn't cause a problem on such systems. Personally, I can't
>> think of any name that would be more appropriate than "cython."
>
> I guess it will probably not cause many problems. It's just a code
> smell that I
> would avoid. You're repeating code. And making cython.py do double-
> duty as both
> a module in site-packages and a script in /usr/local/bin adds to
> the code smell.
>
> Oh, and don't forget to add cython.py to py_modules=, otherwise I
> don't think it
> will get installed correctly.
For those who want to ship sources without the cython dependancy, I
they would just copy Shadow.py and name in cython.py in their own
directory. Maybe there's a cleaner way to do this without renaming
either "cython" or "Cython." Or should we put it there for testing
purposes?
> While I'm looking at the setup.py script, why are the modules in
> pyximport being
> listed separately in py_modules= instead of being listed as a
> package in packages=?
I'm not sure, other than that I wasn't able to get the "obvious" way
to work right away. I'm not distutils guru though, so if there's a
better way I'd welcome a patch.
- Robert
More information about the Cython-dev
mailing list