From 958da5e5e9ce71d1be7580e45bdb142b019a9791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Wed, 10 Jun 2020 08:47:01 +0100 Subject: [PATCH 1/8] Add Github action workflow to build Python wheels. --- .github/workflows/build-python-package.yml | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build-python-package.yml diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml new file mode 100644 index 000000000..0a610881a --- /dev/null +++ b/.github/workflows/build-python-package.yml @@ -0,0 +1,48 @@ +name: Build Python Package + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, macos-latest] + + steps: + - uses: actions/checkout@v1 + + - uses: actions/setup-python@v1 + name: Install Python + with: + python-version: '3.7' + + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==1.4.2 + + - name: Install build tools for OSX + if: startsWith(matrix.os, 'macos') + run: | + brew install automake + + - name: Build wheels on Linux + if: startsWith(matrix.os, 'macos') != true + env: + CIBW_BEFORE_BUILD: cd src/runtime/c && autoreconf -i && ./configure && make && make install + run: | + python -m cibuildwheel src/runtime/python --output-dir wheelhouse + + - name: Build wheels on OSX + if: startsWith(matrix.os, 'macos') + env: + CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && make install + run: | + python -m cibuildwheel src/runtime/python --output-dir wheelhouse + + - uses: actions/upload-artifact@v1 + with: + name: wheels + path: ./wheelhouse From 9ad7d25fb42b02fd06046fdde5c09088b9ab62eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Sun, 14 Jun 2020 12:13:29 +0100 Subject: [PATCH 2/8] Add upload to PyPI step. --- .github/workflows/build-python-package.yml | 50 ++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 0a610881a..5c48b0256 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -1,4 +1,4 @@ -name: Build Python Package +name: Build & Publish Python Package on: [push, pull_request] @@ -42,7 +42,51 @@ jobs: run: | python -m cibuildwheel src/runtime/python --output-dir wheelhouse - - uses: actions/upload-artifact@v1 + - uses: actions/upload-artifact@v2 with: - name: wheels path: ./wheelhouse + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.7' + + - name: Build sdist + run: cd src/runtime/python && python setup.py sdist + + - uses: actions/upload-artifact@v2 + with: + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install twine + run: pip install twine + + - uses: actions/download-artifact@v2 + with: + name: artifact + path: ./src/runtime/python/dist + + - name: Publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.pypi_password }} + working-directory: ./src/runtime/python + run: | + curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/ || twine upload --repository testpypi dist/* + # To test: repository_url: https://test.pypi.org/legacy/ \ No newline at end of file From 6f5e25d01d9729447322c312aa3a15050ee5c954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Sun, 14 Jun 2020 16:44:55 +0100 Subject: [PATCH 3/8] Bring back fail-fast. --- .github/workflows/build-python-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 5c48b0256..7935d553b 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -7,7 +7,7 @@ jobs: name: Build wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: [ubuntu-18.04, macos-latest] @@ -89,4 +89,3 @@ jobs: working-directory: ./src/runtime/python run: | curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/ || twine upload --repository testpypi dist/* - # To test: repository_url: https://test.pypi.org/legacy/ \ No newline at end of file From 866e91c9172a19e33f8a6c88136d0f21cb091d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Sun, 14 Jun 2020 16:48:39 +0100 Subject: [PATCH 4/8] Make sure sdist is included. --- .github/workflows/build-python-package.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 7935d553b..67272d701 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -62,13 +62,15 @@ jobs: - uses: actions/upload-artifact@v2 with: - path: dist/*.tar.gz + path: ./src/runtime/python/dist/*.tar.gz upload_pypi: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 + - name: Set up Python uses: actions/setup-python@v2 with: @@ -86,6 +88,5 @@ jobs: env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.pypi_password }} - working-directory: ./src/runtime/python run: | - curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/ || twine upload --repository testpypi dist/* + (cd ./src/runtime/python && curl -I --fail https://test.pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/) || twine upload --repository testpypi dist/* From 8d4eb9288acfcd236c1bdcbb5e05a13d7fe9f369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Sun, 14 Jun 2020 17:34:31 +0100 Subject: [PATCH 5/8] Remove references to live PyPI. --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 67272d701..138ad4f21 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -89,4 +89,4 @@ jobs: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | - (cd ./src/runtime/python && curl -I --fail https://test.pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/) || twine upload --repository testpypi dist/* + (cd ./src/runtime/python && curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/) || twine upload dist/* From 7abad1f4bf37efaf357e0c5b999ee1371f8fb479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?bc=C2=B2?= Date: Tue, 2 Jun 2020 20:54:15 -0300 Subject: [PATCH 6/8] in Fedora install instructions, use dnf dnf is the new yum, see https://fedoramagazine.org/5tftw-2014-06-10/ --- download/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download/index.md b/download/index.md index e1d3322c1..e6a1d39bc 100644 --- a/download/index.md +++ b/download/index.md @@ -114,7 +114,7 @@ automatically by cabal, and therefore need to be installed manually. Here is one way to do this: - On Ubuntu: `sudo apt-get install libghc-haskeline-dev` -- On Fedora: `sudo yum install ghc-haskeline-devel` +- On Fedora: `sudo dnf install ghc-haskeline-devel` **GHC version** From 3fe8c3109f0aa1b597c9e919c9eac7cad47675f3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 6 Jun 2020 18:15:50 +0200 Subject: [PATCH 7/8] (Homepage) Add new languages in list of RGL langs --- index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 7a3a202be..a14508a0a 100644 --- a/index.html +++ b/index.html @@ -332,9 +332,11 @@ least one, it may help you to get a first idea of what GF is. Afrikaans, Amharic (partial), Arabic (partial), + Basque (partial), Bulgarian, Catalan, Chinese, + Czech (partial), Danish, Dutch, English, @@ -346,10 +348,12 @@ least one, it may help you to get a first idea of what GF is. Greek modern, Hebrew (fragments), Hindi, + Hungarian (partial), Interlingua, - Japanese, Italian, - Latin (fragments), + Japanese, + Korean (partial), + Latin (partial), Latvian, Maltese, Mongolian, @@ -362,7 +366,9 @@ least one, it may help you to get a first idea of what GF is. Romanian, Russian, Sindhi, + Slovak (partial), Slovene (partial), + Somali (partial), Spanish, Swahili (fragments), Swedish, From 74f3f7a38479e50856e8f04cad53072d9b17603f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Sun, 14 Jun 2020 17:46:06 +0100 Subject: [PATCH 8/8] Update documentation. --- doc/gf-developers.t2t | 2 ++ download/index.md | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/doc/gf-developers.t2t b/doc/gf-developers.t2t index 74059199b..ed336b9a7 100644 --- a/doc/gf-developers.t2t +++ b/doc/gf-developers.t2t @@ -391,6 +391,8 @@ bindings are found in the ``src/runtime/python`` and ``src/runtime/java`` directories, respecively. Compile them by following the instructions in the ``INSTALL`` files in those directories. +The Python library can also be installed from PyPI using `pip install pgf`. + == Compilation of RGL == As of 2018-07-26, the RGL is distributed separately from the GF compiler and runtimes. diff --git a/download/index.md b/download/index.md index e6a1d39bc..44eb6db3c 100644 --- a/download/index.md +++ b/download/index.md @@ -171,6 +171,20 @@ in the RGL folder. This assumes that you already have GF installed. For more details about building the RGL, see the [RGL README](https://github.com/GrammaticalFramework/gf-rgl/blob/master/README.md). +## Installing the Python bindings from PyPI + +The Python library is available on PyPI as `pgf`, so it can be installed using: + +``` +pip install pgf +``` + +We provide binary wheels for Linux and OSX (with Windows missing so far), which +include the C runtime and a ready-to-go. If there is no binary distribution for +your platform, this will install the source tarball, which will attempt to build +the binding during installation, and requires the GF C runtime to be installed on +your system. + ## Older releases - [GF 3.9](index-3.9.html) (August 2017)