Skip to content

Commit b984124

Browse files
authored
Merge pull request #35 from jbvimort/sphinx_doc
DOC: Creation of a sphinx documentation
2 parents 1d6d9ed + 1ce6cea commit b984124

File tree

10 files changed

+406
-194
lines changed

10 files changed

+406
-194
lines changed

README.md

Lines changed: 0 additions & 194 deletions
This file was deleted.

README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Welcome to ITKPythonPackage's documentation!
2+
============================================
3+
4+
This project provides a ``setup.py`` script that build ITK Python wheels.
5+
6+
ITK is an open-source, cross-platform system that provides developers with an extensive suite of software tools for image analysis.
7+
8+
The Python packages are built daily. To install the ITK Python package::
9+
10+
$ python -m pip install --upgrade pip
11+
$ python -m pip install itk -f https://github.com/InsightSoftwareConsortium/ITKPythonPackage/releases/tag/latest
12+
13+
For more information on ITK's Python wrapping, see an introduction in the ITK Software Guide. There are also many downloadable examples documented in Sphinx.
14+
15+
* Free software: Apache Software license
16+
* Documentation: http://itkpythonpackage.readthedocs.org
17+
* Source code: https://github.com/InsightSoftwareConsortium/ITKPythonPackage
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
======================================
2+
Automated wheels building with scripts
3+
======================================
4+
5+
Steps required to build wheels on Linux, MacOSX and Windows have been automated. The following sections outline how to use the associated scripts.
6+
7+
Linux
8+
-----
9+
10+
On any linux distribution with docker and bash installed, running the script dockcross-manylinux-build-wheels.sh will create 64-bit wheels for both python 2.x and python 3.x in the dist directory.
11+
12+
For example::
13+
14+
$ git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git
15+
[...]
16+
17+
$ ./scripts/dockcross-manylinux-build-wheels.sh
18+
[...]
19+
20+
$ ls -1 dist/
21+
itk-4.11.0.dev20170218-cp27-cp27m-manylinux1_x86_64.whl
22+
itk-4.11.0.dev20170218-cp27-cp27mu-manylinux1_x86_64.whl
23+
itk-4.11.0.dev20170218-cp34-cp34m-manylinux1_x86_64.whl
24+
itk-4.11.0.dev20170218-cp35-cp35m-manylinux1_x86_64.whl
25+
itk-4.11.0.dev20170218-cp36-cp36m-manylinux1_x86_64.whl
26+
27+
MacOSX
28+
------
29+
30+
First install the Python.org MacOSX Python's. This step requires sudo::
31+
32+
./scripts/macpython-install-python.sh
33+
34+
35+
Then, build the wheels::
36+
37+
$ ./scripts/macpython-build-wheels.sh
38+
[...]
39+
40+
$ ls -1 dist/
41+
itk-4.11.0.dev20170213-cp27-cp27m-macosx_10_6_x86_64.whl
42+
itk-4.11.0.dev20170213-cp34-cp34m-macosx_10_6_x86_64.whl
43+
itk-4.11.0.dev20170213-cp35-cp35m-macosx_10_6_x86_64.whl
44+
itk-4.11.0.dev20170213-cp36-cp36m-macosx_10_6_x86_64.whl
45+
46+
Windows
47+
-------
48+
49+
First, install Microsoft Visual C++ Compiler for Python 2.7, Visual Studio 2015, Git, and CMake, which should be added to the system PATH environmental variable.
50+
51+
Open a PowerShell terminal as Administrator, and install Python::
52+
53+
PS C:\> Set-ExecutionPolicy Unrestricted
54+
PS C:\> iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
55+
56+
In a PowerShell prompt::
57+
58+
PS C:\Windows> cd C:\
59+
PS C:\> git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git IPP
60+
PS C:\> cd IPP
61+
PS C:\IPP> .\scripts\windows-build-wheels.ps1
62+
[...]
63+
64+
PS C:\IPP> ls dist
65+
Directory: C:\IPP\dist
66+
67+
68+
Mode LastWriteTime Length Name
69+
---- ------------- ------ ----
70+
-a---- 4/9/2017 5:21 PM 59435508 itk-4.11.0.dev20170407-cp27-cp27m-win_amd64.whl
71+
-a---- 4/9/2017 11:14 PM 63274441 itk-4.11.0.dev20170407-cp35-cp35m-win_amd64.whl
72+
-a---- 4/10/2017 2:08 AM 63257220 itk-4.11.0.dev20170407-cp36-cp36m-win_amd64.whl
73+
74+
We need to work in a short directory to avoid path length limitations on Windows, so the repository is cloned into C:\IPP. Also, it is very important to disable antivirus checking on the C:\IPP directory. Otherwise, the build system conflicts with the antivirus when many files are created and deleted quickly, which can result in Access Denied errors. Windows 10 ships with an antivirus application, Windows Defender, that is enabled by default.
75+
76+
sdist
77+
-----
78+
79+
To create source distributions, sdist's, that will be used by pip to compile a wheel for installation if a binary wheel is not available for the current Python version or platform::
80+
81+
$ python setup.py sdist --formats=gztar,zip
82+
[...]
83+
84+
$ ls -1 dist/
85+
itk-4.11.0.dev20170216.tar.gz
86+
itk-4.11.0.dev20170216.zip
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
===========================
2+
Detailed build instructions
3+
===========================
4+
5+
Building ITK Python wheels
6+
--------------------------
7+
8+
Build the ITK Python wheel with the following command::
9+
10+
mkvirtualenv build-itk
11+
pip install -r requirements-dev.txt
12+
python setup.py bdist_wheel
13+
14+
Efficiently building wheels for different version of python
15+
-----------------------------------------------------------
16+
17+
If on a given platform you would like to build wheels for different version of python, you can download and build the ITK components independent from python first and reuse them when building each wheel.
18+
19+
Here are the steps:
20+
21+
- Build ITKPythonPackage with ITKPythonPackage_BUILD_PYTHON set to OFF
22+
23+
- Build "flavor" of package using::
24+
25+
python setup.py bdist_wheel -- \
26+
-DITK_SOURCE_DIR:PATH=/path/to/ITKPythonPackage-core-build/ITK-source

doc/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = python -msphinx
7+
SPHINXPROJ = ITKPythonPackage
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/Miscellaneous.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
=============
2+
Miscellaneous
3+
=============
4+
5+
Written by Jean-Christophe Fillion-Robin and Matt McCormick from Kitware Inc.
6+
7+
It is covered by the Apache License, Version 2.0:
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
For more information about ITK, visit http://itk.org

doc/Prerequisites.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=============
2+
Prerequisites
3+
=============
4+
5+
Building wheels requires:
6+
7+
- CMake
8+
- Git
9+
- C++ Compiler - Platform specific requirements are summarized in scikit-build documentation.
10+
- Python

0 commit comments

Comments
 (0)