Skip to content

Commit

Permalink
Merge pull request #559 from YuukiToriyama/release/v0.2.0
Browse files Browse the repository at this point in the history
release/v0.2.0をmainブランチにマージ
  • Loading branch information
YuukiToriyama authored Dec 26, 2024
2 parents 47377a2 + d18699b commit 723009e
Show file tree
Hide file tree
Showing 33 changed files with 137 additions and 621 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/python-build-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
target: x86_64
args: --release --out dist --zig
working-directory: python
Expand All @@ -50,6 +51,7 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
target: x64
args: --release --out dist
working-directory: python
Expand All @@ -71,6 +73,7 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
target: aarch64
args: --release --out dist
working-directory: python
Expand All @@ -89,6 +92,7 @@ jobs:
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
command: sdist
args: --out dist
working-directory: python
5 changes: 5 additions & 0 deletions .github/workflows/upload-pypi-org.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
target: ${{ matrix.platform.target }}
args: --release --out dist --zig
working-directory: python
Expand Down Expand Up @@ -67,6 +68,7 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
target: ${{ matrix.platform.target }}
args: --release --out dist
working-directory: python
Expand Down Expand Up @@ -94,6 +96,7 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
target: ${{ matrix.platform.target }}
args: --release --out dist
working-directory: python
Expand All @@ -111,6 +114,7 @@ jobs:
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.7.8
command: sdist
args: --out dist
working-directory: python
Expand All @@ -133,5 +137,6 @@ jobs:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
MATURIN_REPOSITORY: "pypi" # test.pypi.orgにアップロードする際は"testpypi"を設定する
with:
maturin-version: 1.7.8
command: upload
args: --non-interactive --skip-existing wheels-*/*
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

マイナーバージョンアップやメジャーバージョンアップの際に発生する破壊的変更についてこのファイルに記載します。
それ以外の変更については[リリースノート](https://github.com/YuukiToriyama/japanese-address-parser/releases)を参照ください。

## v0.2.0

### 非推奨に指定していたモジュール、関数を削除しました([#532](https://github.com/YuukiToriyama/japanese-address-parser/pull/532))。

- `japanese_address_parser::parser::parse``japanese_address_parser::parser::parse_blocking`を使用しているコードは動かなくなります。
`japanese_address_parser::parser::Parser`の使用を検討してください。
- また、`japanese_address_parser::entity::Address``japanese_address_parser::domain::geolonia::Address`に移動しました。
そのままだと動かないので、use文を修正してください。
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ members = [
resolver = "2"

[workspace.package]
version = "0.1.24"
version = "0.2.0"
edition = "2021"
description = "A Rust Library to parse japanese addresses."
description = "A library for processing addresses of Japan"
repository = "https://github.com/YuukiToriyama/japanese-address-parser"
authors = ["Yuuki Toriyama <[email protected]>"]
license = "MIT"
Expand All @@ -19,8 +19,8 @@ categories = ["parser-implementations", "wasm"]

[workspace.dependencies]
log = "0.4.22"
serde = { version = "1.0.192", features = ["derive"] }
tokio = { version = "1.38.0", features = ["rt", "macros"] }
wasm-bindgen = "0.2.92"
wasm-bindgen-futures = "0.4.42"
wasm-bindgen-test = "0.3.42"
serde = { version = "1.0.215", features = ["derive"] }
tokio = { version = "1.41.1", features = ["rt", "macros"] }
wasm-bindgen = "0.2.97"
wasm-bindgen-futures = "0.4.47"
wasm-bindgen-test = "0.3.47"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 ToriChan
Copyright (c) 2023-2024 Yuuki Toriyama

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Add the following to your `Cargo.toml`.

```toml
[dependencies]
japanese-address-parser = "0.1"
japanese-address-parser = "0.2"
```

### Async Version
Expand Down
14 changes: 6 additions & 8 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@ eliminate-whitespaces = []
experimental = []

[dependencies]
itertools = "0.13.0" # 互換性のために残してあるが、`core::parser::adapter`を削除する際に忘れずに削除する
log.workspace = true
rapidfuzz = "0.5.0"
regex = { version = "1.10.6", default-features = false, features = ["std", "unicode-perl"] }
regex = { version = "1.11.1", default-features = false, features = ["std", "unicode-perl"] }
serde.workspace = true
reqwest = { version = "0.12.5", default-features = false, features = ["json", "rustls-tls"] }
js-sys = "0.3.67"
thiserror = "1.0.63"
jisx0401 = "0.1.0-beta.3"
reqwest = { version = "0.12.9", default-features = false, features = ["json", "rustls-tls"] }
js-sys = "0.3.74"
thiserror = "2.0.3"
jisx0401 = "0.1.1"

[dev-dependencies]
criterion = { version = "0.5.1", default-features = false, features = ["html_reports"] }
tokio.workspace = true
wasm-bindgen-test = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
mockito = "1.4.0" # mockitoがwasm32に対応していないため
mockito = "1.6.1" # mockitoがwasm32に対応していないため

[package.metadata.docs.rs]
all-features = true
Expand Down
18 changes: 18 additions & 0 deletions core/src/adapter/orthographical_variant_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub enum OrthographicalVariant {
,
,
,
,
,
,
,
Expand All @@ -28,6 +29,14 @@ pub enum OrthographicalVariant {
,
,
,
,
,
,
,
,
,
,
,
}

impl OrthographicalVariant {
Expand All @@ -43,6 +52,7 @@ impl OrthographicalVariant {
OrthographicalVariant::竈 => &['竈', '竃', '釜'],
OrthographicalVariant::嶋 => &['嶋', '島'],
OrthographicalVariant::舘 => &['舘', '館'],
OrthographicalVariant::鰺 => &['鰺', '鯵'],
OrthographicalVariant::脊 => &['脊', '背'],
OrthographicalVariant::渕 => &['渕', '淵'],
OrthographicalVariant::己 => &['己', '巳'],
Expand All @@ -61,6 +71,14 @@ impl OrthographicalVariant {
OrthographicalVariant::濱 => &['濱', '浜'],
OrthographicalVariant::祗 => &['祗', '祇'],
OrthographicalVariant::曾 => &['曾', '曽'],
OrthographicalVariant::國 => &['國', '国'],
OrthographicalVariant::鉋 => &['鉋', '飽'],
OrthographicalVariant::鷆 => &['鷆', '鷏'],
OrthographicalVariant::斑 => &['斑', '班'],
OrthographicalVariant::櫻 => &['櫻', '桜'],
OrthographicalVariant::櫟 => &['櫟', '擽'],
OrthographicalVariant::冨 => &['冨', '富'],
OrthographicalVariant::諫 => &['諫', '諌'],
}
}

Expand Down
47 changes: 0 additions & 47 deletions core/src/api.rs

This file was deleted.

4 changes: 2 additions & 2 deletions core/src/domain.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(feature = "experimental")]
pub mod chimei_ruiju;
pub mod common;
pub(crate) mod chimei_ruiju;
pub(crate) mod common;
pub mod geolonia;
46 changes: 15 additions & 31 deletions core/src/domain/geolonia/entity.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
use serde::{Deserialize, Serialize};

#[derive(Deserialize, PartialEq, Debug)]
pub struct Prefecture {
pub(crate) struct Prefecture {
pub name: String,
pub cities: Vec<String>,
}

impl Prefecture {
// 主にテストコードで使用する
pub fn new(prefecture_name: &str, city_names: Vec<&str>) -> Self {
Prefecture {
name: prefecture_name.to_string(),
cities: city_names.iter().map(|s| s.to_string()).collect(),
}
}
}

#[derive(Debug)]
pub struct City {
pub(crate) struct City {
#[allow(dead_code)]
pub name: String,
pub towns: Vec<Town>,
}

#[derive(PartialEq, Deserialize, Debug)]
pub struct Town {
pub(crate) struct Town {
#[serde(alias = "town")]
pub name: String,
pub koaza: String,
Expand All @@ -32,18 +23,6 @@ pub struct Town {
pub lng: Option<f32>,
}

impl Town {
// 主にテストコードで使用する
pub fn new(town_name: &str, koaza_name: &str, lat: f32, lng: f32) -> Self {
Town {
name: town_name.to_string(),
koaza: koaza_name.to_string(),
lat: Some(lat),
lng: Some(lng),
}
}
}

#[derive(Serialize, PartialEq, Debug)]
pub struct Address {
pub prefecture: String,
Expand All @@ -53,7 +32,12 @@ pub struct Address {
}

impl Address {
pub fn new(prefecture_name: &str, city_name: &str, town_name: &str, rest_name: &str) -> Self {
pub(crate) fn new(
prefecture_name: &str,
city_name: &str,
town_name: &str,
rest_name: &str,
) -> Self {
Address {
prefecture: prefecture_name.to_string(),
city: city_name.to_string(),
Expand All @@ -63,10 +47,10 @@ impl Address {
}
}

#[doc(hidden)]
#[cfg(test)]
impl Prefecture {
/// only for testing
pub fn yamagata() -> Self {
pub(crate) fn yamagata() -> Self {
Prefecture {
name: "山形県".to_string(),
cities: vec![
Expand Down Expand Up @@ -110,7 +94,7 @@ impl Prefecture {
}

/// only for testing
pub fn fukushima() -> Self {
pub(crate) fn fukushima() -> Self {
Prefecture {
name: "福島県".to_string(),
cities: vec![
Expand Down Expand Up @@ -178,7 +162,7 @@ impl Prefecture {
}

/// only for testing
pub fn fukui() -> Self {
pub(crate) fn fukui() -> Self {
Prefecture {
name: "福井県".to_string(),
cities: vec![
Expand All @@ -204,7 +188,7 @@ impl Prefecture {
}

/// only for testing
pub fn saga() -> Self {
pub(crate) fn saga() -> Self {
Prefecture {
name: "佐賀県".to_string(),
cities: vec![
Expand Down
8 changes: 4 additions & 4 deletions core/src/domain/geolonia/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ pub struct Error {
}

impl Error {
pub fn new_parse_error(parse_error_kind: ParseErrorKind) -> Self {
pub(crate) fn new_parse_error(parse_error_kind: ParseErrorKind) -> Self {
Error {
error_type: "ParseError".to_string(),
error_message: parse_error_kind.to_string(),
}
}
pub fn new_api_error(api_error_kind: ApiErrorKind) -> Self {
pub(crate) fn new_api_error(api_error_kind: ApiErrorKind) -> Self {
let error_message = match api_error_kind {
ApiErrorKind::Fetch(url) => format!("{}を取得できませんでした", url),
ApiErrorKind::Deserialize(url) => format!("{}のデシリアライズに失敗しました", url),
Expand All @@ -27,7 +27,7 @@ impl Error {
}
}

pub enum ParseErrorKind {
pub(crate) enum ParseErrorKind {
Prefecture,
City,
Town,
Expand All @@ -44,7 +44,7 @@ impl Display for ParseErrorKind {
}
}

pub enum ApiErrorKind {
pub(crate) enum ApiErrorKind {
Fetch(String),
Deserialize(String),
}
Loading

0 comments on commit 723009e

Please sign in to comment.