Skip to content

Commit

Permalink
feat: support setup helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Sep 18, 2020
1 parent 4a08067 commit be446a1
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 115 deletions.
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ build_script:
- ps: |
if ($env:PYTHON) {
python setup.py sdist
python -m pip install 'pybind11>=2.3'
cd dist
python -m pip install --verbose python_example-0.0.1.tar.gz
cd ..
Expand Down
141 changes: 141 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Wheels

on:
workflow_dispatch:
pull_request:
branches:
- master
push:
branches:
- master
release:
types:
- published

env:
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: pytest {project}/tests


jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2

- name: Install deps
run: python -m pip install "setuptools>=42" "setuptools_scm[toml]>=4.1.0" twine

- name: Build SDist
run: python setup.py sdist

- name: Check metadata
run: twine check dist/*

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz


build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.6.0

- name: Build wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp27-win*

- name: Show files
run: ls -lh wheelhouse
shell: bash

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


# Windows 2.7 (requires workaround for MSVC 2008 replacement)
build_win27_wheels:
name: Py 2.7 wheels on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v1
with:
submodules: true

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.6.0

- uses: ilammy/msvc-dev-cmd@v1

- name: Build 64-bit wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp27-win_amd64
DISTUTILS_USE_SDK: 1
MSSdk: 1

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86

- name: Build 32-bit wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp27-win32
DISTUTILS_USE_SDK: 1
MSSdk: 1

- name: Show files
run: ls -lh wheelhouse
shell: bash

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


upload_all:
name: Upload if release
needs: [build_wheels, build_win27_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/setup-python@v2

- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
144 changes: 138 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,140 @@
# Using https://github.com/github/gitignore/blob/master/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
*.py[cod]
*.egg-info
.DS_Store
_build
_generate
build

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ install:
- |
if [ -n "$PYTHON" ]; then
python setup.py sdist
python -m pip install 'pybind11>=2.3'
python -m pip install --verbose dist/*.tar.gz
elif [ -n "$CONDA" ]; then
conda build conda.recipe --python $CONDA
Expand Down
2 changes: 1 addition & 1 deletion conda.recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ if "%ARCH%" == "32" (set PLATFORM=x86) else (set PLATFORM=x64)
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%
set DISTUTILS_USE_SDK=1
set MSSdk=1
"%PYTHON%" setup.py install
"%PYTHON%" -m pip install
if errorlevel 1 exit 1
2 changes: 1 addition & 1 deletion conda.recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
unset MACOSX_DEPLOYMENT_TARGET
${PYTHON} setup.py install;
${PYTHON} -m pip install;
2 changes: 1 addition & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requirements:
build:
- python
- setuptools
- pybind11
# Disabled for now - pybind11

run:
- python
Expand Down
Loading

0 comments on commit be446a1

Please sign in to comment.