1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to configure setuptools with setup.cfg to include platform name, python tag and...

Discussão em 'Python' iniciado por Stack, Setembro 9, 2025.

  1. Stack

    Stack Membro Participativo

    Due to the console message of setup.py install is deprecated, I am in the middle of upgrading my existing setup.py install to the recommended setup.cfg with build

    My existing setup.py looks something like

    from setuptools import setup

    setup(
    name='pybindsample',
    version='0.1.0',
    packages=[''],
    package_data={'': ['pybindsample.so']},
    has_ext_modules=lambda: True,
    )


    My current translation looks like:

    setup.cfg

    [metadata]
    name = pybindsample
    version = 0.1.0

    [options]
    packages = .

    [options.package_data]
    . = pybindsample.so


    pyproject.toml

    [build-system]
    requires = ["setuptools"]
    build-backend = "setuptools.build_meta"


    My question is how can I translate has_ext_modules=lambda: True? has_ext_modules=lambda: True is from the solution here. Without this, after executing python3 -m build --wheel the file name of the generated wheel will become pybindsample-0.1.0-py3-none-any.whl, whereas my old python3 setup.py bdist_wheel will generate wheel with file name pybindsample-0.1.0-cp39-cp39-macosx_11_0_x86_64.whl. I have attempted

    setup.cfg

    [metadata]
    name = pybindsample
    version = 0.1.0

    [options]
    packages = .
    has_ext_modules=lambda: True,

    [options.package_data]
    . = pybindsample.so


    but it still generates pybindsample-0.1.0-py3-none-any.whl, I also attempted

    setup.cfg

    [metadata]
    name = pybindsample
    version = 0.1.0

    [options]
    packages = .

    [options.package_data]
    . = pybindsample.so

    [bdist_wheel]
    python-tag = c39
    plat-name = macosx_11_0_x86_64
    py-limited-api = c39


    this generates pybindsample-0.1.0-cp39-none-macosx_11_0_x86_64.whl, and I couldn't figure out why the abi tag is still none.

    What is the right way to configure setuptools with setup.cfg to include platform name, python tag, and ABI tag?

    Continue reading...

Compartilhe esta Página