Re: setup.py + cython == chicken and the egg problem
On Tue, Aug 16, 2022 at 2:08 PM Chris Angelico wrote: > On Wed, 17 Aug 2022 at 07:05, Dan Stromberg wrote: > > > > Hi folks. > > > > I'm attempting to package up a python package that uses Cython. > > > > Rather than build binaries for everything under the sun, I've been > focusing > > on including the .pyx file and running cython on it at install time. > This > > requires a C compiler, but I'm OK with that. > > > > Is keeping the cythonized file an option? That would still require a C > compiler, but wouldn't require Cython. > > ChrisA > That comes under "one of the many things I tried"; it seemed like some of the code in the .c was tailored to the specific version of python it was being installed on or something. But if someone has seen this work well, I'm more than open to trying it again. -- https://mail.python.org/mailman/listinfo/python-list
Re: setup.py + cython == chicken and the egg problem
On Wed, 17 Aug 2022 at 07:05, Dan Stromberg wrote: > > Hi folks. > > I'm attempting to package up a python package that uses Cython. > > Rather than build binaries for everything under the sun, I've been focusing > on including the .pyx file and running cython on it at install time. This > requires a C compiler, but I'm OK with that. > Is keeping the cythonized file an option? That would still require a C compiler, but wouldn't require Cython. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
setup.py + cython == chicken and the egg problem
Hi folks. I'm attempting to package up a python package that uses Cython. Rather than build binaries for everything under the sun, I've been focusing on including the .pyx file and running cython on it at install time. This requires a C compiler, but I'm OK with that. However, when I try to install the package from test.pypi.org, I get: $ python3 -m pip install -i https://test.pypi.org/simple/ pyx-treap below cmd output started 2022 Tue Aug 16 01:55:16 PM PDT Looking in indexes: https://test.pypi.org/simple/ Collecting pyx-treap Downloading https://test-files.pythonhosted.org/packages/3a/41/af5360934adccfc086a39e1f720323895144b53454ff6dacc0f06267db55/pyx_treap-2.0.15.tar.gz (125 kB) 125.9/125.9 kB 1.9 MB/s eta 0:00:00 Installing build dependencies ... error error: subprocess-exited-with-error ×? pip subprocess to install build dependencies did not run successfully. ?? exit code: 1 > [3 lines of output] Looking in indexes: https://test.pypi.org/simple/ ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none) ERROR: No matching distribution found for setuptools [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error ×? pip subprocess to install build dependencies did not run successfully. ?? exit code: 1 > See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. But I analyzed the pip install with strace, and found no interesting exec's, and no interesting "= E" patterns. I've tried quite an assortment of things to get past this, including most of those at: https://stackoverflow.com/questions/4996589/in-setup-py-or-pip-requirements-file-how-to-control-order-of-installing-package Except the one at: https://stackoverflow.com/a/54269307/1084684 ...because I was having a "there must be a better way" reaction to it. /Is/ there a better way? There're all these newer ways of doing packaging - surely one of them addresses this problem? The code I'm trying to package is at: https://stromberg.dnsalias.org/svn/treap/trunk/cython BTW, the pure python version works fine, and the cython version works too as long as you preinstall cython - but I don't want users to have to know that :) Thanks! -- https://mail.python.org/mailman/listinfo/python-list
Re: Exclude 'None' from list comprehension of dicts
Op 16/08/2022 om 00:20 schreef dn: On 16/08/2022 00.56, Antoon Pardon wrote: Op 5/08/2022 om 07:50 schreef Loris Bennett: Antoon Pardon writes: Op 4/08/2022 om 13:51 schreef Loris Bennett: Hi, I am constructing a list of dictionaries via the following list comprehension: data = [get_job_efficiency_dict(job_id) for job_id in job_ids] However, get_job_efficiency_dict(job_id) uses 'subprocess.Popen' to run an external program and this can fail. In this case, the dict should just be omitted from 'data'. I can have 'get_job_efficiency_dict' return 'None' and then run filtered_data = list(filter(None, data)) but is there a more elegant way? Just wondering, why don't you return an empty dictionary in case of a failure? In that case your list will be all dictionaries and empty ones will be processed fast enough. When the list of dictionaries is processed, I would have to check each element to see if it is empty. That strikes me as being less efficient than filtering out the empty dictionaries in one go, although obviously one would need to benchmark that. I may be missing something but why would you have to check each element to see if it is empty? What would go wrong if you just treated empty dictionaries the same as non-empty directories? 'Truthiness':- In what way is that relevant in this case? -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem using cx_Freeze
On Mon, 15 Aug 2022 18:00:48 -0600, David at Booomer declaimed the following: >However I now get an error > >init() takes from 2 to 12 positional arguments but 14 were given > >I found a couple instances of init in two .py files that were part of the >whole. > >One .py file >def __init__(self): > Please cut&paste the TEXT of the console where the errors are displayed -- don't paraphrase! init() is NOT the same as __init__() WHAT "One .py file"? This is a meaningless bit of information. The most likely __init__() involved is the one where cx_Freeze.Executable is instantiated. https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable shows 11 parameters (and "self" would make the 12th). -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list