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

Add building wheels using cibuildwheel #1155

Merged
merged 235 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
3dcb268
WIP on using pyproject.toml
JCGoran Feb 5, 2024
b2939d2
Use `pip wheel` instead of `setup.py bdist_wheel`
JCGoran Feb 5, 2024
66da08d
Fix formatting
JCGoran Feb 5, 2024
8ac280e
Do not use `-r reqs` when building wheel
JCGoran Feb 5, 2024
5246907
Wrong flag for `pip wheel`
JCGoran Feb 5, 2024
dc494a2
Fix tabs
JCGoran Feb 5, 2024
3904905
Specify exact wheel we will use in CI
JCGoran Feb 5, 2024
e2ba8bd
Update runtime dependencies
JCGoran Feb 5, 2024
6e4c626
Only repair the NMODL wheel
JCGoran Feb 5, 2024
58be003
Revert "Specify exact wheel we will use in CI"
JCGoran Feb 6, 2024
f373d31
Use `python -m build` instead of `pip wheel`
JCGoran Feb 6, 2024
97774cb
Add workaround for PEP 621 not allowing a dynamic `name`
JCGoran Feb 6, 2024
3595c04
Use `scikit-build-core` as the build backend
JCGoran Feb 7, 2024
5dfab36
Add missing packages to wheel
JCGoran Feb 7, 2024
3e62103
Use cmake.define key instead of cmake.args
JCGoran Feb 7, 2024
8c45d57
Refactor the nmodl wrapper
JCGoran Feb 7, 2024
2a221a1
Added optional dependencies
JCGoran Feb 7, 2024
c558e80
Remove unused script in setup.py
JCGoran Feb 8, 2024
6870fe0
Workaround for wheel build failure on MacOS
JCGoran Feb 8, 2024
60d845d
Change mode of `change_name.py`
JCGoran Feb 11, 2024
4c9cae7
Add file for showing dependencies
JCGoran Feb 11, 2024
aa533ac
Use `show_deps.py` to get requirements in CI
JCGoran Feb 11, 2024
8c0181f
Fix typo in docs CI
JCGoran Feb 11, 2024
3686a04
Add numpy to test deps
JCGoran Feb 12, 2024
0c72f23
Remove setup.py
JCGoran Feb 12, 2024
5af5354
Add min cmake version
JCGoran Feb 12, 2024
f7e08da
Reorder items in pyproject.toml
JCGoran Feb 12, 2024
1b3562e
Enable debug logging when building wheel
JCGoran Feb 12, 2024
a6f3d57
Remove explicit build dir on MacOS
JCGoran Feb 12, 2024
991d3e5
Fix condition in packaging script
JCGoran Feb 12, 2024
9b34ba1
Fix script for testing wheels
JCGoran Feb 12, 2024
0301ef7
Add workaround for symlinked /tmp on MacOS
JCGoran Feb 12, 2024
c22b23d
Relax build and runtime reqs
JCGoran Feb 15, 2024
7cfc27c
Remove textwrap dependency
JCGoran Feb 15, 2024
e18e851
Rearrange cmake options
JCGoran Feb 15, 2024
5e51d2a
Be explicit about Python version in pyproject
JCGoran Feb 15, 2024
bcabef3
Add GHA for building wheels using cibuildwheel
JCGoran Feb 15, 2024
f298692
Add flex and bison to CI
JCGoran Feb 15, 2024
f0cac17
Use GHA if to be platform independent
JCGoran Feb 15, 2024
de1ce19
Use winflexbison3 on Windows
JCGoran Feb 15, 2024
9c84c5e
Skip PyPy builds
JCGoran Feb 15, 2024
d126b62
Don't build on ubuntu just yet
JCGoran Feb 15, 2024
944993e
Fix homebrewed bison and flex paths
JCGoran Feb 15, 2024
f515a75
Workaround for that stupid cmake symlink bug
JCGoran Feb 15, 2024
c9e5379
Workaround for filesystem path on MacOS
JCGoran Feb 15, 2024
12888dc
Workaround for homebrew path
JCGoran Feb 15, 2024
c7b1e35
Remove POSIX-specific headers
JCGoran Feb 15, 2024
3f4edd9
Rename `parser.py` to `language_parser.py`
JCGoran Feb 15, 2024
f7479b4
Disable Windows build for now
JCGoran Feb 15, 2024
7a0066c
Use custom manylinux image for x86 and arm64
JCGoran Feb 15, 2024
e4e3be1
Use `CIBW_BEFORE_BUILD_LINUX` to install bison/flex
JCGoran Feb 15, 2024
79835d9
Add custom deps on Linux CI
JCGoran Feb 15, 2024
0ff22e9
Skip 32-bit builds for now
JCGoran Feb 15, 2024
544d5e0
TEMP remove x86 so arm can actually try to build
JCGoran Feb 15, 2024
8dc35b9
TEMP also remove musllinux stuff so we can actually build arm
JCGoran Feb 15, 2024
c4a1ffe
TEMP typo
JCGoran Feb 15, 2024
33ff2e8
TEMP Only build arm?
JCGoran Feb 15, 2024
4c0ec4e
TEMP maybe it works now?
JCGoran Feb 15, 2024
237ea12
The one that more or less works (minus Windows)
JCGoran Feb 15, 2024
d4bf54a
TEMP windows debug
JCGoran Feb 15, 2024
7409319
Add circleCI for aarch64 Linux builds
JCGoran Feb 15, 2024
f71b07c
Add installation of flex and bison before
JCGoran Feb 15, 2024
e989378
Fix custom paths to flex and bison
JCGoran Feb 15, 2024
c593efc
Try a fix for jinja and paths
JCGoran Feb 15, 2024
ee3a095
Revert "Try a fix for jinja and paths"
JCGoran Feb 15, 2024
2ac0152
Skip pypy wheels on circleCI
JCGoran Feb 15, 2024
290a608
Also don't build musllinux for now
JCGoran Feb 15, 2024
ce6f645
Be more strict about resolving paths maybe?
JCGoran Feb 15, 2024
32a67ba
Update .circleci/config.yml
JCGoran Feb 15, 2024
5225ea4
TEMP Try the main jinja branch?
JCGoran Feb 16, 2024
6258e34
Revert "TEMP Try the main jinja branch?"
JCGoran Feb 16, 2024
16c5076
TEMP only build on Python 3.11 on Windows
JCGoran Feb 16, 2024
17aa9d1
Fix for fmt installation
JCGoran Feb 16, 2024
2bd0b5c
Fix for fmt installation
JCGoran Feb 16, 2024
1807b97
Make formatter happt
JCGoran Feb 16, 2024
af7b123
Make formatter happy
JCGoran Feb 16, 2024
0613b01
Merge branch 'master' into jelic/pyproject
JCGoran Feb 16, 2024
74052a5
Move custom cibuildwheel config to pyproject.toml
JCGoran Feb 16, 2024
8683762
Use `before-all` instead of `before-build` for ext
JCGoran Feb 16, 2024
5b3dbfd
Add testing using cibuildwheel
JCGoran Feb 17, 2024
b12a862
Remove script for building wheels
JCGoran Feb 17, 2024
4900d16
Remove wheel building on Azure
JCGoran Feb 17, 2024
b0e4b35
Simplify tests even more
JCGoran Feb 17, 2024
3da19ca
Add pytest tests
JCGoran Feb 17, 2024
814a203
TEMP try to install libpython?
JCGoran Feb 17, 2024
8ccbbd0
Remove tests for cli for now
JCGoran Feb 17, 2024
f1f1f4a
Add setuptools to runtime deps
JCGoran Feb 17, 2024
5265c42
Add setuptools to runtime deps
JCGoran Feb 17, 2024
3e7cc6a
Move all setup.cfg settings to pyproject.toml
JCGoran Feb 18, 2024
eba6c6b
Working copy (without Windows)
JCGoran Feb 18, 2024
a54c558
For real this time
JCGoran Feb 18, 2024
db9054e
Greatly simplify the wheel testing
JCGoran Feb 18, 2024
5ff006d
Revert "Be more strict about resolving paths maybe?"
JCGoran Feb 19, 2024
51f7610
Move some setup.cfg settings to pyproject.toml
JCGoran Feb 18, 2024
8e79c27
Move some setup.cfg settings to pyproject.toml
JCGoran Feb 18, 2024
8d67f69
Remove `show_deps.py` in favor of `pip-tools`
JCGoran Feb 19, 2024
e36e0e7
Replace `pkg_resources` with `importlib`
JCGoran Feb 19, 2024
4873e76
Replace `pkg_resources` with `importlib`
JCGoran Feb 19, 2024
824a63c
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Feb 19, 2024
4128b68
Forgot one pip-compile
JCGoran Feb 19, 2024
c3ceca3
Fix typo
JCGoran Feb 19, 2024
36750f0
Replace `pkg_resources` with `importlib`
JCGoran Feb 19, 2024
652a985
Fix CI
JCGoran Feb 19, 2024
53a1456
Replace `pkg_resources` with `importlib`
JCGoran Feb 19, 2024
43cccf2
Fix bug in setting path
JCGoran Feb 19, 2024
cf5b9ff
Fix bug in setting path
JCGoran Feb 19, 2024
8cc5723
Be more specific about error raised
JCGoran Feb 19, 2024
9fabd81
Be more specific about error raised
JCGoran Feb 19, 2024
932d062
Add tests for CLI in CI
JCGoran Feb 19, 2024
94a2a72
Fix for NMODL sympy visitor
JCGoran Feb 20, 2024
63382d6
Refactor generation of docs
JCGoran Feb 20, 2024
02191de
Fix for NMODL sympy visitor
JCGoran Feb 20, 2024
8073f4b
WIP on using azure for CI
JCGoran Feb 21, 2024
6a6433b
Do not redefine `LINK_AGAINST_PYTHON`
JCGoran Feb 21, 2024
b8f793b
Define skip builds in pyproject.toml
JCGoran Feb 21, 2024
6f83d3b
Remove `env` from wheel CI jobs
JCGoran Feb 21, 2024
e54ee01
WIP on azure pipeline Linux testing
JCGoran Feb 22, 2024
dc1d5cd
Maybe fix azure?
JCGoran Feb 22, 2024
7787169
Fix ordering in azure
JCGoran Feb 22, 2024
bc7aa9b
Maybe now
JCGoran Feb 22, 2024
dc60c56
Okay for real this time
JCGoran Feb 22, 2024
ab8f364
Change name to please CI overlord
JCGoran Feb 22, 2024
37aff68
TEMP only build cp311 so we can debug azure faster
JCGoran Feb 22, 2024
f3f49ea
Forgot the base image, thanks azure
JCGoran Feb 22, 2024
c759aa3
Depend on manylinux wheel first
JCGoran Feb 22, 2024
b978878
SETUPTOOLS_PRETEND_VERSION is better
JCGoran Feb 22, 2024
81c27bb
DEBUG remove python
JCGoran Feb 22, 2024
7eded52
Revert "DEBUG remove python"
JCGoran Feb 22, 2024
8cae14b
Do not use python.version for uploading wheels
JCGoran Feb 22, 2024
99b3eed
WIP on venv in azure
JCGoran Feb 22, 2024
dc24684
Debug azure
JCGoran Feb 22, 2024
f0c0a3e
Download artifacts before testing wheels
JCGoran Feb 22, 2024
6c04eec
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Feb 22, 2024
793e27f
Merge branch 'master' into jelic/pyproject
JCGoran Feb 22, 2024
1ca8144
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Feb 22, 2024
339ee23
Use pip for building wheels
JCGoran Feb 22, 2024
c6657c8
Correctly pass env variables for manylinux wheel
JCGoran Feb 24, 2024
cdf8eab
Merge branch 'master' into jelic/pyproject
JCGoran Feb 26, 2024
b6e3165
Fix test script
JCGoran Feb 26, 2024
9b262a6
Merge branch 'master' into jelic/cibw
JCGoran Feb 26, 2024
1c87a1a
Debug linux version
JCGoran Feb 26, 2024
b396385
Fix version
JCGoran Feb 26, 2024
ca9d55a
Merge branch 'master' into jelic/pyproject
JCGoran Feb 26, 2024
8839976
Merge branch 'master' into jelic/cibw
JCGoran Feb 26, 2024
1248829
Revert "Do not redefine `LINK_AGAINST_PYTHON`"
JCGoran Feb 26, 2024
8051d50
Revert "Do not redefine `LINK_AGAINST_PYTHON`"
JCGoran Feb 26, 2024
812a5fd
Update test-command and test script
JCGoran Feb 26, 2024
b0cec6d
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Feb 26, 2024
ab4d2e8
Fix unbound variable
JCGoran Feb 26, 2024
ade464f
Fix getting dir on macOS
JCGoran Feb 26, 2024
9fbcf43
Merge branch 'master' into jelic/pyproject
JCGoran Feb 26, 2024
144b579
Do not install headers when building wheel
JCGoran Feb 26, 2024
870eab4
Merge branch 'master' into jelic/pyproject
JCGoran Feb 27, 2024
a47e449
Be more general about the test requirements for wheel
JCGoran Feb 27, 2024
1ead3a4
Move nmodl Python bindings to `python/nmodl`
JCGoran Feb 27, 2024
4dd0cde
Minor fixes for testing
JCGoran Feb 27, 2024
a75d656
Fix wheel.packages
JCGoran Feb 27, 2024
3a8640e
Copy also files from build dir
JCGoran Feb 27, 2024
6453a1e
Revert "Copy also files from build dir"
JCGoran Feb 27, 2024
8eb4c84
Fix for cmake build
JCGoran Feb 27, 2024
8a34ab1
Merge branch 'master' into jelic/pyproject
JCGoran Feb 27, 2024
c4ede53
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Feb 28, 2024
9853a29
Build wheels for all Python versions
JCGoran Feb 28, 2024
15d94b5
Fix azure pipeline searching for wheels
JCGoran Feb 28, 2024
6f1cc38
Merge branch 'master' into jelic/pyproject
JCGoran Feb 28, 2024
1872bcb
Merge branch 'master' into jelic/pyproject
JCGoran Feb 28, 2024
2a45fec
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Feb 28, 2024
729a306
Merge branch 'jelic/pyproject' into jelic/move_python_dir
JCGoran Feb 28, 2024
dfde76a
Update docs
JCGoran Feb 28, 2024
7128f08
Revert "Build wheels for all Python versions"
JCGoran Feb 28, 2024
57b6001
Update azure testing again
JCGoran Feb 28, 2024
e8abe2a
Update docs/generate_docs.sh
JCGoran Feb 28, 2024
9f4e0a2
Yes fine it was an unbound variable
JCGoran Feb 28, 2024
c142b94
I hate CI
JCGoran Feb 28, 2024
b1afcd0
Fix doxygen issues when building docs
JCGoran Feb 28, 2024
f44ffbb
Allow setting a custom build directory for docs
JCGoran Feb 29, 2024
bc6d692
Minor updates to docs
JCGoran Feb 29, 2024
9257890
Fix for azure testing manylinux
JCGoran Feb 29, 2024
f8a43d9
Maybe now azure?
JCGoran Feb 29, 2024
a689939
Fix docs building again (and maybe for all)
JCGoran Feb 29, 2024
44a0514
Forgot to actually install Python
JCGoran Feb 29, 2024
7c5be89
Fix docs CI to match changes
JCGoran Feb 29, 2024
f2fbb2e
Fix no effect statement in docs gen
JCGoran Feb 29, 2024
9373afb
Fix `change_name.py` script
JCGoran Feb 29, 2024
23bee89
Leave in the `nmodl.hpp` header
JCGoran Feb 29, 2024
c15cbbc
Build everything
JCGoran Feb 29, 2024
1ef357f
Refactor generation of docs
JCGoran Mar 1, 2024
2335403
Update docs CI
JCGoran Mar 1, 2024
5931038
Put back the version
JCGoran Mar 1, 2024
859ee44
Update INSTALL.rst
JCGoran Mar 1, 2024
8ad9f0f
Save valuable time and keystrokes by not using underscores
JCGoran Mar 1, 2024
2cc7733
Remove comment
JCGoran Mar 1, 2024
66b342a
Use two azure runners to build wheels on MacOS
JCGoran Mar 1, 2024
e07a6d2
Update docgen
JCGoran Mar 1, 2024
d93760e
Update dosc
JCGoran Mar 1, 2024
c21722c
Update CI
JCGoran Mar 1, 2024
506b4b7
Merge branch 'master' into jelic/pyproject
JCGoran Mar 1, 2024
713e32e
Remove useless flags
JCGoran Mar 1, 2024
5c67ac7
Remove useless CI job
JCGoran Mar 1, 2024
ce03dd8
Merge branch 'jelic/move_python_dir' into jelic/pyproject
JCGoran Mar 1, 2024
62fd8a7
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Mar 1, 2024
ce0fabf
Remove MacOS 14 runner on azure as its unavailable
JCGoran Mar 1, 2024
c806063
Build and test all wheels on GHA
JCGoran Mar 1, 2024
1af5ec4
Enable non-master CI for now
JCGoran Mar 1, 2024
b1ee0c7
Maybe now?
JCGoran Mar 1, 2024
e43d04c
Fix typo
JCGoran Mar 1, 2024
959b0d5
Update nmodl-wheel.yml
JCGoran Mar 1, 2024
fe06639
Download artifact v4 maybe?
JCGoran Mar 4, 2024
ff34fec
Merge remote-tracking branch 'origin/jelic/cibw' into jelic/cibw
JCGoran Mar 4, 2024
1930073
Revert "Build everything"
JCGoran Mar 4, 2024
85c76b9
Cmon github expand the damn variable!
JCGoran Mar 4, 2024
73ab250
Final touches for CI
JCGoran Mar 4, 2024
bd87326
Last touches in CI
JCGoran Mar 4, 2024
1a367f3
WIP test circle CI wheels
JCGoran Mar 4, 2024
93fcef3
Fix useless imports in init
JCGoran Mar 4, 2024
26e6193
Raise an error if NMODL is not available
JCGoran Mar 4, 2024
5e4f395
Fix CIRCLECI
JCGoran Mar 4, 2024
b18576b
WIP on circleCI
JCGoran Mar 4, 2024
58582c7
Remove all ARM stuff for now
JCGoran Mar 4, 2024
71b58fa
Put back empty circleCI config
JCGoran Mar 4, 2024
a74c76c
Add requirements.txt
JCGoran Mar 4, 2024
747053b
Put back requirements in CI
JCGoran Mar 4, 2024
62612cc
Remove checking python dependencies in cmake
JCGoran Mar 4, 2024
5eae4cb
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Mar 4, 2024
031dfdb
Put back the init try so CI passes
JCGoran Mar 4, 2024
dc747e4
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Mar 4, 2024
6cbcdec
Change back name of wheel
JCGoran Mar 4, 2024
2450a2b
Add minor fixes to script for building wheels
JCGoran Mar 5, 2024
dd2d11f
WIP try to use newer docker NMODL image to build wheels
JCGoran Mar 5, 2024
674f466
Merge branch 'jelic/pyproject' into jelic/cibw
JCGoran Mar 5, 2024
c96495e
Build all wheels again
JCGoran Mar 5, 2024
800714a
Use primary Docker image when building Linux wheels
JCGoran Mar 5, 2024
482d6c6
Merge branch 'master' into jelic/cibw
JCGoran Mar 6, 2024
d4c8d35
Remove useless echo in CI
JCGoran Mar 6, 2024
08d67fa
Update docs
JCGoran Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ libpywrapper two environment variables need to be present:
building without linking against libpython we must set ``NMODL_PYLIB``
before running cmake!

