Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a Python package doesn't work as advertised #2852

Open
2 tasks done
homfunc opened this issue Jan 7, 2025 · 2 comments
Open
2 tasks done

Building a Python package doesn't work as advertised #2852

homfunc opened this issue Jan 7, 2025 · 2 comments
Labels
area:build Related to pixi build

Comments

@homfunc
Copy link

homfunc commented Jan 7, 2025

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Trying to follow the Tutorial Building a Python package for v0.39.5 with the pixi.toml and pyproject.toml from that example (for definiteness I include them here)

pyproject.toml

[project]
dependencies = ["rich"]                               
name = "rich_example"
requires-python = ">= 3.11"
scripts = { rich-example-main = "rich_example:main" } 
version = "0.1.0"

[build-system] 
build-backend = "hatchling.build"
requires = ["hatchling"]

pixi.toml

[workspace] 
channels = ["https://prefix.dev/conda-forge"]
platforms = ["osx-arm64",]
preview = ["pixi-build"]

[dependencies] 
rich_example = { path = "." }

[tasks] 
start = "rich-example-main"

[package] 
name = "rich_example"
version = "0.1.0"

[build-system] 
build-backend = { name = "pixi-build-python", version = "*" }
channels = [
  "https://prefix.dev/pixi-build-backends",
  "https://prefix.dev/conda-forge",
]

[host-dependencies] 
hatchling = "==1.26.3"

[run-dependencies] 
rich = ">=13.9.4,<14"

Issue description

Running pixi install --verbose produces an error complaining about a missing field

❯ pixi install --verbose
 INFO pixi::environment: verifying prefix location is unchanged, with prefix file: /Users/anonymous/test-pixi/.pixi/envs/conda-meta/pixi_env_prefix
 INFO pixi::lock_file::outdated: environment 'default' is out of date because the channels in the lock-file do not match the environments channels
 INFO pixi::repodata: repodata gateway: using max '50' concurrent network requests
 INFO resolve_conda{group=default platform=osx-arm64}:extract_records{source=. platform=osx-arm64}: pixi_build_frontend::build_frontend: discovered a pixi source package at /Users/anonymous/test-pixi
Error: 
  × failed to extract metadata for 'rich_example'
  ├─▶ received invalid response from the build backend (pixi-build-python) when calling 'initialize'
  ╰─▶ missing field `capabilities`

Expected behavior

Python package is built without error.

@ruben-arts ruben-arts added the area:build Related to pixi build label Jan 8, 2025
@ruben-arts
Copy link
Contributor

The latest version of pixi-build-python is already out of sync with pixi's latest release. You could try with version = "0.1.0dev20250106162308"

@homfunc
Copy link
Author

homfunc commented Jan 8, 2025

Thanks @ruben-arts. I can confirm that the updated example in Building a Python package (dev) works with the pixi build on branch main 5329f488d8c69167705214d81fa7e993e75f512b.

For posterity here is the

pixi.toml

[workspace] 
channels = [
  "https://prefix.dev/conda-forge"
]
platforms = ["osx-arm64", ]
preview = ["pixi-build"]

[dependencies]
rich_example = { path = "." }

[tasks] 
start = "rich-example-main"

[package] 
name = "rich_example"
version = "0.1.0"

[package.build]
backend = { name = "pixi-build-python", version = "0.1.0dev20250107152721" }
# backend = { name = "pixi-build-python", version = "*" }
channels = [
  "https://prefix.dev/pixi-build-backends",
  "https://prefix.dev/conda-forge",
]

[package.host-dependencies] 
hatchling = "==1.26.3"

[package.run-dependencies] 
rich = ">=13.9.4,<14"

I tested with both latest ("*") and "0.1.0dev20250107152721" - both worked

❯ pixi install --verbose
 INFO pixi::environment: verifying prefix location is unchanged, with prefix file: /Users/anonymous/test-pixi/.pixi/envs/conda-meta/pixi_env_prefix
 INFO pixi::lock_file::outdated: environment 'default' is out of date because it does not exist in the lock-file.
 INFO pixi::repodata: repodata gateway: using max '50' concurrent network requests
 INFO resolve_conda{group=default platform=osx-arm64}: pixi::lock_file::update: fetched 1010 records in 355.905375ms
 INFO pixi::lock_file::update: resolved conda environment for environment 'default' 'osx-arm64' in 366ms 95us 208ns
 INFO pixi::lock_file::update: Updating prefix
 INFO pixi::environment: No update needed for the prefix file.
 INFO pixi::environment: Verify history file exists: /Users/anonymous/test-pixi/.pixi/envs/default/conda-meta/history
 INFO pixi::lock_file::resolve::uv_resolution_context: uv keyring provider is disabled
✔ The default environment has been installed.
❯ pixi run rich-example-main
┏━━━━━━━━━━━━━━┳━━━━━┳━━━━━━━━━━━━━┓
┃ name         ┃ age ┃ city        ┃
┡━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━━━━┩
│ John Doe     │ 30  │ New York    │
│ Jane Smith   │ 25  │ Los Angeles │
│ Tim de Jager │ 35  │ Utrecht     │
└──────────────┴─────┴─────────────┘

I'm happy to close this with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:build Related to pixi build
Projects
None yet
Development

No branches or pull requests

2 participants