Files
cibuildwheel/docs/setup.md
T

69 lines
2.0 KiB
Markdown
Raw Normal View History

2019-11-09 19:38:59 +00:00
---
2025-04-13 07:16:55 +01:00
title: 'Getting started'
2019-11-09 19:38:59 +00:00
---
2025-04-13 07:16:55 +01:00
# Getting started
2022-08-16 22:53:11 +01:00
2025-04-13 07:16:55 +01:00
Before getting to [CI setup](ci-services.md), it can be convenient to test cibuildwheel locally to quickly iterate and track down issues without having to commit each change, push, and then check CI logs.
2021-06-22 20:02:24 +01:00
Install cibuildwheel and run a build like this:
```sh
2025-04-13 07:16:55 +01:00
# run using uv
uvx cibuildwheel
# or pipx
pipx run cibuildwheel
2021-06-22 20:02:24 +01:00
2025-04-13 07:16:55 +01:00
# or, install it first
pip install cibuildwheel
cibuildwheel
```
2021-08-28 12:24:21 +01:00
2025-04-13 07:16:55 +01:00
!!!tip
You can pass the `--platform linux` option to cibuildwheel to build Linux wheels, even if you're not on Linux. On most machines, the easiest builds to try are the Linux builds. You don't need any software installed except a Docker daemon, such as [Docker Desktop](https://www.docker.com/get-started/). Each platform that cibuildwheel supports has its own system requirements and platform-specific behaviors. See the [platforms page](platforms.md) for details.
You should see the builds taking place. You can experiment with [options](options.md) using environment variables or pyproject.toml.
2021-06-22 20:02:24 +01:00
2021-08-20 17:00:22 +01:00
!!! tab "Environment variables"
cibuildwheel will read config from the environment. Syntax varies, depending on your shell:
> POSIX shell (Linux/macOS)
2021-06-22 20:02:24 +01:00
```sh
# run a command to set up the build system
export CIBW_BEFORE_ALL='uname -a'
2021-06-22 20:02:24 +01:00
cibuildwheel
2021-06-22 20:02:24 +01:00
```
2021-08-20 17:00:22 +01:00
> CMD (Windows)
2021-06-22 20:02:24 +01:00
2021-08-20 17:00:22 +01:00
```bat
set CIBW_BEFORE_ALL='uname -a'
2021-06-22 20:02:24 +01:00
cibuildwheel
2021-06-22 20:02:24 +01:00
```
2021-08-20 17:00:22 +01:00
!!! tab "pyproject.toml"
2025-04-13 07:16:55 +01:00
If you write your options into [`pyproject.toml`](configuration.md#configuration-file), you can work on your options locally, and they'll be automatically picked up when running in CI.
2021-08-20 17:00:22 +01:00
> pyproject.toml
```
[tool.cibuildwheel]
before-all = "uname -a"
2021-08-20 17:00:22 +01:00
```
Then invoke cibuildwheel, like:
```console
cibuildwheel
2021-08-20 17:00:22 +01:00
```
2025-04-13 07:16:55 +01:00
- Once you've got a build working locally, you can move on to [setting up a CI service](ci-services.md).
- View the [full options reference](options.md) to see what cibuildwheel can do.
- Check out the [FAQ](faq.md) for common questions.