frozenlist icon indicating copy to clipboard operation
frozenlist copied to clipboard

1.4.1: pep517 build is not producing DSO module

Open kloczek opened this issue 1 year ago • 3 comments

Long story short

Looks like pep517 build is not producing DSO modle. I'm not sure but it may be result of use cython 3.0.11.

Expected behaviour

pep571 build should build DSO module.

Actual behaviour

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
running egg_info
creating frozenlist.egg-info
writing frozenlist.egg-info/PKG-INFO
writing dependency_links to frozenlist.egg-info/dependency_links.txt
writing top-level names to frozenlist.egg-info/top_level.txt
writing manifest file 'frozenlist.egg-info/SOURCES.txt'
reading manifest file 'frozenlist.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.lib' found anywhere in distribution
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.a' found anywhere in distribution
warning: no previously-included files matching '*.obj' found anywhere in distribution
warning: no previously-included files found matching 'frozenlist/*.c'
warning: no previously-included files found matching 'frozenlist/*.html'
no previously-included directories found matching 'docs/_build'
adding license file 'LICENSE'
writing manifest file 'frozenlist.egg-info/SOURCES.txt'
* Building wheel...
running bdist_wheel
running build
running build_py
creating build/lib/frozenlist
copying frozenlist/__init__.py -> build/lib/frozenlist
running egg_info
writing frozenlist.egg-info/PKG-INFO
writing dependency_links to frozenlist.egg-info/dependency_links.txt
writing top-level names to frozenlist.egg-info/top_level.txt
reading manifest file 'frozenlist.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.lib' found anywhere in distribution
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.a' found anywhere in distribution
warning: no previously-included files matching '*.obj' found anywhere in distribution
warning: no previously-included files found matching 'frozenlist/*.c'
warning: no previously-included files found matching 'frozenlist/*.html'
no previously-included directories found matching 'docs/_build'
adding license file 'LICENSE'
writing manifest file 'frozenlist.egg-info/SOURCES.txt'
copying frozenlist/__init__.pyi -> build/lib/frozenlist
copying frozenlist/_frozenlist.pyx -> build/lib/frozenlist
copying frozenlist/py.typed -> build/lib/frozenlist
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/frozenlist
copying build/lib/frozenlist/__init__.py -> build/bdist.linux-x86_64/wheel/./frozenlist
copying build/lib/frozenlist/__init__.pyi -> build/bdist.linux-x86_64/wheel/./frozenlist
copying build/lib/frozenlist/_frozenlist.pyx -> build/bdist.linux-x86_64/wheel/./frozenlist
copying build/lib/frozenlist/py.typed -> build/bdist.linux-x86_64/wheel/./frozenlist
running install_egg_info
Copying frozenlist.egg-info to build/bdist.linux-x86_64/wheel/./frozenlist-1.4.1-py3.10.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/frozenlist-1.4.1.dist-info/WHEEL
creating '/home/tkloczko/rpmbuild/BUILD/frozenlist-1.4.1/dist/.tmp-wgruouqy/frozenlist-1.4.1-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'frozenlist/__init__.py'
adding 'frozenlist/__init__.pyi'
adding 'frozenlist/_frozenlist.pyx'
adding 'frozenlist/py.typed'
adding 'frozenlist-1.4.1.dist-info/LICENSE'
adding 'frozenlist-1.4.1.dist-info/METADATA'
adding 'frozenlist-1.4.1.dist-info/WHEEL'
adding 'frozenlist-1.4.1.dist-info/top_level.txt'
adding 'frozenlist-1.4.1.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built frozenlist-1.4.1-py3-none-any.whl

Steps to reproduce

Use pip or build do perform pep517 build.

kloczek avatar Oct 06 '24 22:10 kloczek

It also doesn't even leave a .whl file to install in my case. Does it for you?

apteryks avatar Dec 08 '24 06:12 apteryks

@kloczek My current workaround is to stick to 1.3.3:

(define-public python-frozenlist
  (package
    (name "python-frozenlist")
    (version "1.3.3")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "frozenlist" version))
       (sha256
        (base32 "0sispcpras096fxrd0i35qs25fqy4r0x8v1d6f40pag845bwbg2q"))))
    (build-system python-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        ;; XXX: The build fails to properly bootstrap itself.
                        (delete 'ensure-no-cythonized-files))))
    (native-inputs (list python-cython python-pytest))
    (home-page "https://github.com/aio-libs/frozenlist")
    (synopsis "List-like data structure for Python")
    (description "@code{frozenlist.FrozenList} is a list-like structure which
implements @code{collections.abc.MutableSequence}.  It can be made immutable
by calling @code{FrozenList.freeze}.")
    (license license:asl2.0)))

I had to keep the pre-generated C Cythonized files otherwise the build would fail.

apteryks avatar Dec 08 '24 06:12 apteryks

Update, I've found a more satisfying solution, by patching build_inplace=False into build_inplace=True in the _backend.py file:

(define-public python-frozenlist
  (package
    (name "python-frozenlist")
    (version "1.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "frozenlist" version))
       (sha256
        (base32 "05xqnkqq7k95v5nfgq1kck78v4i36wjl5m3nx148770vwqlszmc1"))))
    (build-system pyproject-build-system)
    (arguments
     (list
      #:test-flags #~(list "-c" "/dev/null") ;avoid pytest-cov
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-pep517-backend
            (lambda _
              ;; Do not build the wheel in a temporary directory, which would
              ;; cause non-reproducibility in the Cython built shared library,
              ;; as well as break the install phase of pyproject-build-system
              ;; due to not finding the '.whl' file.
              (substitute* "packaging/pep517_backend/_backend.py"
                (("build_inplace=False")
                 "build_inplace=True")))))))
    (native-inputs
     (list python-cython
           python-expandvars
           python-pytest
           python-setuptools))
    (home-page "https://github.com/aio-libs/frozenlist")
    (synopsis "List-like data structure for Python")
    (description
     "@code{frozenlist.FrozenList} is a list-like structure which
implements @code{collections.abc.MutableSequence}.  It can be made immutable
by calling @code{FrozenList.freeze}.")
    (license license:asl2.0)))

apteryks avatar Dec 09 '24 01:12 apteryks

Closing as this concerns an old version and does not have any verifiable details. The build backend would log whether it's set up to build pure python (https://github.com/aio-libs/frozenlist/blob/v1.4.1/packaging/pep517_backend/_backend.py#L229C18-L229C35) but the log posted does not mention it. I don't believe that log is what it's claimed to be. Also, pure-python mode is only enabled by default under PyPy and not CPython: https://github.com/aio-libs/frozenlist/blob/v1.4.1/packaging/pep517_backend/_backend.py#L88-L89.

It's possible to use --config-setting=pure-python=false to force building C-extensions if the project being worked with is indeed frozenlist.

webknjaz avatar Oct 28 '25 22:10 webknjaz

@apteryks FTR, whatever you were seeing does not look in any way related to the original log. Also, it build does leave a wheel in the destination dir regardless of the mode. The CI relies on it and it does work in other environments where it's not rigged somehow.

webknjaz avatar Oct 28 '25 22:10 webknjaz