-
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.
Merge pull request #206 from YuukiToriyama/release/v0.1.0-beta.11
release/v0.1.0-beta.11をmainブランチにマージ
- Loading branch information
Showing
10 changed files
with
384 additions
and
4 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,66 @@ | ||
name: Python module build check | ||
|
||
on: | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: x86_64 | ||
args: --release --out dist --zig | ||
working-directory: python | ||
sccache: 'true' | ||
manylinux: auto | ||
|
||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: x64 | ||
args: --release --out dist | ||
working-directory: python | ||
sccache: 'true' | ||
|
||
macos: | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: aarch64 | ||
args: --release --out dist | ||
working-directory: python | ||
sccache: 'true' | ||
|
||
sdist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build sdist | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
command: sdist | ||
args: --out dist | ||
working-directory: python |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ on: | |
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: crates-io | ||
defaults: | ||
run: | ||
working-directory: core | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: Upload artifact to pypi.org | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
linux: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: ubuntu-latest | ||
target: x86_64 | ||
- runner: ubuntu-latest | ||
target: x86 | ||
- runner: ubuntu-latest | ||
target: aarch64 | ||
- runner: ubuntu-latest | ||
target: armv7 | ||
- runner: ubuntu-latest | ||
target: s390x | ||
- runner: ubuntu-latest | ||
target: ppc64le | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --zig | ||
working-directory: python | ||
sccache: 'true' | ||
manylinux: auto | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-linux-${{ matrix.platform.target }} | ||
path: python/dist | ||
|
||
windows: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: windows-latest | ||
target: x64 | ||
- runner: windows-latest | ||
target: x86 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
architecture: ${{ matrix.platform.target }} | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist | ||
working-directory: python | ||
sccache: 'true' | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-windows-${{ matrix.platform.target }} | ||
path: python/dist | ||
|
||
macos: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: macos-latest | ||
target: x86_64 | ||
- runner: macos-14 | ||
target: aarch64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist | ||
working-directory: python | ||
sccache: 'true' | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-macos-${{ matrix.platform.target }} | ||
path: python/dist | ||
|
||
sdist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build sdist | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
command: sdist | ||
args: --out dist | ||
working-directory: python | ||
- name: Upload sdist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-sdist | ||
path: python/dist | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
environment: pypi | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
needs: [linux, windows, macos, sdist] | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- name: Publish to PyPI | ||
uses: PyO3/maturin-action@v1 | ||
env: | ||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
MATURIN_REPOSITORY: "pypi" # test.pypi.orgにアップロードする際は"testpypi"を設定する | ||
with: | ||
command: upload | ||
args: --non-interactive --skip-existing wheels-*/* |
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
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,20 @@ | ||
[package] | ||
name = "python" | ||
version.workspace = true | ||
edition.workspace = true | ||
description.workspace = true | ||
repository.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
readme = "README.md" | ||
keywords.workspace = true | ||
categories.workspace = true | ||
|
||
[lib] | ||
name = "japanese_address_parser_py" | ||
path = "src/lib.rs" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
japanese-address-parser = { path = "../core" } | ||
pyo3 = { version = "0.21.0", features = ["abi3-py37"] } |
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,94 @@ | ||
# japanese-address-parser-py | ||
A python toolkit for processing japanese addresses | ||
|
||
[![PyPI - Version](https://img.shields.io/pypi/v/japanese-address-parser-py)](https://pypi.org/project/japanese-address-parser-py/) | ||
[![PyPI - Downloads](https://img.shields.io/pypi/dm/japanese-address-parser-py)](https://pypi.org/project/japanese-address-parser-py/#history) | ||
[![Unit test & Code check](https://github.com/YuukiToriyama/japanese-address-parser/actions/workflows/code-check.yaml/badge.svg)](https://github.com/YuukiToriyama/japanese-address-parser/actions/workflows/code-check.yaml) | ||
|
||
## What is it? | ||
**japanese-address-parser-py** is a Python package for parsing japanese addresses. | ||
Any address can be processed into structured data. | ||
|
||
## Installation from PyPI | ||
```bash | ||
pip install japanese-address-parser-py | ||
``` | ||
|
||
## Usage | ||
|
||
```python | ||
import japanese_address_parser_py | ||
|
||
address_list = [ | ||
"埼玉県さいたま市浦和区高砂3-15-1", | ||
"千葉県千葉市中央区市場町1-1", | ||
"東京都新宿区西新宿2-8-1", | ||
"神奈川県横浜市中区日本大通1" | ||
] | ||
for address in address_list: | ||
parse_result = japanese_address_parser_py.parse(address) | ||
print(parse_result.address) | ||
``` | ||
|
||
```text | ||
{'prefecture': '埼玉県', 'town': '高砂三丁目', 'rest': '15-1', 'city': 'さいたま市浦和区'} | ||
{'rest': '1-1', 'town': '市場町', 'prefecture': '千葉県', 'city': '千葉市中央区'} | ||
{'prefecture': '東京都', 'rest': '8-1', 'town': '西新宿二丁目', 'city': '新宿区'} | ||
{'town': '日本大通', 'city': '横浜市中区', 'prefecture': '神奈川県', 'rest': '1'} | ||
``` | ||
|
||
|
||
```python | ||
import japanese_address_parser_py | ||
|
||
address = "神奈川県横浜市中区本町6丁目50-10" | ||
parse_result = japanese_address_parser_py.parse(address) | ||
print(parse_result.address["prefecture"]) | ||
print(parse_result.address["city"]) | ||
print(parse_result.address["town"]) | ||
print(parse_result.address["rest"]) | ||
``` | ||
|
||
```text | ||
神奈川県 | ||
横浜市中区 | ||
本町六丁目 | ||
50-10 | ||
``` | ||
|
||
## Development | ||
This library is written in Rust language. You need to set up a Rust development environment to build this library. | ||
Also, you need to install `maturin` because this library uses it in order to generate Python bindings. | ||
|
||
```bash | ||
# Install maturin | ||
cargo install --locked maturin | ||
# Clone repository | ||
git clone https://github.com/YuukiToriyama/japanese-address-parser.git | ||
# Build python module | ||
cd japanse-address-parser/python | ||
maturin build --release --out dist --find-interpreter | ||
# Install the built library | ||
python3 -m venv .venv | ||
pip3 install dist/japanese_address_parser_py-[version]-cp37-abi3-[arch].whl | ||
``` | ||
|
||
## Support | ||
|
||
This software is maintained by [YuukiToriyama](https://github.com/yuukitoriyama). | ||
If you have questions, please create an issue. | ||
|
||
## Where to get source code | ||
The source code is hosted on GitHub at: | ||
https://github.com/YuukiToriyama/japanese-address-parser | ||
|
||
## Acknowledgements | ||
|
||
This software was developed inspired | ||
by [@geolonia/normalize-japanese-addresses](https://github.com/geolonia/normalize-japanese-addresses). | ||
Also, the parsing process uses [Geolonia 住所データ](https://github.com/geolonia/japanese-addresses) provided | ||
by [株式会社Geolonia](https://www.geolonia.com/company/). | ||
|
||
## License | ||
|
||
This crate is distributed under the terms of the MIT license. |
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,14 @@ | ||
[build-system] | ||
requires = ["maturin>=1.5,<2.0"] | ||
build-backend = "maturin" | ||
|
||
[project] | ||
name = "japanese-address-parser-py" | ||
keywords = ["converter", "utility", "geo", "rust"] | ||
classifiers = [ | ||
"Topic :: Text Processing", | ||
"Programming Language :: Rust" | ||
] | ||
|
||
[tool.maturin] | ||
features = ["pyo3/extension-module"] |
Oops, something went wrong.