annofabapi-3dpc-extensions 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,40 +1,39 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: annofabapi-3dpc-extensions
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: annofabapiの3DPC Editor用の拡張機能です。
5
5
  Home-page: https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions
6
- Author: yuji38kwmt
7
- Requires-Python: >=3.7,<4.0
6
+ Author: Kurusugawa Computer Inc.
7
+ Requires-Python: >=3.8,<4.0
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Operating System :: OS Independent
12
- Classifier: Programming Language :: Python
13
11
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.7
17
12
  Classifier: Programming Language :: Python :: 3.8
18
13
  Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
19
17
  Classifier: Topic :: Utilities
20
18
  Requires-Dist: dataclasses-json
21
- Requires-Dist: numpy
19
+ Requires-Dist: numpy (<1.25) ; python_version == "3.8"
20
+ Requires-Dist: numpy (>=1.26) ; python_version >= "3.9"
22
21
  Project-URL: Repository, https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions
23
22
  Description-Content-Type: text/markdown
24
23
 
25
24
  # annofabapi-3dpc-extensions
26
- [![Build Status](https://travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions.svg?branch=master)](https://travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions)
25
+ [![Build Status](https://app.travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions.svg?branch=main)](https://app.travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions)
27
26
  [![PyPI version](https://badge.fury.io/py/annofabapi-3dpc-extensions.svg)](https://badge.fury.io/py/annofabapi-3dpc-extensions)
28
27
  [![Python Versions](https://img.shields.io/pypi/pyversions/annofabapi-3dpc-extensions.svg)](https://pypi.org/project/annofabapi-3dpc-extensions/)
29
28
  [![Documentation Status](https://readthedocs.org/projects/annofabapi-3dpc-extensions/badge/?version=latest)](https://annofabapi-3dpc-extensions.readthedocs.io/en/latest/?badge=latest)
30
29
 
31
30
 
32
31
 
33
- [annofabapi](https://github.com/kurusugawa-computer/annofab-api-python-client)の3DPC(3D Point Cloud) Editor用の拡張機能です。
32
+ [annofabapi](https://github.com/kurusugawa-computer/annofab-api-python-client)の3次元アノテーション用の拡張機能です。
34
33
 
35
34
  # Install
36
35
 
37
- * Python 3.7+
36
+ * Python 3.8+
38
37
 
39
38
  # Install
40
39
 
@@ -91,6 +90,13 @@ with parser.open_outer_file(Path(segment_annotation_data.data_uri).name) as f:
91
90
  segment_data = SegmentData.from_dict(dict_segmenta_data)
92
91
  assert type(segment_data) == SegmentData
93
92
  assert len(segment_data.points) > 0
93
+ print(segment_data.points)
94
+ # => [130439, 130442, ... ]
94
95
 
95
96
  ```
96
97
 
98
+
99
+ # 開発者向けドキュメント
100
+
101
+ https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions/blob/main/README_for_developer.md 参照
102
+
@@ -1,16 +1,16 @@
1
1
  # annofabapi-3dpc-extensions
2
- [![Build Status](https://travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions.svg?branch=master)](https://travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions)
2
+ [![Build Status](https://app.travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions.svg?branch=main)](https://app.travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions)
3
3
  [![PyPI version](https://badge.fury.io/py/annofabapi-3dpc-extensions.svg)](https://badge.fury.io/py/annofabapi-3dpc-extensions)
4
4
  [![Python Versions](https://img.shields.io/pypi/pyversions/annofabapi-3dpc-extensions.svg)](https://pypi.org/project/annofabapi-3dpc-extensions/)
5
5
  [![Documentation Status](https://readthedocs.org/projects/annofabapi-3dpc-extensions/badge/?version=latest)](https://annofabapi-3dpc-extensions.readthedocs.io/en/latest/?badge=latest)
6
6
 
7
7
 
8
8
 
9
- [annofabapi](https://github.com/kurusugawa-computer/annofab-api-python-client)の3DPC(3D Point Cloud) Editor用の拡張機能です。
9
+ [annofabapi](https://github.com/kurusugawa-computer/annofab-api-python-client)の3次元アノテーション用の拡張機能です。
10
10
 
11
11
  # Install
12
12
 
13
- * Python 3.7+
13
+ * Python 3.8+
14
14
 
15
15
  # Install
16
16
 
@@ -67,5 +67,12 @@ with parser.open_outer_file(Path(segment_annotation_data.data_uri).name) as f:
67
67
  segment_data = SegmentData.from_dict(dict_segmenta_data)
68
68
  assert type(segment_data) == SegmentData
69
69
  assert len(segment_data.points) > 0
70
+ print(segment_data.points)
71
+ # => [130439, 130442, ... ]
70
72
 
71
73
  ```
74
+
75
+
76
+ # 開発者向けドキュメント
77
+
78
+ https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions/blob/main/README_for_developer.md 参照
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2" # `poetry-dynamic-versioning`を使ってGitHubのバージョンタグを取得している。変更不要
@@ -19,14 +19,14 @@ class Location(DataClassJsonMixin):
19
19
  y: float
20
20
  z: float
21
21
 
22
- def __add__(self, other):
22
+ def __add__(self, other: "Location") -> "Location":
23
23
  return self.__class__(
24
24
  x=self.x + other.x,
25
25
  y=self.y + other.y,
26
26
  z=self.z + other.z,
27
27
  )
28
28
 
29
- def __sub__(self, other):
29
+ def __sub__(self, other: "Location") -> "Location":
30
30
  return self.__class__(
31
31
  x=self.x - other.x,
32
32
  y=self.y - other.y,
@@ -51,10 +51,10 @@ class _Quaternion:
51
51
  https://github.com/KieranWynn/pyquaternion/blob/99025c17bab1c55265d61add13375433b35251af/pyquaternion/quaternion.py#L138
52
52
  """
53
53
 
54
- def __init__(self, array: Union[Sequence[float], numpy.ndarray]):
54
+ def __init__(self, array: Union[Sequence[float], numpy.ndarray]) -> None:
55
55
  self.q = numpy.array(array)
56
56
 
57
- def _q_matrix(self):
57
+ def _q_matrix(self) -> numpy.ndarray:
58
58
  """Matrix representation of quaternion for multiplication purposes."""
59
59
  return numpy.array(
60
60
  [
@@ -65,7 +65,7 @@ class _Quaternion:
65
65
  ]
66
66
  )
67
67
 
68
- def _q_bar_matrix(self):
68
+ def _q_bar_matrix(self) -> numpy.ndarray:
69
69
  """Matrix representation of quaternion for multiplication purposes."""
70
70
  return numpy.array(
71
71
  [
@@ -77,13 +77,13 @@ class _Quaternion:
77
77
  )
78
78
 
79
79
  @property
80
- def rotation_matrix(self):
80
+ def rotation_matrix(self) -> numpy.ndarray:
81
81
  """Get the 3x3 rotation matrix equivalent of the quaternion rotation.
82
82
  Returns:
83
83
  A 3x3 orthogonal rotation matrix as a 3x3 Numpy array
84
84
  Note:
85
- This feature only makes sense when referring to a unit quaternion. Calling this method will implicitly normalise the Quaternion object to a unit quaternion if it is not already one. # noqa: E501
86
- """
85
+ This feature only makes sense when referring to a unit quaternion. Calling this method will implicitly normalise the Quaternion object to a unit quaternion if it is not already one.
86
+ """ # noqa: E501
87
87
  product_matrix = numpy.dot(self._q_matrix(), self._q_bar_matrix().conj().transpose())
88
88
  return product_matrix[1:][:, 1:]
89
89
 
@@ -298,7 +298,7 @@ class CuboidAnnotationDetailDataV1(DataClassJsonMixin):
298
298
  return {"data": str_data, "_type": ANNOTATION_TYPE_UNKNOWN}
299
299
 
300
300
 
301
- def convert_annotation_detail_data(dict_data: Dict[str, Any]) -> Any:
301
+ def convert_annotation_detail_data(dict_data: Dict[str, Any]) -> Any: # noqa: ANN401
302
302
  """
303
303
  SimpleAnnotationDetailクラスのdict型であるdataプロパティを、3DPC Editor用のDataclassに変換します。
304
304
  3DPC Editor用のDataclassに変換できない場合は、引数をそのまま返します。
@@ -0,0 +1,125 @@
1
+ [tool.poetry]
2
+ name = "annofabapi-3dpc-extensions"
3
+ version = "0.2.2" # `poetry-dynamic-versioning`を使ってGitHubのバージョンタグを取得している。変更不要
4
+ description = "annofabapiの3DPC Editor用の拡張機能です。"
5
+ authors = ["Kurusugawa Computer Inc."]
6
+ packages = [
7
+ { include = "annofab_3dpc" }
8
+ ]
9
+ readme="README.md"
10
+ repository="https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions"
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Intended Audience :: Developers",
14
+ "Topic :: Utilities",
15
+ "Operating System :: OS Independent",
16
+ ]
17
+
18
+ [tool.poetry.dependencies]
19
+ python = "^3.8"
20
+ dataclasses-json="*"
21
+
22
+ # Pythonバージョンでnumpyのバージョンを変えている理由
23
+ # https://qiita.com/yuji38kwmt/items/7ce857bb8698536bfa36
24
+ numpy = [
25
+ {version = ">=1.26", python = ">=3.9"},
26
+ {version = "<1.25", python = "=3.8"}
27
+ ]
28
+
29
+
30
+ [tool.poetry.group.test.dependencies]
31
+ pytest = "^7"
32
+ pytest-xdist = "*"
33
+ # テストコードで利用するため
34
+ annofabapi = ">=0.47.0"
35
+
36
+
37
+ [tool.poetry.group.linter.dependencies]
38
+ # pythonバージョンを指定している理由:Python3.11(開発環境)でしかlintを実行していないため
39
+ ruff = {version="^0.2", python=">=3.11"}
40
+ mypy = {version="^1", python=">=3.11"}
41
+ pylint = {version="^3", python=">=3.11"}
42
+
43
+
44
+ [tool.poetry.group.documentation.dependencies]
45
+ # ドキュメント生成用のライブラリ
46
+ # `python=">=3.11"`を指定している理由:Pytyhon3.11を利用している開発環境かReadTheDocsでしかドキュメントを生成しないため
47
+ sphinx = {version="^7", python=">=3.11"}
48
+ pydata-sphinx-theme = {version=">=0.13", python=">=3.11"}
49
+
50
+
51
+ [tool.mypy]
52
+ ignore_missing_imports = true
53
+
54
+ check_untyped_defs = true
55
+
56
+ plugins = "numpy.typing.mypy_plugin"
57
+
58
+ [tool.ruff]
59
+ target-version = "py38"
60
+ line-length = 120
61
+
62
+
63
+ [tool.ruff.lint]
64
+ ignore = [
65
+ "G004", # `logging-f-string` : loggingでf-stringを使いたいので無視する
66
+ "PD901", #すでに`df`という変数をいろんなところで使っているため
67
+ "PD002", #すでにpandasで`inplace=True`はいろんなところで使っているため
68
+ "RUF001", # 全角記号など`ambiguous unicode character`も使いたいため
69
+ "RUF002",# 全角記号など`ambiguous unicode character`も使いたいため
70
+ "RUF003",# 全角記号など`ambiguous unicode character`も使いたいため
71
+ "PLC1901", # compare-to-empty-string : `if a == "`のように空文字列で直接比較したいときがあるため
72
+ "PLR2004", # magic-value-comparison: listのサイズで判定するときがよくあるため
73
+ "ANN101", # missing-type-self: 引数selfには型ヒントは付けていないため
74
+ "ANN102", # missing-type-cls: 引数clsには型ヒントは付けていないため
75
+ "ERA", # : 役立つこともあるが、コメントアウトしていないコードも警告されるので無視する
76
+ "PERF203", # try-except-in-loop: ループ内でtry-exceptを使うこともあるため無視する。
77
+ "FIX", # TODOやFIXMEを使うため無視する
78
+ "TD", # TODOコメントの書き方に気にしていないので無視する
79
+
80
+ # 以下のルールはannofabcliのコードに合っていないので無効化した
81
+ "RSE", # flake8-raise
82
+ "D", # pydocstyle, Docstringを中途半端にしか書いていないので、除外する
83
+ "C90", # mccabe
84
+ "T20", # flake8-print
85
+ "SLF", # flake8-self
86
+ "BLE", # flake8-blind-except
87
+ "FBT", # flake8-boolean-trap
88
+ "TRY", # tryceratops
89
+ "COM", # flake8-commas
90
+ "S", # flake8-bandit
91
+ "EM",#flake8-errmsg
92
+ "EXE", # flake8-executable
93
+ "ICN", # flake8-import-conventions
94
+ "RET",#flake8-return
95
+ "SIM",#flake8-simplify
96
+ "TCH", # flake8-type-checking
97
+ "PTH", #pathlibを使わないコードが多いので、除外する
98
+ "ISC", #flake8-implicit-str-concat
99
+ "N", # pep8-naming
100
+ "PT", # flake8-pytest-style
101
+ ]
102
+
103
+ select = [
104
+ "ALL"
105
+ ]
106
+
107
+ [tool.ruff.lint.pydocstyle]
108
+ convention = "google"
109
+
110
+ [tool.ruff.lint.pyupgrade]
111
+ # Python3.8をサポートしているため、`typing.List`などの型ヒントは警告しないようにする
112
+ # https://beta.ruff.rs/docs/settings/#keep-runtime-typing
113
+ keep-runtime-typing = true
114
+
115
+ [tool.ruff.lint.pylint]
116
+ max-args = 10
117
+
118
+ [tool.poetry-dynamic-versioning]
119
+ enable = false
120
+ format = "{base}"
121
+
122
+ [build-system]
123
+ requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
124
+ build-backend = "poetry_dynamic_versioning.backend"
125
+
@@ -1 +0,0 @@
1
- __version__ = "0.2.0"
@@ -1,73 +0,0 @@
1
- [tool.poetry]
2
- name = "annofabapi-3dpc-extensions"
3
- version = "0.2.0"
4
- description = "annofabapiの3DPC Editor用の拡張機能です。"
5
- authors = ["yuji38kwmt"]
6
- packages = [
7
- { include = "annofab_3dpc" }
8
- ]
9
- readme="README.md"
10
- repository="https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions"
11
- classifiers = [
12
- "Development Status :: 4 - Beta",
13
- "Intended Audience :: Developers",
14
- "License :: OSI Approved :: MIT License",
15
- "Programming Language :: Python",
16
- "Programming Language :: Python :: 3 :: Only",
17
- "Programming Language :: Python :: 3.7",
18
- "Programming Language :: Python :: 3.8",
19
- "Programming Language :: Python :: 3.9",
20
- "Topic :: Utilities",
21
- "Operating System :: OS Independent",
22
- ]
23
-
24
- [tool.poetry.dependencies]
25
- python = "^3.7"
26
- dataclasses-json="*"
27
- numpy = "*"
28
-
29
- [tool.poetry.dev-dependencies]
30
- # テストコードで利用するため
31
- annofabapi = ">=0.47.0"
32
-
33
- # test library
34
- pytest = "*"
35
- pytest-xdist = "*"
36
- pytest-cov = "*"
37
-
38
- # format library
39
- isort = "*" # import文をsortするために利用する
40
- autoflake = "*" # 未使用のimport文を削除するために利用する
41
- black = "*"
42
-
43
- # lint library
44
- flake8 = "*"
45
- mypy = "*"
46
- pylint = "*"
47
-
48
- # document library
49
- sphinx = "*"
50
- docutils = "*"
51
- # pandasのdocumentationページに近いレイアウトにするためのパッケージ
52
- pydata-sphinx-theme = "*"
53
-
54
-
55
-
56
- [tool.black]
57
- line-length = 120
58
-
59
- [tool.isort]
60
- profile = "black"
61
- line_length = 120
62
- # `__init__.py`の順番が変わるとエラーになる可能性があるので、スキップする
63
- skip="annofab_3dpc/__init__.py"
64
-
65
- [tool.mypy]
66
- # スタブが無いパッケージのエラーは無視させる.サードパーティのライブラリに型情報がないケースもあるため
67
- ignore_missing_imports = true
68
-
69
- [build-system]
70
- requires = ["poetry>=0.12"]
71
- build-backend = "poetry.masonry.api"
72
-
73
-
@@ -1,30 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['annofab_3dpc']
6
-
7
- package_data = \
8
- {'': ['*']}
9
-
10
- install_requires = \
11
- ['dataclasses-json', 'numpy']
12
-
13
- setup_kwargs = {
14
- 'name': 'annofabapi-3dpc-extensions',
15
- 'version': '0.2.0',
16
- 'description': 'annofabapiの3DPC Editor用の拡張機能です。',
17
- 'long_description': '# annofabapi-3dpc-extensions\n[![Build Status](https://travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions.svg?branch=master)](https://travis-ci.com/kurusugawa-computer/annofabapi-3dpc-extensions)\n[![PyPI version](https://badge.fury.io/py/annofabapi-3dpc-extensions.svg)](https://badge.fury.io/py/annofabapi-3dpc-extensions)\n[![Python Versions](https://img.shields.io/pypi/pyversions/annofabapi-3dpc-extensions.svg)](https://pypi.org/project/annofabapi-3dpc-extensions/)\n[![Documentation Status](https://readthedocs.org/projects/annofabapi-3dpc-extensions/badge/?version=latest)](https://annofabapi-3dpc-extensions.readthedocs.io/en/latest/?badge=latest)\n\n\n\n[annofabapi](https://github.com/kurusugawa-computer/annofab-api-python-client)の3DPC(3D Point Cloud) Editor用の拡張機能です。\n\n# Install\n\n* Python 3.7+\n\n# Install\n\n```\n$ pip install annofabapi-3dpc-extensions\n```\n\n\n# Usage\n\ncuboidアノテーションやセグメントアノテーションに対応したデータクラスを利用できます。\n\n```python\nfrom annofabapi.parser import SimpleAnnotationDirParser\n\nfrom annofab_3dpc.annotation import (\n CuboidAnnotationDetailDataV2,\n EulerAnglesZXY,\n SegmentAnnotationDetailData,\n SegmentData,\n convert_annotation_detail_data,\n)\n\nparser = SimpleAnnotationDirParser("tests/data/task1/input1.json")\nresult = parser.parse(convert_annotation_detail_data)\n\nsegment_annotation_data = result.details[0].data\ncuboid_annotation_data = result.details[1].data\nassert type(segment_annotation_data) == SegmentAnnotationDetailData\nassert type(cuboid_annotation_data) == CuboidAnnotationDetailDataV2\n\n\n### cuboid annotation\n\nprint(cuboid_annotation_data)\n# => CuboidAnnotationDetailDataV2(shape=CuboidShapeV2(dimensions=Size(width=6.853874863204751, height=0.2929844409227371, depth=4.092537841193188), location=Location(x=-11.896872014598989, y=-3.0571381239812996, z=0.3601047024130821), rotation=EulerAnglesZXY(x=0, y=0, z=0), direction=CuboidDirection(front=Vector3(x=1, y=0, z=0), up=Vector3(x=0, y=0, z=1))), kind=\'CUBOID\', version=\'2\')\n\n# オイラー角をクォータニオンに変換\nprint(cuboid_annotation_data.shape.rotation.to_quaternion())\n# => [1.0, 0.0, 0.0, 0.0]\n\n# クォータニオンからオイラー角に変換\nprint(EulerAnglesZXY.from([1.0, 0.0, 0.0, 0.0]))\n# => EulerAnglesZXY(x=-0.0, y=0.0, z=0.0)\n\n\n### segment annotation\nprint(segment_annotation_data)\n# => SegmentAnnotationDetailData(data_uri=\'./input1/7ba51c15-f07a-4e29-8584-a4eaf3a6812a\')\n\n# セグメント情報が格納されたファイルを読み込む\nwith parser.open_outer_file(Path(segment_annotation_data.data_uri).name) as f:\n dict_segmenta_data = json.load(f)\n segment_data = SegmentData.from_dict(dict_segmenta_data)\n assert type(segment_data) == SegmentData\n assert len(segment_data.points) > 0\n\n```\n',
18
- 'author': 'yuji38kwmt',
19
- 'author_email': None,
20
- 'maintainer': None,
21
- 'maintainer_email': None,
22
- 'url': 'https://github.com/kurusugawa-computer/annofabapi-3dpc-extensions',
23
- 'packages': packages,
24
- 'package_data': package_data,
25
- 'install_requires': install_requires,
26
- 'python_requires': '>=3.7,<4.0',
27
- }
28
-
29
-
30
- setup(**setup_kwargs)