hello<\/code> \u3068\u3044\u3046\u30b7\u30f3\u30d7\u30eb\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u984c\u6750\u306b\u3057\u307e\u3059\uff0e<\/p>\n# hello\/__init__.py\r\ndef say_hello(name):\r\n print(f\"Hello, {name}\")<\/code><\/pre>\n\u578b\u30d2\u30f3\u30c8\u4ed8\u304d\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u914d\u5e03\u3057\u305f\u3044 (\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u7de8)<\/h3>\n
\u6b21\u306e\u3088\u3046\u306b\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u7528\u3044\u3066\uff0c\u578b\u30d2\u30f3\u30c8\u3092\u8a18\u8ff0\u3057\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u914d\u5e03\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff0e(\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u00a0hello-typed1<\/code>\u00a0\u306b\u5bfe\u5fdc)<\/p>\n# hello\/__init__.py\r\ndef say_hello(name: str) -> None:\r\n print(f\"Hello, {name}\")<\/code><\/pre>\n\u3053\u306e\u5834\u5408\u306f py.typed<\/code> \u3068\u3044\u3046\u540d\u524d\u306e\u7a7a\u30d5\u30a1\u30a4\u30eb\u3092\u578b\u60c5\u5831\u3092\u542b\u3080\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u76f4\u4e0b\u306b\u7f6e\u304d\uff0c\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u542b\u3081\u307e\u3059\uff0e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210:<\/p>\nhello-typed1\r\n\u251c\u2500\u2500 hello\r\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\r\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 py.typed\r\n\u2514\u2500\u2500 setup.py<\/code><\/pre>\nsetup.py<\/code> \u3067 package_data<\/code> \u3092\u7528\u3044\u3066\uff0cpy.typed<\/code> \u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u542b\u307e\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\uff0e<\/p>\n# setup.py\r\nfrom setuptools import setup\r\n\r\nsetup(\r\n name=\"hello-typed1\",\r\n version=\"0.0.1\",\r\n packages=[\"hello\"],\r\n package_data={\r\n \"hello\": [\"py.typed\"],\r\n },\r\n)<\/code><\/pre>\n\u7c21\u5358\u306a\u307e\u3068\u3081: \u30d5\u30a1\u30a4\u30eb py.typed<\/code> \u3092\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u7f6e\u304f \/ package_data<\/code> \u3067 py.typed<\/code> \u3092\u542b\u3081\u308b<\/p>\n\u578b\u30d2\u30f3\u30c8\u4ed8\u304d\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u914d\u5e03\u3057\u305f\u3044 (\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb\u7de8)<\/h3>\n
\u6b21\u306e\u3088\u3046\u306b\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb (\u62e1\u5f35\u5b50\u304c .pyi<\/code> \u306e\u30d5\u30a1\u30a4\u30eb) \u3092\u7528\u3044\u3066\uff0c\u30d7\u30ed\u30b0\u30e9\u30e0\u672c\u4f53\u3068\u5225\u306b\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb\u306b\u578b\u30d2\u30f3\u30c8\u3092\u8a18\u8ff0\u3057\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u914d\u5e03\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff0e\u3053\u306e\u65b9\u6cd5\u306f Python 2\/3 \u4e21\u5bfe\u5fdc\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u6709\u7528\u3067\u3059\uff0e (\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u00a0hello-typed2<\/code>\u00a0\u306b\u5bfe\u5fdc)<\/p>\n# hello\/__init__.py\r\ndef say_hello(name):\r\n print(f\"Hello, {name}\")<\/code><\/pre>\n# hello\/__init__.pyi\r\ndef say_hello(name: str) -> None: ...<\/code><\/pre>\n\u3053\u306e\u5834\u5408\u3082\u00a0py.typed<\/code> \u3068\u3044\u3046\u540d\u524d\u306e\u7a7a\u30d5\u30a1\u30a4\u30eb\u3092\u578b\u60c5\u5831\u3092\u542b\u3080\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u76f4\u4e0b\u306b\u7f6e\u304d\uff0c\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u542b\u3081\u307e\u3059\uff0e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210:<\/p>\nhello-typed2\r\n\u251c\u2500\u2500 hello\r\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\r\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.pyi\r\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 py.typed\r\n\u2514\u2500\u2500 setup.py<\/code><\/pre>\nsetup.py<\/code> \u3067 package_data<\/code> \u3092\u7528\u3044\u3066\uff0cpy.typed<\/code>\u00a0\u3068\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb (.pyi<\/code>) \u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u542b\u307e\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\uff0e<\/p>\n# setup.py\r\nfrom setuptools import setup\r\n\r\nsetup(\r\n name=\"hello-typed2\",\r\n version=\"0.0.1\",\r\n packages=[\"hello\"],\r\n package_data={\r\n \"hello\": [\"py.typed\", \"*.pyi\"],\r\n },\r\n)<\/code><\/pre>\n\u7c21\u5358\u306a\u307e\u3068\u3081: \u30d5\u30a1\u30a4\u30eb py.typed<\/code> \u3092\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u7f6e\u304f \/ package_data<\/code> \u3067 py.typed<\/code> \u3068 *.pyi<\/code>\u00a0\u3092\u542b\u3081\u308b<\/p>\n\u4ed6\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u305f\u3081\u306e\u578b\u30d2\u30f3\u30c8\u3092\u5225\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3068\u3057\u3066\u914d\u5e03\u3057\u305f\u3044<\/h3>\n
\u5148\u307b\u3069\u6319\u3052\u305f numpy-stubs \u306e\u3088\u3046\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u914d\u5e03\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff0e\u3053\u3053\u3067\u306f\uff0c\u578b\u30d2\u30f3\u30c8\u304c\u4ed8\u3044\u3066\u3044\u306a\u3044\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u00a0hello<\/code>\u00a0\u306e\u305f\u3081\u306e\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3092\u542b\u3080 hello-stubs<\/code> \u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3059\uff0e\u00a0(\u30ea\u30dd\u30b8\u30c8\u30ea\u306e hello<\/code> \/ hello-stubs<\/code> \u306b\u5bfe\u5fdc)<\/p>\n# hello-stubs\/__init__.pyi\r\ndef say_hello(name: str) -> None: ...<\/code><\/pre>\n\u3053\u306e\u5834\u5408\u306f\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u306e\u672b\u5c3e\u306b -stubs<\/code> \u3068\u3044\u3046\u30b5\u30d5\u30a3\u30c3\u30af\u30b9\u3092\u4ed8\u3051\u307e\u3059\uff0e\u307e\u305f\uff0c -stubs<\/code> \u304b\u3089\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u578b\u60c5\u5831\u3092\u542b\u3093\u3067\u3044\u308b\u3053\u3068\u306f\u660e\u3089\u304b\u3067\u3042\u308b\u3068\u306e\u7406\u7531\u304b\u3089\u00a0py.typed<\/code>\u00a0\u3092\u7f6e\u304f\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\uff0e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210:<\/p>\nhello-stubs\r\n\u251c\u2500\u2500 hello-stubs\r\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.pyi\r\n\u2514\u2500\u2500 setup.py<\/code><\/pre>\nsetup.py<\/code> \u3067 package_data<\/code> \u3092\u7528\u3044\u3066\uff0c\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb (.pyi<\/code>) \u304c\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u542b\u307e\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3059\uff0e\u307e\u305f\uff0cinstall_requires<\/code> \u3092\u7528\u3044\u3066\uff0c\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u3069\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u305f\u3081\u306e\u30b9\u30bf\u30d6\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3080\u30d1\u30c3\u30b1\u30fc\u30b8\u304b\u3092\u660e\u793a\u3059\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u3059\uff0e<\/p>\n# setup.py\r\nfrom setuptools import setup\r\n\r\nsetup(\r\n name=\"hello-stubs\",\r\n version=\"0.0.1\",\r\n packages=[\"hello-stubs\"],\r\n package_data={\r\n \"hello-stubs\": [\"*.pyi\"],\r\n },\r\n install_requires=[\r\n \"hello==0.0.1\",\r\n ],\r\n)<\/code><\/pre>\n\u7c21\u5358\u306a\u307e\u3068\u3081: \u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u306e\u5f8c\u308d\u306b -stubs<\/code> \u3092\u4ed8\u3051\u3066\u30b9\u30bf\u30d6\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u308b \/ package_data<\/code> \u3067\u00a0*.pyi<\/code> \u3092\u542b\u3081\u308b \/ install_requires<\/code> \u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u6307\u5b9a\u3059\u308b\uff0e(\u8ffd\u8a18: 2018\/9\/30 \u3053\u306e\u6bb5\u843d\u306e\u00a0package_data<\/code>\u00a0\u306b\u3064\u3044\u3066\uff0c\u8aa4\u308a\u304c\u3042\u3063\u305f\u305f\u3081\u4fee\u6b63\u3057\u307e\u3057\u305f\uff0e2018\/11\/4 \u3053\u306e\u6bb5\u843d\u306e setup.py \u306e\u5185\u5bb9\u306e\u8aa4\u308a\u3092\u4fee\u6b63\u3057\u307e\u3057\u305f\uff0e)<\/p>\n\u307e\u3068\u3081<\/h2>\n
\u3053\u306e\u8a18\u4e8b\u3067\u306f PEP 561\u00a0Distributing and Packaging Type Information \u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u305f\u4e0a\u3067\uff0cPEP 561 \u306b\u6e96\u62e0\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u4f5c\u6210\u65b9\u6cd5 (py.typed<\/code> \u306a\u3069) \u3092\u5177\u4f53\u4f8b\u3092\u4ea4\u3048\u3066\u7d39\u4ecb\u3057\u307e\u3057\u305f\uff0ePartial stub package \u306a\u3069\u4e00\u90e8\u8aac\u660e\u3057\u3066\u3044\u306a\u3044\u90e8\u5206\u3082\u3042\u308b\u306e\u3067\uff0c\u8a73\u7d30\u306f PEP 561 \u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\uff0e<\/p>\n\u307e\u305f\uff0c\u73fe\u6642\u70b9\u3067\u81ea\u5206\u304c\u8abf\u3079\u305f\u7bc4\u56f2\u3067\u5206\u304b\u3063\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u4e8c\u3064\u3042\u308a\u307e\u3059\uff0e\u4e00\u3064\u306f typeshed \u306b\u3064\u3044\u3066\u3067\uff0c\u4eca\u5f8c\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u30fc\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u578b\u60c5\u5831\u306e\u914d\u5e03\u304c typeshed \u304b\u3089 PEP 561 \u3092\u7528\u3044\u3066\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u578b\u60c5\u5831\u3092\u542b\u3081\u308b\u65b9\u6cd5\u304c\u4e3b\u6d41\u306b\u306a\u308b\u306e\u304b\u304c\u4e0d\u660e\u3067\u3059\uff0e\u3082\u3046\u4e00\u3064\u306f\u30b9\u30bf\u30d6\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u63a2\u3057\u65b9\u306b\u3064\u3044\u3066\u3067\u3059\uff0e\u73fe\u6642\u70b9\u3067\u306f PyPI \u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u30b9\u30bf\u30d6\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u4e00\u89a7\u3092\u7c21\u5358\u306b\u5f97\u308b\u65b9\u6cd5\u306f\u306a\u3044\u3088\u3046\u306b\u601d\u3044\u307e\u3059\uff0e\u3082\u3057\u30b9\u30bf\u30d6\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u305f\u3081\u306e trove classifier \u304c\u5b9a\u7fa9\u3055\u308c\u308c\u3070\uff0c\u30b9\u30bf\u30d6\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u63a2\u3057\u3084\u3059\u304f\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"
\u3053\u306e\u8a18\u4e8b\u3067\u306f Python 3.7 \u3067\u63a1\u629e\u3055\u308c\u305f PEP 561 Distributing and Packaging Type Information \u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u89e3\u8aac\u3057\uff0cPEP 561 \u306b\u6e96\u62e0\u3057\u305f\uff0c\u578b\u30d2\u30f3\u30c8\u3092\u542b\u3080\u30d1 […]<\/p>\n","protected":false},"author":2,"featured_media":2075,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,3],"tags":[120,15,96],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/2061"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=2061"}],"version-history":[{"count":18,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/2061\/revisions"}],"predecessor-version":[{"id":2088,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/2061\/revisions\/2088"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media\/2075"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=2061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=2061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=2061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}