Skip to content

Commit 92e8dd8

Browse files
authored
Merge pull request #33 from hjweide/release
Publish wheels to pypi
2 parents 63ae69a + 0118816 commit 92e8dd8

File tree

5 files changed

+162
-18
lines changed

5 files changed

+162
-18
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package Linux
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.7'
29+
- name: Run tests
30+
run: |
31+
pip install .
32+
pip install -r requirements-dev.txt
33+
py.test
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
python -m pip install twine
38+
- name: Build manylinux Python wheels
39+
uses: RalfG/python-wheels-manylinux-build@v0.4.2-manylinux2014_x86_64
40+
with:
41+
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
42+
build-requirements: 'numpy'
43+
- name: Publish distribution 📦 to Test PyPI
44+
env:
45+
TWINE_USERNAME: __token__
46+
#TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
47+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
48+
run: |
49+
#python -m twine upload --repository testpypi dist/*-manylinux*.whl --verbose --skip-existing
50+
python -m twine upload dist/*-manylinux*.whl --verbose --skip-existing
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package MacOs
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: macos-11
22+
23+
strategy:
24+
matrix:
25+
python-version: ["3.7", "3.8", "3.9", "3.10"]
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python
30+
uses: actions/setup-python@v3
31+
with:
32+
python-version: "${{ matrix.python-version }}"
33+
- name: Run tests
34+
run: |
35+
pip install .
36+
pip install -r requirements-dev.txt
37+
py.test
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install wheel twine
42+
- name: "Build package for python ${{ matrix.python-version }}"
43+
run: |
44+
python setup.py bdist_wheel
45+
- name: Publish distribution 📦 to Test PyPI
46+
env:
47+
TWINE_USERNAME: __token__
48+
#TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
49+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
50+
run: |
51+
#python -m twine upload --repository testpypi dist/* --verbose --skip-existing
52+
python -m twine upload dist/* --verbose --skip-existing
53+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package Windows
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: windows-2022
22+
23+
strategy:
24+
matrix:
25+
python-version: ["3.7", "3.8", "3.9", "3.10"]
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python
30+
uses: actions/setup-python@v3
31+
with:
32+
python-version: "${{ matrix.python-version }}"
33+
- name: Run tests
34+
run: |
35+
pip install .
36+
pip install -r requirements-dev.txt
37+
py.test
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install wheel twine
42+
- name: "Build package for python ${{ matrix.python-version }}"
43+
run: |
44+
python setup.py bdist_wheel
45+
- name: Publish distribution 📦 to Test PyPI
46+
env:
47+
TWINE_USERNAME: __token__
48+
#TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
49+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
50+
run: |
51+
#python -m twine upload --repository testpypi dist/* --verbose --skip-existing
52+
python -m twine upload dist/* --verbose --skip-existing

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: python
22
python:
3-
- "3.7"
3+
- 3.8
44
before_install:
55
- pip install -U pip
66
# command to install dependencies

setup.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
import setuptools
22
from distutils.core import Extension
3-
4-
from setuptools.command.build_ext import build_ext as _build_ext
5-
6-
7-
# https://stackoverflow.com/a/21621689/
8-
class build_ext(_build_ext):
9-
def finalize_options(self):
10-
_build_ext.finalize_options(self)
11-
# Prevent numpy from thinking it is still in its setup process:
12-
__builtins__.__NUMPY_SETUP__ = False
13-
import numpy
14-
self.include_dirs.append(numpy.get_include())
15-
3+
from setuptools import dist
4+
dist.Distribution().fetch_build_eggs(["numpy"])
5+
import numpy
166

177
astar_module = Extension(
188
'pyastar2d.astar', sources=['src/cpp/astar.cpp'],
9+
include_dirs=[numpy.get_include()], # for numpy/arrayobject.h
1910
extra_compile_args=["-O3", "-Wall", "-shared", "-fpic"],
2011
)
2112

@@ -28,7 +19,7 @@ def finalize_options(self):
2819

2920
setuptools.setup(
3021
name="pyastar2d",
31-
version="1.0.2",
22+
version="1.0.3",
3223
author="Hendrik Weideman",
3324
author_email="hjweide@gmail.com",
3425
description=(
@@ -37,8 +28,6 @@ def finalize_options(self):
3728
long_description=long_description,
3829
long_description_content_type="text/markdown",
3930
url="https://github.com/hjweide/pyastar2d",
40-
cmdclass={"build_ext": build_ext},
41-
setup_requires=["wheel", "numpy"],
4231
install_requires=install_requires,
4332
packages=setuptools.find_packages(where="src", exclude=("tests",)),
4433
package_dir={"": "src"},
@@ -48,5 +37,5 @@ def finalize_options(self):
4837
"License :: OSI Approved :: MIT License",
4938
"Operating System :: OS Independent",
5039
],
51-
python_requires='>=3.6',
40+
python_requires='>=3.7',
5241
)

0 commit comments

Comments
 (0)