GitLab | UTCN

Skip to content
Snippets Groups Projects
Commit 9b85f46d authored by jhavl's avatar jhavl
Browse files

convert to pyproject.toml

parent d1e7954e
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
set -e -u -x
function repair_wheel {
wheel="$1"
if ! auditwheel show "$wheel"; then
echo "Skipping non-platform wheel $wheel"
else
auditwheel repair "$wheel" --plat "$PLAT" -w /io/wheelhouse/
fi
}
cd ./io
# Compile wheels
for PYBIN in /opt/python/cp3*/bin; do
# "${PYBIN}/pip" install .
# "${PYBIN}/pip" install pytest
"${PYBIN}/pip" wheel /io/ --no-deps -w wheelhouse/
done
# Bundle external shared libraries into the wheels
for whl in wheelhouse/*.whl; do
repair_wheel "$whl"
done
# Install packages and test
#for PYBIN in /opt/python/cp3[6-8]*/bin/; do
# "${PYBIN}/pip" install roboticstoolbox-python[dev,collision,vpython] --no-index -f /io/wheelhouse
# ("${PYBIN}/pytest")
#done
ls ./wheelhouse
name: Build all Wheels
on:
release:
types: [created]
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
include:
- os: ubuntu-20.04
cibw_archs: "aarch64"
steps:
# Set up emulation for arm on linux
- name: Set up QEMU
if: matrix.cibw_archs == 'aarch64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.3
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [created]
workflow_dispatch:
jobs:
deploy:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 2
matrix:
os: [macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
ls ./dist/*.whl
twine upload dist/*.whl
# This is a basic workflow that is manually triggered
name: Linux Build and Publish
on:
release:
types: [created]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
# Runs a single command using the runners shell
- uses: actions/checkout@v2
- name: Make wheels
run: |
sudo docker run -e PLAT=manylinux2010_x86_64 -v ${{ github.workspace }}:/io quay.io/pypa/manylinux2010_x86_64 /io/.github/build-wheels.sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload wheelhouse/*manylinux*
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# name: Upload tar to PyPI
on:
release:
types: [created]
workflow_dispatch:
jobs:
deploy:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 2
matrix:
os: [ubuntu-latest]
python-version: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*.gz
[project]
name = "swift-sim"
description = "A Python/Javascript Robot Simulator and Visualiser"
version = "1.0.1"
authors = [
{ name = "Jesse Haviland", email = "j.haviland@qut.edu.au" },
{ name = "Peter Corke", email = "rvc@petercorke.com" },
]
dependencies = [
"numpy>=1.17.4",
"spatialgeometry~=1.0.0",
"websockets",
]
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.7"
keywords = ["python", "robotics", "robotics-toolbox", "kinematics", "dynamics", "motion-planning", "trajectory-generation", "jacobian", "hessian", "control", "simulation", "robot-manipulator", "mobile-robot"]
classifiers = [
"Development Status :: 5 - Production/Stable",
# Indicate who your project is intended for
"Intended Audience :: Developers",
# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: MIT License",
# Specify the Python versions you support here.
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
[project.urls]
homepage = "https://github.com/jhavl/swift"
documentation = "https://jhavl.github.io/swift/"
repository = "https://github.com/jhavl/swift"
[project.optional-dependencies]
dev = [
"black",
"roboticstoolbox-python~=1.0.0",
"swift-sim",
"pytest",
"pytest-cov",
"flake8",
"pyyaml",
]
docs = [
"sphinx",
"sphinx_rtd_theme",
"sphinx-autorun",
]
[build-system]
requires = [
"setuptools",
"oldest-supported-numpy"
]
build-backend = "setuptools.build_meta"
[tool.setuptools]
packages = ["swift"]
[tool.black]
line-length = 88
target_version = ['py37']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| \.github
| _build
| buck-out
| build
| dist
| docs
)/
)
'''
[tool.flake8]
max-line-length = 88
extend-ignore = 'E203'
[tool.cibuildwheel]
# Will cause the wheel to be installed with `pip install <wheel_file>[dev,collision]`
# test-extras = ["dev", "collision"]
# test-requires = "pytest"
# test-command = "pytest {project}/tests"
manylinux-x86_64-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"
# Build CPython 3.7 - 3.11
build = ["cp37-*", "cp38-*", "cp39-*", "cp310-*", "cp311-*"]
# Disable building musllinux wheels on all platforms
skip = ["pp*", "*musllinux*"]
[tool.cibuildwheel.macos]
# Build `x86_64` and `arm64` wheels on an Intel runner.
# Note that the `arm64` wheel cannot be tested in this configuration.
archs = ["x86_64", "arm64"]
[tool.cibuildwheel.linux]
# On an Linux Intel runner with qemu installed, build Intel and ARM wheels
archs = ["x86_64", "aarch64"]
[tool.cibuildwheel.windows]
# On an Windows Intel runner build wheels
archs = ["AMD64", "x86"]
from setuptools import setup, find_packages, Extension
from os import path
import os
# fmt: off
import pip
pip.main(['install', 'numpy>=1.17.4'])
import numpy
# fmt: on
here = path.abspath(path.dirname(__file__))
req = ["numpy>=1.17.4", "spatialgeometry~=1.0.0", "websockets"]
# Get the long description from the README file
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
def package_files(directory):
......@@ -35,44 +22,12 @@ for extra_folder in extra_folders:
extra_files += package_files(extra_folder)
phys = Extension(
"phys",
"swift.phys",
sources=["./swift/core/phys.cpp"],
include_dirs=["./swift/core/", numpy.get_include()],
)
setup(
name="swift-sim",
version="1.0.0",
description="A Python/Javascript Visualiser",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/jhavl/swift",
author="Jesse Haviland",
license="MIT",
classifiers=[
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 5 - Production/Stable",
# Indicate who your project is intended for
"Intended Audience :: Developers",
# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: MIT License",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
python_requires=">=3.6",
keywords="python robotics robotics-toolbox kinematics dynamics"
" motion-planning trajectory-generation jacobian hessian"
" control simulation robot-manipulator mobile-robot",
packages=find_packages(exclude=["tests", "examples"]),
package_data={"swift": extra_files},
# include_package_data=True,
ext_modules=[phys],
install_requires=req,
)
......@@ -11,7 +11,7 @@ import time
from queue import Queue
import json
from swift import start_servers, SwiftElement, Button
import phys
from swift.phys import step_v, step_shape
rtb = None
......@@ -567,9 +567,7 @@ class Swift:
elif robot._control_mode == "v":
phys.step_v(
robot._n, robot._valid_qlim, dt, robot._q, robot._qd, robot._qlim
)
step_v(robot._n, robot._valid_qlim, dt, robot._q, robot._qd, robot._qlim)
# _v(robot._q, robot._qd, dt, robot._qlim, robot._valid_qlim)
......@@ -600,7 +598,7 @@ class Swift:
id = self.swift_objects.index(shape)
self._send_socket("shape_update", [id, shape.to_dict()])
phys.step_shape(
step_shape(
dt, shape.v, shape._SceneNode__T, shape._SceneNode__wT, shape._SceneNode__wq
)
if shape.collision:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment