Skip to content

Commit

Permalink
Update Python Packages build instructions (#2647)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Aug 14, 2024
1 parent 240d142 commit 75ab9bb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ Carthage
# Python Formatter cache
.ruff_cache

# Python venv
.venv

# SPM build artifacts
.build
.swiftpm
52 changes: 46 additions & 6 deletions python/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,60 @@
This document describes how to build and install Ice for Python from source.
You can also download and install a [binary distribution].

* [Building Python Packages with build](#building-python-packages-with-build)
* [Building Python Packages with build on Linux or macOS](#building-python-packages-with-build-on-linux-or-macos)
* [Building Python Packages with build on Windows](#building-python-packages-with-build-on-windows)
* [Building with Visual Studio 2022 and MSBuild (Python 3\.12 for Windows)](#building-with-visual-studio-2022-and-msbuild-python-312-for-windows)
* [Building on Linux or macOS](#building-on-linux-or-macos)
* [Configuring your Environment for Python](#configuring-your-environment-for-python)
* [Running the Python Tests](#running-the-python-tests)

## Building Python Packages with build
## Building Python Packages with build on Linux or macOS

You can build the Ice for Python extension using [build]. Follow these steps:

Ensure you have pip installed
First create a new Python virtual environment to install the Python build package, and activate it

```shell
python -m ensurepip --upgrade
python3 -m venv .venv
source .venv/bin/activate
```

Install the build module
Install the Python build package

```shell
pip install build
python3 -m pip install build
```

Build the extension

```shell
python3 -m build
```

After running these commands, the build module will generate both the source distribution (.tar.gz) and the wheel
distribution (.whl) in the dist directory.

Exit the virtual environment

```shell
deactivate
```

## Building Python Packages with build on Windows

You can build the Ice for Python extension using [build]. Follow these steps:

First create a new Python virtual environment to install the Python build package, and activate it

```shell
python -m venv .venv
.venv\Scripts\activate.bat
```

Install the Python build package

```shell
python -m pip install build
```

Build the extension
Expand All @@ -34,6 +68,12 @@ python -m build
After running these commands, the build module will generate both the source distribution (.tar.gz) and the wheel
distribution (.whl) in the dist directory.

Exit the virtual environment

```shell
deactivate
```

## Building with Visual Studio 2022 and MSBuild (Python 3.12 for Windows)

You can build an Ice for Python extension that links with the Ice C++ DLLs using Visual Studio and MSBuild.
Expand Down

0 comments on commit 75ab9bb

Please sign in to comment.