Skip to content

Commit

Permalink
docs: add conda help to faqs (#868)
Browse files Browse the repository at this point in the history
Adding some more FAQs.

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Aug 21, 2024
1 parent 6b02b1b commit 40eca66
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ repos:
- rich
- setuptools-scm
- tomli
- types-setuptools~=70.0
- types-setuptools>=70.1

- repo: https://github.com/henryiii/check-sdist
rev: "v1.0.0rc2"
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[![PyPI version][pypi-version]][pypi-link]
[![Conda-Forge][conda-badge]][conda-link]
[![PyPI platforms][pypi-platforms]][pypi-link]
[![Downloads][download-badge]][download-link]

> [!NOTE]
>
Expand Down Expand Up @@ -366,26 +367,28 @@ those of the author(s) and do not necessarily reflect the views of the National
Science Foundation.

<!-- prettier-ignore-start -->
[OAC-2209877]: https://www.nsf.gov/awardsearch/showAward?AWD_ID=2209877&HistoricalAwards=false
[actions-badge]: https://github.com/scikit-build/scikit-build-core/workflows/CI/badge.svg
[actions-link]: https://github.com/scikit-build/scikit-build-core/actions
[cmeel]: https://github.com/cmake-wheel/cmeel
[codecov-badge]: https://codecov.io/gh/scikit-build/scikit-build-core/branch/main/graph/badge.svg?token=ZLbQzIvyG8
[codecov-link]: https://codecov.io/gh/scikit-build/scikit-build-core
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/scikit-build-core
[conda-link]: https://github.com/conda-forge/scikit-build-core-feedstock
[cmeel]: https://github.com/cmake-wheel/cmeel
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
[github-discussions-link]: https://github.com/orgs/scikit-build/discussions
[discord-badge]: https://img.shields.io/discord/803025117553754132?label=Discord%20chat%20%23scikit-build
[discord-link]: https://discord.gg/pypa
[codecov-badge]: https://codecov.io/gh/scikit-build/scikit-build-core/branch/main/graph/badge.svg?token=ZLbQzIvyG8
[codecov-link]: https://codecov.io/gh/scikit-build/scikit-build-core
[download-badge]: https://static.pepy.tech/badge/scikit-build-core/month
[download-link]: https://pepy.tech/project/scikit-build-core
[enscons]: https://pypi.org/project/enscons
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
[github-discussions-link]: https://github.com/orgs/scikit-build/discussions
[hatchling]: https://hatch.pypa.io/latest
[maturin]: https://www.maturin.rs
[meson-python]: https://meson-python.readthedocs.io
[py-build-cmake]: https://tttapa.github.io/py-build-cmake
[pypi-link]: https://pypi.org/project/scikit-build-core/
[pypi-platforms]: https://img.shields.io/pypi/pyversions/scikit-build-core
[pypi-version]: https://badge.fury.io/py/scikit-build-core.svg
[rtd-badge]: https://readthedocs.org/projects/scikit-build-core/badge/?version=latest
[rtd-link]: https://scikit-build-core.readthedocs.io/en/latest/?badge=latest
[OAC-2209877]: https://www.nsf.gov/awardsearch/showAward?AWD_ID=2209877&HistoricalAwards=false
[hatchling]: https://hatch.pypa.io/latest
[maturin]: https://www.maturin.rs
[meson-python]: https://meson-python.readthedocs.io
[enscons]: https://pypi.org/project/enscons
[py-build-cmake]: https://tttapa.github.io/py-build-cmake
<!-- prettier-ignore-end -->
43 changes: 43 additions & 0 deletions docs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,48 @@ are not redistrubutable cannot be uploaded to PyPI[^2]. You have to run your
wheels through `auditwheel` to make `manylinux` wheels. `cibuildwheel`
automatically does this for you. See [repairing](#repairing-wheels).

## Making a Conda recipe

`scikit-build-core` is available on conda-forge, and is used in [dozens of recipes][]. There are a few things to keep in mind.

You need to recreate your `build-system.requires` in the `host` table, with the
conda versions of your dependencies. You also need to add `cmake` and either
`make` or `ninja` to your `build:` table. Conda-build hard-codes
`CMAKE_GENERATOR="Unix Makefiles` on UNIX systems, so you have to set or unset
this to use Ninja if you prefer Ninja. The `scikit-build-core` recipe cannot
depend on `cmake`, `make`, or `ninja`, because that would add those to the
wrong table (`host` instead of `build`). Here's an example:

```yaml
build:
script:
- {{ PYTHON }} -m pip install . -vv

requirements:
build:
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- {{ compiler('c') }}
- {{ stdlib('c') }}
- {{ compiler('cxx') }}
- cmake >=3.15
- make # [not win]
host:
- python
- pip
- scikit-build-core >=0.2.0
run:
- python
```
## Supporting free-threaded builds on Windows
Windows currently requires a little extra care. You should set the C define
`Py_GIL_DISABLED` on Windows; due to the way the two builds share the same
config files, Python cannot set it for you on the free-threaded variant.

[^1]:
Due to a [bug in packaging](https://github.com/pypa/packaging/issues/160),
some backends may mistakenly produce the wrong tags (including
Expand All @@ -91,5 +133,6 @@ automatically does this for you. See [repairing](#repairing-wheels).
[scientific python cookie]: https://github.com/scientific-python/cookie
[scientific python development guidelines]: https://learn.scientific-python.org/development
[pybind11 example]: https://github.com/pybind/scikit_build_example
[dozens of recipes]: https://github.com/search?type=code&q=org%3Aconda-forge+path%3Arecipe%2Fmeta.yaml+scikit-build-core

<!-- prettier-ignore-end -->
4 changes: 2 additions & 2 deletions src/scikit_build_core/setuptools/build_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def run(self) -> None:

bdist_wheel = dist.get_command_obj("bdist_wheel")
assert bdist_wheel is not None
limited_api = bdist_wheel.py_limited_api # type: ignore[attr-defined]
limited_api = bdist_wheel.py_limited_api

# TODO: this is a hack due to moving temporary paths for isolation
if build_temp.exists():
Expand Down Expand Up @@ -150,7 +150,7 @@ def run(self) -> None:
name=dist.get_name(),
version=Version(dist.get_version()),
defines=defines,
limited_api=limited_api,
limited_api=bool(limited_api),
configure_args=configure_args,
)

Expand Down

0 comments on commit 40eca66

Please sign in to comment.