prefix-dev / rattler-build

rattler-build is a universal package builder for Windows, macOS and Linux
https://prefix-dev.github.io/rattler-build
BSD 3-Clause "New" or "Revised" License
215 stars 45 forks source link

`python_abi` requirement being wrongly added #1196

Closed theavey closed 1 hour ago

theavey commented 4 hours ago

I am building a package for Windows-only on Windows. It uses a wheel to install and runs a simple script to copy over some files. The wheel is compatible with Python 3.7 through 3.12, so I added that requirement in the run section. As I understand it, the host Python requirement has no version restriction, so I did not restrict that.

However, when I run the build, the host environment uses Python 3.13, and for some reason, this adds a requirement of python_abi 3.13.* to the built package, which is not actually required and then breaks when trying to build the test environment (because it requires Python <3.13 but also python_abi 3.13.*, which are obviously incompatible.

Kinda seems related to #344, but I cannot say for sure if they are the same.

Here is the recipe.yaml

schema_version: 1

context:
  name: tableauhyperapi
  version: 0.0.20746
  # version_thing: ${{ version.split('.')[2] }}  # doesn't work even though docs say it should
  wheel_name: "${{ name }}-${{ version }}-py3-none-win_amd64.whl"
  hash_url_crap: b8/5d/b4e7c6d67bc51d342104ca876bb22f4511094e06202f3dab1d6842340224

package:
  name: ${{ name|lower }}
  version: ${{ version }}

source:
  # unclear why this doesn't work...
  # url: https://downloads.tableau.com/tssoftware/${{ wheel_name }}
  # but this does...
  url: https://files.pythonhosted.org/packages/${{ hash_url_crap }}/${{ wheel_name }}
  sha256: e4bb12cfdf738198f6889db8dd0bfe4386480c99f4e1d6143dfbd44f704920bb

build:
  number: 0
  script: ${{ PYTHON }} -m pip install ${{ wheel_name }} -vv --no-deps

requirements:
  host:
    - pip
    - python
  run:
    - python >=3.8,<3.13
    - cffi !=1.14.3,<2,>=1.12.2

tests:
  - python:
      imports:
        - tableauhyperapi

about:
  summary: Annoying proprietary stuff
  homepage: https://www.tableau.com/developer/learning/tableau-hyper-api

Using rattler-build 0.30.0

wolfv commented 2 hours ago

Hi @theavey - that is a featuer called "run-exports". Python (from conda-forge) automatically adds a run-dependency on this particular package to make sure that it will only be run with this particular version of python.

If you determine that you don't need that you can disable the specific run exports by using the ignore_run_exports field: https://prefix-dev.github.io/rattler-build/latest/reference/recipe_file/#ignore-run-exports

For example, you could say:

requirements:
  ignore_run_exports:
    by_name:
      - python_abi
theavey commented 1 hour ago

Okay, so just user error in this case :)

Thank you for the info!