-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
167 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Build and deploy to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-13, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
|
||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel==2.18.1 | ||
|
||
- name: Build wheels | ||
run: python -m cibuildwheel --output-dir dist | ||
env: | ||
CIBW_SKIP: cp36-* cp37-* *musllinux* | ||
CIBW_BEFORE_ALL_LINUX: > | ||
yum install -y autoconf automake curl libtool pkgconfig sudo && | ||
git clone https://github.com/openvenues/libpostal && | ||
cd libpostal && | ||
git checkout tags/v1.1 && | ||
./bootstrap.sh && | ||
./configure --disable-data-download --disable-sse2 && | ||
make -j4 && | ||
sudo make install && | ||
sudo ldconfig && | ||
pkg-config --cflags libpostal && | ||
pkg-config --libs libpostal && | ||
pkg-config --cflags --libs libpostal | ||
CIBW_BEFORE_ALL_MACOS: > | ||
brew install autoconf automake curl libtool pkg-config && | ||
git clone https://github.com/openvenues/libpostal && | ||
cd libpostal && | ||
git checkout tags/v1.1 && | ||
./bootstrap.sh && | ||
./configure --disable-data-download --disable-sse2 && | ||
make -j4 && | ||
sudo make install && | ||
pkg-config --cflags libpostal && | ||
pkg-config --libs libpostal && | ||
pkg-config --cflags --libs libpostal | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./dist/*.whl | ||
|
||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist | ||
env: | ||
CIBW_BEFORE_ALL: > | ||
yum install -y autoconf automake curl libtool pkgconfig sudo && | ||
git clone https://github.com/openvenues/libpostal && | ||
cd libpostal && | ||
git checkout tags/v1.1 && | ||
./bootstrap.sh && | ||
./configure --disable-data-download --disable-sse2 && | ||
make -j4 && | ||
sudo make install && | ||
sudo ldconfig && | ||
pkg-config --cflags libpostal && | ||
pkg-config --libs libpostal && | ||
pkg-config --cflags --libs libpostal | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
|
||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build | ||
name: Build wheels | ||
|
||
on: [push, pull_request] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,11 @@ | ||
# pylibpostal | ||
# libpypostal | ||
|
||
Python wrapper for open-source libpostal project. Custom libary built internally due to lack of continued support for current Python wrapper libraries. | ||
|
||
## Usage | ||
|
||
### Install libpostal C library | ||
|
||
By default, libpostal will be installed when the Python package is installed, but without the data. | ||
|
||
The commands run to install are below. | ||
|
||
``` | ||
git clone https://github.com/openvenues/libpostal \ | ||
&& cd libpostal \ | ||
&& ./bootstrap.sh \ | ||
&& ./configure --datadir=/tmp/libpostal_data_files --disable-data-download --disable-sse2 \ | ||
&& make -j4 \ | ||
&& make install \ | ||
&& ldconfig | ||
``` | ||
|
||
- `--disable-data-download` disables downloading data when installing. | ||
- `--disable-sse2` required for Mac M1. | ||
- `ldconfig` only needed for linux. | ||
|
||
See https://github.com/openvenues/libpostal?tab=readme-ov-file#installation-maclinux for more details. | ||
|
||
### Downloading libpostal data | ||
|
||
``` | ||
libpostal_data download all <data-dir> | ||
``` | ||
|
||
## Contributing | ||
To test the project, run `poetry test`. Test files may live together with the code or in a separate | ||
directory, but in order for them to be discovered, they should end with `_test.py` | ||
(e.g. `pylibpostal/something_test.py` or `pylibpostal_test/something_test.py`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters