diff --git a/.github/workflows/builds.yaml b/.github/workflows/builds.yaml index 9772786..8d12faf 100644 --- a/.github/workflows/builds.yaml +++ b/.github/workflows/builds.yaml @@ -5,81 +5,69 @@ on: - main paths-ignore: - '.github/workflows/docs.yaml' - - '.github/workflows/tests.yaml' + - ".github/workflows/publish.yaml" - '*.md' pull_request: branches: - main jobs: - bionic: + cmake: # Bionic default: gcc 7, python 3.6 - name: Bionic - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - mkdir -p build - cd build - cmake .. -DBUILD_PYTHON=ON - make - - focal: # Focal default: gcc 9, python 3.8 - name: Focal - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - mkdir -p build - cd build - cmake .. -DBUILD_PYTHON=ON - make - - macos: # Catalina default: clang 12, python 3.9 - name: macOS - runs-on: macos-latest + name: CMake ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-20.04 + - macos-latest + steps: - uses: actions/checkout@v2 - name: Build + env: + CMAKE_OSX_ARCHITECTURES: "arm64;x86_64" run: | mkdir -p build cd build - cmake .. -DBUILD_PYTHON=ON + cmake .. -DBUILD_PYTHON=ON -DPYBIND11_PYTHON_VERSION=3 make - ubuntu_pip: - name: Ubuntu pip - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + pip: + name: Pip ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest - - name: Install - run: | - pip install . -vvv - - ubuntu_pip_dev: - name: Ubuntu pip dev - runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install + env: + CMAKE_OSX_ARCHITECTURES: "arm64;x86_64" run: | - pip install -e . -vvv + pip3 install . -vvv + + pip_dev: + name: Pip dev ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest - macos_pip: - name: macOS pip - runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: Install + env: + CMAKE_OSX_ARCHITECTURES: "arm64;x86_64" run: | - pip3 install . -vvv + pip3 install --no-use-pep517 -e . -vvv diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 52514f0..cea68e2 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -5,7 +5,8 @@ on: - main paths-ignore: - '.github/workflows/builds.yaml' - - '.github/workflows/tests.yaml' + - ".github/workflows/releases.yaml" + - ".github/workflows/publish.yaml" - '*.md' pull_request: branches: @@ -18,27 +19,18 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install dependencies + - name: Install pip dependencies run: | sudo apt install doxygen pip install pipenv pipenv install --dev - - name: Configure + - name: Build run: | mkdir -p build cmake -B build -DBUILD_PYTHON=ON -DBUILD_DOCS=ON - - - name: Generate cpp_redis Docs - run: | - cd external/cpp_redis/cpp_redis.git - git submodule update --init . - sed -i.old -E "s/^GENERATE_TAGFILE( +)=$/GENERATE_TAGFILE\1= cpp_redis.tag/" .doxygen - doxygen .doxygen - - - name: Build - # ctrlutils neeeds to be in the virtual environment. - run: pipenv run pip install -e . + # spatialdyn needs to be in the virtual environment. + pipenv run pip install --no-use-pep517 -e . - name: Deploy uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..22c9be2 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,43 @@ +name: Publish +on: workflow_dispatch + # release: + # types: + # - published + # - edited + +jobs: + build_wheels: + name: Build wheels ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.3.1 + + - uses: actions/upload-artifact@v2 + with: + path: wheelhouse/*.whl + + upload_pypi: + name: Upload to PyPi + needs: + - build_wheels + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - name: Publish to PyPi + uses: pypa/gh-action-pypi-publish@v1.5.0 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..4974d23 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,24 @@ +name: Release +on: + workflow_run: + workflows: + - Builds + types: + - completed + +jobs: + release: + name: Release + runs-on: ubuntu-latest + concurrency: release + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Semantic Release + uses: relekang/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 961c6a2..d32a06d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ cmake_minimum_required(VERSION 3.11) # Define project project(ctrl_utils - VERSION 1.4.0 + VERSION 1.3.0 DESCRIPTION "Utility library for robot control" LANGUAGES CXX ) diff --git a/Pipfile b/Pipfile index b5628c1..9d09870 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,7 @@ verify_ssl = true sphinx = "*" sphinxcontrib-doxylink = "*" sphinx-autodoc-typehints = "*" -sphinx-bootstrap-theme = "*" +sphinx_bootstrap_theme = "*" [packages] diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..0f353dc --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,324 @@ +{ + "_meta": { + "hash": { + "sha256": "0bf818541a570a05110884a2f43cc1a69963e673197484823509b766a234a911" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": {}, + "develop": { + "alabaster": { + "hashes": [ + "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359", + "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02" + ], + "version": "==0.7.12" + }, + "babel": { + "hashes": [ + "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9", + "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==2.9.1" + }, + "certifi": { + "hashes": [ + "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872", + "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569" + ], + "version": "==2021.10.8" + }, + "charset-normalizer": { + "hashes": [ + "sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd", + "sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455" + ], + "markers": "python_version >= '3'", + "version": "==2.0.10" + }, + "docutils": { + "hashes": [ + "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125", + "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", + "version": "==0.17.1" + }, + "idna": { + "hashes": [ + "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", + "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" + ], + "markers": "python_version >= '3'", + "version": "==3.3" + }, + "imagesize": { + "hashes": [ + "sha256:1db2f82529e53c3e929e8926a1fa9235aa82d0bd0c580359c67ec31b2fddaa8c", + "sha256:cd1750d452385ca327479d45b64d9c7729ecf0b3969a58148298c77092261f9d" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.3.0" + }, + "importlib-metadata": { + "hashes": [ + "sha256:899e2a40a8c4a1aec681feef45733de8a6c58f3f6a0dbed2eb6574b4387a77b6", + "sha256:951f0d8a5b7260e9db5e41d429285b5f451e928479f19d80818878527d36e95e" + ], + "markers": "python_version < '3.10'", + "version": "==4.10.1" + }, + "jinja2": { + "hashes": [ + "sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8", + "sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7" + ], + "markers": "python_version >= '3.6'", + "version": "==3.0.3" + }, + "markupsafe": { + "hashes": [ + "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298", + "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64", + "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b", + "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194", + "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567", + "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff", + "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724", + "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74", + "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646", + "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35", + "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6", + "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a", + "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6", + "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad", + "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26", + "sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38", + "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac", + "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7", + "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6", + "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047", + "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75", + "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f", + "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b", + "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135", + "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8", + "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a", + "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a", + "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1", + "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9", + "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864", + "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914", + "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee", + "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f", + "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18", + "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8", + "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2", + "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d", + "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b", + "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b", + "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86", + "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6", + "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f", + "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb", + "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833", + "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28", + "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e", + "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415", + "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902", + "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f", + "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d", + "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9", + "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d", + "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145", + "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066", + "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c", + "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1", + "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a", + "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207", + "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f", + "sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53", + "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd", + "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134", + "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85", + "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9", + "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5", + "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94", + "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509", + "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51", + "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872" + ], + "markers": "python_version >= '3.6'", + "version": "==2.0.1" + }, + "packaging": { + "hashes": [ + "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb", + "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522" + ], + "markers": "python_version >= '3.6'", + "version": "==21.3" + }, + "pygments": { + "hashes": [ + "sha256:44238f1b60a76d78fc8ca0528ee429702aae011c265fe6a8dd8b63049ae41c65", + "sha256:4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a" + ], + "markers": "python_version >= '3.5'", + "version": "==2.11.2" + }, + "pyparsing": { + "hashes": [ + "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4", + "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81" + ], + "markers": "python_version >= '3.6'", + "version": "==3.0.6" + }, + "python-dateutil": { + "hashes": [ + "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", + "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "version": "==2.8.2" + }, + "pytz": { + "hashes": [ + "sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c", + "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326" + ], + "version": "==2021.3" + }, + "requests": { + "hashes": [ + "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61", + "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", + "version": "==2.27.1" + }, + "six": { + "hashes": [ + "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", + "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", + "version": "==1.16.0" + }, + "snowballstemmer": { + "hashes": [ + "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1", + "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a" + ], + "version": "==2.2.0" + }, + "sphinx": { + "hashes": [ + "sha256:5da895959511473857b6d0200f56865ed62c31e8f82dd338063b84ec022701fe", + "sha256:6caad9786055cb1fa22b4a365c1775816b876f91966481765d7d50e9f0dd35cc" + ], + "index": "pypi", + "version": "==4.4.0" + }, + "sphinx-autodoc-typehints": { + "hashes": [ + "sha256:1480d4af8ac465aa87b793e22bb0feb4578b9c93b36e01b35c983bd6f596326f", + "sha256:bd6b70b93fc53d63a167738ba4fb40643ef7eb9b8d915a886c372949981b8eac" + ], + "index": "pypi", + "version": "==1.15.2" + }, + "sphinx-bootstrap-theme": { + "hashes": [ + "sha256:038ee7e89478e064b5dd7e614de6f3f4cec81d9f9efbebb06e105693d6a50924", + "sha256:8b648023a0587f1695460670554ca3fb493e344313189b74a87b0ba27168ca47" + ], + "index": "pypi", + "version": "==0.8.0" + }, + "sphinxcontrib-applehelp": { + "hashes": [ + "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a", + "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.2" + }, + "sphinxcontrib-devhelp": { + "hashes": [ + "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e", + "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.2" + }, + "sphinxcontrib-doxylink": { + "hashes": [ + "sha256:2ffa041178b5b31be849390c9422876d8827f20373ea2a1ecac8b3e9349a850b", + "sha256:596d2067b889fa15d8cbc66d80a7f40d6ec468a22c0270b36e2f9633454ba17d" + ], + "index": "pypi", + "version": "==1.11.1" + }, + "sphinxcontrib-htmlhelp": { + "hashes": [ + "sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07", + "sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2" + ], + "markers": "python_version >= '3.6'", + "version": "==2.0.0" + }, + "sphinxcontrib-jsmath": { + "hashes": [ + "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178", + "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.1" + }, + "sphinxcontrib-qthelp": { + "hashes": [ + "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72", + "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.3" + }, + "sphinxcontrib-serializinghtml": { + "hashes": [ + "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd", + "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952" + ], + "markers": "python_version >= '3.5'", + "version": "==1.1.5" + }, + "urllib3": { + "hashes": [ + "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed", + "sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", + "version": "==1.26.8" + }, + "zipp": { + "hashes": [ + "sha256:9f50f446828eb9d45b267433fd3e9da8d801f614129124863f9c51ebceafb87d", + "sha256:b47250dd24f92b7dd6a0a8fc5244da14608f3ca90a5efcd37a3b1642fac9a375" + ], + "markers": "python_version >= '3.7'", + "version": "==3.7.0" + } + } +} diff --git a/ctrlutils/__init__.py b/ctrlutils/__init__.py index 71557d0..b905314 100644 --- a/ctrlutils/__init__.py +++ b/ctrlutils/__init__.py @@ -3,3 +3,5 @@ from .ctrlutils import * from . import eigen + +__version__ = "1.3.0" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1f05f1e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +# [build-system] +# requires = ["setuptools", "wheel"] +# build-backend = "setuptools.build_meta:__legacy__" + +[tool.semantic_release] +branch = "main" +build_command = false +upload_to_repository = false +upload_to_release = false +version_variable = [ + "setup.py:__version__", + "ctrlutils/__init__.py:__version__", +] +version_pattern = [ + "CMakeLists.txt:VERSION {version}$", +] + +[tool.cibuildwheel] +skip = [ + "pp*", + "*-musllinux*", +] + +[tool.cibuildwheel.linux] +archs = ["auto64"] + +[tool.cibuildwheel.macos] +archs = ["universal2"] +environment = { CMAKE_OSX_ARCHITECTURES="arm64;x86_64", MACOSX_DEPLOYMENT_TARGET="10.14" } diff --git a/setup.py b/setup.py index deecc6a..439f64a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,13 @@ -import setuptools +import pathlib +import re +import shutil +import setuptools # type: ignore +from setuptools.command import build_ext # type: ignore import subprocess +import sys -from setuptools.command import build_ext + +__version__ = "1.3.0" class CMakeExtension(setuptools.Extension): @@ -11,8 +17,7 @@ def __init__(self, name): class CMakeBuild(build_ext.build_ext): def run(self): - import distutils - import re + from packaging import version # type: ignore if not self.inplace: try: @@ -23,7 +28,7 @@ def run(self): + ", ".join(e.name for e in self.extensions) ) - cmake_version = distutils.version.LooseVersion( + cmake_version = version.Version( re.search(r"version\s*([\d.]+)", out.decode()).group(1) ) if cmake_version < "3.13.0": @@ -35,12 +40,6 @@ def run(self): self.build_extension(extension) def build_extension(self, extension: setuptools.Extension): - import os - import pathlib - import re - import shutil - import sys - extension_dir = pathlib.Path(self.get_ext_fullpath(extension.name)).parent extension_dir.mkdir(parents=True, exist_ok=True) @@ -56,9 +55,9 @@ def build_extension(self, extension: setuptools.Extension): cmake_command = [ "cmake", "-B" + str(build_dir), + "-DBUILD_PYTHON=ON", "-DPYBIND11_PYTHON_VERSION=" + python_version, "-DCMAKE_BUILD_TYPE=" + build_type, - "-DBUILD_PYTHON=ON", ] if not self.inplace: # Use relative paths for install rpath. @@ -84,21 +83,20 @@ def build_extension(self, extension: setuptools.Extension): if not self.inplace: # Copy pybind11 library. ctrlutils_dir = str(extension_dir / "ctrlutils") - for file in os.listdir(build_dir / "src" / "python"): - if re.match(r".*\.(?:so|dylib)\.?", file) is not None: - file = str(build_dir / "src" / "python" / file) - shutil.move(file, ctrlutils_dir) + for file in (build_dir / "src" / "python").iterdir(): + if re.match(r".*\.(?:so|dylib)\.?", file.name) is not None: + shutil.move(str(file), ctrlutils_dir) # Copy C++ libraries. - for file in os.listdir(os.path.join("install", "lib")): - if re.match(r".*\.(?:so|dylib)\.?", file) is not None: - file = os.path.join("install", "lib", file) - shutil.move(file, ctrlutils_dir) + libdir = next(iter(pathlib.Path("install").glob("lib*"))) + for file in libdir.iterdir(): + if re.match(r".*\.(?:so|dylib)\.?", file.name) is not None: + shutil.move(str(file), ctrlutils_dir) setuptools.setup( name="ctrlutils", - version="1.4.0", + version=__version__, author="Toki Migimatsu", author_email="takatoki@cs.stanford.edu", description="Python ctrl-utils library", @@ -111,6 +109,7 @@ def build_extension(self, extension: setuptools.Extension): "Operating System :: OS Independent", ], python_requires=">=3.6", + setup_requires=["packaging"], ext_modules=[CMakeExtension("ctrlutils")], cmdclass={ "build_ext": CMakeBuild,