.. _testing-installed-module:

Testing the Installed Module
----------------------------

Expand Down
126 changes: 50 additions & 76 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,13 @@ stages:
env:
SHELL: 'bash'
displayName: 'Build Neuron and Run Integration Tests'

- job: 'manylinux_wheels'
timeoutInMinutes: 45
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
${{ if eq(variables.buildWheel, True) }}:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'
${{ if eq(variables.buildWheel, False) }}:
Python311:
python.version: '3.11'
steps:
- task: UsePythonVersion@0
- checkout: self
submodules: True
condition: succeeded()
Expand All @@ -222,99 +210,85 @@ stages:
else
export TAG=""
fi
# the following 2 lines are a workaround for PEP 621 not allowing a
# dynamic `name` in `pyproject.toml`
python3 -m pip install --user tomli tomli-w
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==2.16.5 tomli tomli-w
# change the name accordingly
python3 packaging/change_name.py pyproject.toml "NMODL${TAG}"
export SETUPTOOLS_SCM_PRETEND_VERSION="$(git describe --tags | cut -d '-' -f 1,2 | tr - .)"
docker run --rm \
-w /root/nmodl \
-v $PWD:/root/nmodl \
-e NMODL_NIGHTLY_TAG=$TAG \
-e SETUPTOOLS_SCM_PRETEND_VERSION=$SETUPTOOLS_SCM_PRETEND_VERSION \
'bluebrain/nmodl:wheel' \
packaging/build_wheels.bash linux $(python.version)
CIBW_ENVIRONMENT_PASS_LINUX='SETUPTOOLS_SCM_PRETEND_VERSION' python3 -m cibuildwheel --output-dir wheelhouse
condition: succeeded()
displayName: 'Building ManyLinux Wheel'
displayName: 'Building ManyLinux Wheels'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.SourcesDirectory)/wheelhouse'
condition: succeeded()
displayName: 'Publish wheel as build artifact'
- script: |
sudo apt-add-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y python$(python.version) python$(python.version)-dev python$(python.version)-venv
packaging/test_wheel.bash python$(python.version) wheelhouse/*.whl
condition: succeeded()
displayName: 'Test ManyLinux Wheel with Python $(python.version)'
- template: ci/upload-wheels.yml
- job: 'macos_wheels'

- job: 'macos_wheels_x86_64'
timeoutInMinutes: 45
pool:
vmImage: 'macOS-11'
strategy:
matrix:
${{ if eq(variables.buildWheel, True) }}:
Python38:
python.version: '3.8'
python.org.version: '3.8.10'
python.installer.name: 'macosx10.9.pkg'
Python39:
python.version: '3.9'
python.org.version: '3.9.13'
python.installer.name: 'macosx10.9.pkg'
Python310:
python.version: '3.10'
python.org.version: '3.10.5'
python.installer.name: 'macos11.pkg'
Python311:
python.version: '3.11'
python.org.version: '3.11.1'
python.installer.name: 'macos11.pkg'
${{ if eq(variables.buildWheel, False) }}:
Python311:
python.version: '3.11'
python.org.version: '3.11.1'
python.installer.name: 'macos11.pkg'
vmImage: 'macOS-12'
steps:
- checkout: self
submodules: True
condition: succeeded()
- script: |
brew install flex bison cmake ninja
export PATH=/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH;
condition: succeeded()
displayName: 'Install Dependencies'
- task: UsePythonVersion@0
- script: |
installer=python-$(python.org.version)-$(python.installer.name)
url=https://www.python.org/ftp/python/$(python.org.version)/$installer
curl $url -o $installer
sudo installer -pkg $installer -target /
condition: succeeded()
displayName: 'Install Python from python.org'
- script: |
export PATH=/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
if [[ "$(RELEASEWHEELBUILD)" != "True" ]]; then
export NMODL_NIGHTLY_TAG="-nightly"
else
export NMODL_NIGHTLY_TAG=""
fi
# the following 2 lines are a workaround for PEP 621 not allowing a
# dynamic `name` in `pyproject.toml`
python3 -m pip install tomli tomli-w
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==2.16.5 tomli tomli-w
# change the name accordingly
python3 packaging/change_name.py pyproject.toml "NMODL${NMODL_NIGHTLY_TAG}"
SETUPTOOLS_SCM_PRETEND_VERSION="$(git describe --tags | cut -d '-' -f 1,2 | tr - .)" packaging/build_wheels.bash osx $(python.version)
SETUPTOOLS_SCM_PRETEND_VERSION="$(git describe --tags | cut -d '-' -f 1,2 | tr - .)" python3 -m cibuildwheel --output-dir wheelhouse
condition: succeeded()
displayName: 'Build macos Wheel'
displayName: 'Build macos Wheel (x86_64)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.SourcesDirectory)/wheelhouse'
condition: succeeded()
displayName: 'Publish wheel as build artifact'
- template: ci/upload-wheels.yml

- job: 'test_manylinux_wheels'
dependsOn: 'manylinux_wheels'
timeoutInMinutes: 45
pool:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
${{ if eq(variables.buildWheel, True) }}:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'
Python312:
python.version: '3.12'
${{ if eq(variables.buildWheel, False) }}:
Python311:
python.version: '3.11'
steps:
- download: current
patterns: 'drop/*.whl'
displayName: "Make manylinux wheels available"
- script: |
packaging/test_wheel.bash python$(python.version) wheelhouse/*.whl
set -eux
sudo apt-add-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y python$(python.version) python$(python.version)-dev python$(python.version)-venv
dotless_version="$(echo "$(python.version)" | tr -d '.')"
find $(Pipeline.Workspace) -name "*cp${dotless_version}-manylinux*.whl" -exec bash packaging/test_wheel.bash python$(python.version) {} \;
condition: succeeded()
displayName: 'Test macos Wheel with Python $(python.version)'
- template: ci/upload-wheels.yml
displayName: 'Test manylinux Wheel with Python $(python.version)'
2 changes: 0 additions & 2 deletions ci/upload-wheels.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- task: TwineAuthenticate@1
inputs:
pythonUploadServiceConnection: AzureNMODLPypiNightly
Expand Down
72 changes: 37 additions & 35 deletions packaging/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Building Python Wheels
Note: This is only slightly adapted from NEURONs
`scripts <https://github.com/neuronsimulator/nrn/tree/master/packaging/python>`__.

NMODL wheels are built in a manylinux2010 image. Since the generic
docker image is very basic (CentOS 6) a new image, which brings updated
NMODL wheels are built in a manylinux2014 image. Since the generic
docker image is very basic (CentOS 7), a new image, which brings updated
cmake3 (3.12), flex and bison was prepared and made available at
https://hub.docker.com/r/bluebrain/nmodl (tag: wheel).

Expand All @@ -18,64 +18,66 @@ Linux `here <https://docs.docker.com/engine/install/ubuntu/>`__ and on
OS X `here <https://docs.docker.com/docker-for-mac/install/>`__. On
Ubuntu system we typically do:

::
.. code::sh

sudo apt install docker.io
sudo groupadd docker
sudo usermod -aG docker $USER

Logout and log back in to have docker service properly configured.

Pull and start the docker image
-------------------------------
Launch the wheel building
-------------------------

We mount local neuron repository inside docker as a volume to preserve
any code changed. We can use -v option to mount the local folder as:
For building the wheel we use the ``cibuilwwheel`` utility, which can be installed using:

::
.. code::sh

docker run -v /home/user/nmodl:/root/nmodl -it bluebrain/nmodl:wheel bash
pip install cibuildwheel

where ``/home/user/nmodl`` is the NMODL repository on the host machine.
We mount this directory inside docker at location ``/root/nmodl`` inside
the container.
Then to build a wheel for the current platform, run:

Note that for OS X there is no docker image but on a system where all
dependencies exist, you have to perform next building step.
.. code::sh

Launch the wheel building
-------------------------
cibuildwheel

Once we are inside docker container, we can start building wheels. There
is a build script that loops over the pythons ``>=3.5`` in
``/opt/python``, build and audit the generated wheels. Results are
placed in this wheelhouse directory.
If you have Docker installed, you can also build the Linux wheels using:

::
.. code::sh

cd /root/nmodl
bash packaging/python/build_wheels.bash linux
cibuildwheel --platform linux

For OSX on a system with the all dependencies you have to clone the
NMODL repository and do:
Note that, if you happen to have Podman installed instead of Docker, you can
set ``CIBW_CONTAINER_ENGINE=podman`` to use Podman instead of Docker for this
task.

::
Furthermore, in order to build wheels on MacOS, you need to install an official
CPython installer from `python.org <https://www.python.org>`__.

cd nrn
bash packaging/python/build_wheels.bash osx
For a complete list of all available customization options for
``cibuildwheel``, please consult the
`documentation <https://cibuildwheel.readthedocs.io/en/stable/options/>`__.

Updating neuron_wheel docker image
----------------------------------
Testing the wheel
-----------------

On MacOS, the testing of the wheel is launched automatically when running
``cibuildwheel``. On Linux, you will need to test the wheel manually, please
see :ref:`testing-installed-module` for the instructions.


Updating the NMODL Docker image
-------------------------------

If you have changed Dockerfile, you can build the new image as:
If you have changed the Dockerfile, you can build the new image as:

::
.. code::sh

docker build -t bluebrain/nmodl:tag .

and then push image to hub.docker.com as:
and then push the image to hub.docker.com as:

::
.. code::sh

docker login --username=<username>
docker push bluebrain/nmodl:tag
docker push bluebrain/nmodl:tag
Loading
Loading