{"id":341416,"date":"2022-11-18T15:00:13","date_gmt":"2022-11-18T15:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=341416"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=341416","title":{"rendered":"<span>\u0423\u0447\u0438\u043c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b Python<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/700282\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/uo\/os\/ud\/uoosudpqduicyu6iru8n3goeqoa.png\" align=\"left\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/uo\/os\/ud\/uoosudpqduicyu6iru8n3goeqoa.png\"\/><\/a>\u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b Python?<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f (pip install demo).<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 (\u041a\u043e\u043c\u0430\u043d\u0434\u0430 pip install -e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448 \u043f\u0430\u043a\u0435\u0442 \u0438 \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u0430\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0441\u044f \u0432 \u0445\u043e\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438).<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c (from demo.main import say_hello, \u0430 \u0437\u0430\u0442\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e).<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b \u043d\u0435 \u0440\u0438\u0441\u043a\u0443\u0435\u0442\u0435 \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043e\u0434\u0430, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0435\u0433\u043e \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 (pip install demo==1.0.3).<a name=\"habracut\"><\/a><\/p>\n<p>  \u0412 \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439, \u043f\u0430\u043a\u0435\u0442\u043e\u043c \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u043c:<br \/>  \u2022 \u041c\u043e\u0434\u0443\u043b\u044c: \u044d\u0442\u043e .py-\u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u043e <br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442: \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c <br \/>  \u2022 \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430: \u044d\u0442\u043e \u043f\u0430\u043a\u0435\u0442, \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/kd\/hi\/3f\/kdhi3fou8bfxaxicbmz9jetwtwo.png\" align=\"right\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/kd\/hi\/3f\/kdhi3fou8bfxaxicbmz9jetwtwo.png\"\/><br \/>  \u0417\u0430\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u0434 Python \u0432 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442 setup.py, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0440\u0430\u0437\u0443 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h2>1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0435<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 <a href=\"https:\/\/menziess.github.io\/howto\/test\/python-code\/\">\u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a>, \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0437\u0434\u0435\u0441\u044c <a href=\"https:\/\/menziess.github.io\/howto\/manage\/virtual-environments\/\">\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/a>:<\/p>\n<pre><code class=\"python\">\u279c tree -a -L 2 . \u251c\u2500\u2500 .venv \u2502   \u2514\u2500\u2500 ... \u251c\u2500\u2500 Pipfile \u251c\u2500\u2500 Pipfile.lock \u251c\u2500\u2500 src \u2502   \u2514\u2500\u2500 demo \u2502       \u2514\u2500\u2500 main.py \u2514\u2500\u2500 tests     \u2514\u2500\u2500 demo         \u2514\u2500\u2500 ...  9 directories, 3 files<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b setup.py \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435. \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0445\u043e\u0442\u0438\u043c \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">\"\"\"\u0421\u043a\u0440\u0438\u043f\u0442 Setup.py \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0435.\"\"\"  from setuptools import setup, find_packages  import json import os  def read_pipenv_dependencies(fname):     \"\"\"\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 Pipfile.lock \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.\"\"\"     filepath = os.path.join(os.path.dirname(__file__), fname)     with open(filepath) as lockfile:         lockjson = json.load(lockfile)         return [dependency for dependency in lockjson.get('default')]  if __name__ == '__main__':     setup(         name='demo',         version=os.getenv('PACKAGE_VERSION', '0.0.dev0'),         package_dir={'': 'src'},         packages=find_packages('src', include=[             'demo*'         ]),         description='A demo package.',         install_requires=[               *read_pipenv_dependencies('Pipfile.lock'),         ]     )<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">python setup.py develop # \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e  python setup.py bdist_egg # \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 \u00ab\u044f\u0439\u0446\u043e\u00bb, \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 python setup.py bdist_wheel # \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u00ab\u043a\u043e\u043b\u0435\u0441\u043e\u00bb, \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 python setup.py sdist --formats=zip,gztar,bztar,ztar,tar # \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">from demo.main import say_hello<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p><b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b><br \/>  \u0415\u0441\u043b\u0438 \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u201cNo module named demo\u2026&#187;, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b __init__.py \u0432\u043e \u0432\u0441\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u044e\u0434\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433 demo. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 __init__.py \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/docs.python.org\/3\/reference\/import.html#regular-packages\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p><\/blockquote>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 setuptools.setup:<br \/>  1. <b>name<\/b>: \u0438\u043c\u044f \u0432\u0430\u0448\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<br \/>  2. <b>version<\/b>: \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0432\u043d\u043e\u0441\u0438\u043c\u043e\u0433\u043e \u0432 \u043a\u043e\u0434, \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430; \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u043f\u0440\u0435\u0436\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u043a\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0434\u0440\u0443\u0433 \u0441\u0442\u0430\u043d\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u043d\u044c\u0448\u0435 \u0438 \u0441\u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u043e\u0434. <br \/>  3. <b>packages<\/b>: \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0443\u0442\u0435\u0439 \u043a\u043e \u0432\u0441\u0435\u043c \u0432\u0430\u0448\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c python <br \/>  4. <b>install_requires<\/b>: \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043c\u0435\u043d \u0438 \u0432\u0435\u0440\u0441\u0438\u0439 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 (\u0442\u043e\u0447\u043d\u043e \u043a\u0430\u043a \u0432 \u0444\u0430\u0439\u043b\u0435 requirements.txt)<br \/>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e read_pipenv_dependencies \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0438\u0437 Pipfile.lock \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 (non-dev). \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u0422\u0430\u043a\u0436\u0435 \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c os.getenv \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u2013 \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0441\u044e\u0436\u0435\u0442\u044b \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432.<\/p>\n<h2>2. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u0422\u043e\u0447\u043d\u043e \u043a\u0430\u043a \u043f\u0440\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0438 Pipfile.lock \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u044f \u043c\u043e\u0433\u0443 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0444\u0430\u0439\u043b README.md, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043a\u0430\u043a long_description. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 <a href=\"https:\/\/packaging.python.org\/guides\/making-a-pypi-friendly-readme\/\">packaging.python.org<\/a>.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 readthedocs \u0438 sphinx. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">mkdir docs<\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c sphinx:<\/p>\n<pre><code class=\"python\">pipenv install -d sphinx<\/code><\/pre>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 quickstart \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">sphinx-quickstart<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0444\u0430\u0439\u043b\u0430 docs\/index.rst \u0441\u0430\u043c\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/www.sphinx-doc.org\/en\/master\/usage\/quickstart.html\">sphinx-doc.org<\/a>.<\/p>\n<h2>3. \u041b\u0438\u043d\u0442\u0438\u043d\u0433 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430, \u043b\u0438\u043d\u0442\u0438\u043d\u0433 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">pipenv install -d mypy autopep8 \\   flake8 pytest bandit pydocstyle<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0430 \u0431\u044b \u0441\u0442\u0438\u043b\u044c \u043a\u043e\u0434\u0430, \u043f\u0440\u043e\u0433\u043d\u0430\u043b\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043a\u0438\u043d\u0443\u0442\u044c \u0432 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043f\u0440\u043e\u0432\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0441\u0431\u043e\u0440\u043a\u0438, \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u044b \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0443\u0442.<\/p>\n<h2>4. Makefile<\/h2>\n<p>  \u041f\u043e \u043c\u0435\u0440\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0431\u043e\u0440\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Gradle \u0438\u043b\u0438 npm) \u044d\u0442\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>  Make \u2013 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u043a\u043e\u0434\u0430. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 c-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041d\u043e \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438 \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. <br \/>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 make \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 make help, \u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 Makefile.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c make test, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 make dev, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0444\u0430\u0439\u043b\u0435 Makefile \u043e\u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c:<\/p>\n<pre><code class=\"python\">help: @echo \"Tasks in \\033[1;32mdemo\\033[0m:\" @cat Makefile  lint: mypy src --ignore-missing-imports flake8 src --ignore=$(shell cat .flakeignore)  dev: pip install -e .  test: dev pytest --doctest-modules --junitxml=junit\/test-results.xml bandit -r src -f xml -o junit\/security.xml || true  build: clean pip install wheel python setup.py bdist_wheel  clean: @rm -rf .pytest_cache\/ .mypy_cache\/ junit\/ build\/ dist\/ @find . -not -path '.\/.venv*' -path '*\/__pycache__*' -delete @find . -not -path '.\/.venv*' -path '*\/*.egg-info*' -delete<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043d\u043e\u0432\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442. \u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443 \u043d\u0438\u0445 \u043a\u0430\u043a \u043d\u0430 \u043b\u0430\u0434\u043e\u043d\u0438 \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0440\u0430\u0437\u0443 \u0432\u0438\u0434\u043d\u043e, \u043a\u0430\u043a \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043b\u0435\u0441\u043e: make build.<\/p>\n<h2>5. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043e\u043b\u0435\u0441\u0430<\/h2>\n<p>  \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c make build, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0430\u0439\u043b setup.py, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 \u043a\u043e\u043b\u0435\u0441\u0430. \u0424\u0430\u0439\u043b .whl \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 dist\/, \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c 0.0.dev0. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u043e\u043b\u0435\u0441\u0430:<\/p>\n<pre><code class=\"python\">export PACKAGE_VERSION='1.0.0' make build ls dist<\/code><\/pre>\n<p>  \u0418\u043c\u0435\u044f \u043a\u043e\u043b\u0435\u0441\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 \u041f\u041a \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043a\u043e\u043b\u0435\u0441\u043e, \u0430 \u0437\u0430\u0442\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438:<\/p>\n<pre><code class=\"python\">mkdir test-whl &amp;&amp; cd test-whl pipenv shell pip install *.whl<\/code><\/pre>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"python\">pip list<\/code><\/pre>\n<p>  <\/p>\n<h2>6. \u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b <\/h2>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0430\u043a\u0435\u0442 \u043c\u043e\u0436\u043d\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u0432\u043a\u043b\u044e\u0447\u0438\u0432 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 setup.py \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<blockquote><p><b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b> <br \/>  D\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Databricks).<\/p><\/blockquote>\n<p>  <\/p>\n<pre><code class=\"python\">if __name__ == '__main__':     setup(         data_files=[             ('data', ['data\/my-config.json'])         ]     )<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">def get_cfg_file(filename: str, foldername: str) -> dict:     \"\"\"\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b      \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 'data_files' \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 setup.py.     \"\"\"     if not isinstance(foldername, str):         raise ValueError('Foldername must be string.')     if foldername[0] == '\/':         raise ValueError('Foldername must not start with \\'\/\\'')     if not isinstance(filename, str):         raise ValueError('Filename must be string.')      # \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0438\u0437 \u0442\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d      # \u042d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u043a .whl      # \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e     try:         filepath = os.path.join(sys.prefix, foldername, filename)         with open(filepath) as f:             return json.load(f)     except FileNotFoundError:         filepath = os.path.join(foldername, filename)         with open(filepath) as f:             return json.load(f)<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u043d\u043e\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043b\u0435\u0441\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0432 \u043d\u043e\u0432\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435, \u043d\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u044f \u0444\u0430\u0439\u043b \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<h2>7. DevOps<\/h2>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 Azure DevOps, \u0433\u0434\u0435 \u043d\u0430 git tags, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0432\u0435\u0442\u043a\u0435 master \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u043e\u0434, \u0438 \u043d\u0438\u0436\u0435 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0435\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0442\u0430\u0434\u0438\u0438 \u0438 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<pre><code class=\"python\">resources:   - repo: self  trigger:   - master   - refs\/tags\/v*  variables:   python.version: \"3.7\"   project: demo   feed: demo   major_minor: $[format('{0:yy}.{0:MM}', pipeline.startTime)]   counter_unique_key: $[format('{0}.demo', variables.major_minor)]   patch: $[counter(variables.counter_unique_key, 0)]   fallback_tag: $(major_minor).dev$(patch)  stages:   - stage: Test     jobs:       - job: Test         displayName: Test         steps:           - task: UsePythonVersion@0             displayName: \"Use Python $(python.version)\"             inputs:               versionSpec: \"$(python.version)\"            - script: pip install pipenv &amp;&amp; pipenv install -d --system --deploy --ignore-pipfile             displayName: \"Install dependencies\"            - script: pip install typed_ast &amp;&amp; make lint             displayName: Lint            - script: pip install pathlib2 &amp;&amp; make test             displayName: Test            - task: PublishTestResults@2             displayName: \"Publish Test Results junit\/*\"             condition: always()             inputs:               testResultsFiles: \"junit\/*\"               testRunTitle: \"Python $(python.version)\"    - stage: Build     dependsOn: Test     jobs:       - job: Build         displayName: Build         steps:           - task: UsePythonVersion@0             displayName: \"Use Python $(python.version)\"             inputs:               versionSpec: \"$(python.version)\"            - script: \"pip install wheel twine\"             displayName: \"Wheel and Twine\"            - script: |               # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u043e \u0442\u0435\u0433\u0443 git (v1.0.0) -> (1.0.0)               git_tag=`git describe --abbrev=0 --tags | cut -d'v' -f 2`               echo \"##vso[task.setvariable variable=git_tag]$git_tag\"             displayName: Set GIT_TAG variable if tag is pushed             condition: contains(variables['Build.SourceBranch'], 'refs\/tags\/v')            - script: |               # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f\u043c\u0438               GIT_TAG=$(git_tag)               FALLBACK_TAG=$(fallback_tag)               echo GIT TAG: $GIT_TAG, FALLBACK_TAG: $FALLBACK_TAG                # \u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b python \u043c\u043e\u0433 \u0435\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u044c               export PACKAGE_VERSION=${GIT_TAG:-${FALLBACK_TAG:-default}}               echo Version used in setup.py: $PACKAGE_VERSION                # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PACKAGE_VERSION \u0432 setup()               python setup.py bdist_wheel             displayName: Build            - task: CopyFiles@2             displayName: Copy dist files             inputs:               sourceFolder: dist\/               contents: demo*.whl               targetFolder: $(Build.ArtifactStagingDirectory)               flattenFolders: true            - task: PublishBuildArtifacts@1             displayName: PublishArtifact             inputs:               pathtoPublish: $(Build.ArtifactStagingDirectory)               ArtifactName: demo.whl            - task: TwineAuthenticate@1             inputs:               artifactFeed: $(project)\/$(feed)            - script: |               twine upload -r $(feed) --config-file $(PYPIRC_PATH) dist\/*             displayName: PublishFeed<\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u0430\u043f\u0435 Test \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430, \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b make lint \u0438 make test, \u0442\u043e\u0447\u043d\u043e \u043a\u0430\u043a \u0432\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u044b \u044d\u0442\u043e \u043d\u0430 \u0432\u0430\u0448\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u0430\u043f\u0435 Build \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u043a\u0435\u0442\u0430, \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u0442\u0435\u0433 git, \u0430 \u0435\u0449\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u043a\u0435\u0442\u0430. \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 python setup.py bdist_wheel \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043a\u043e\u043b\u0435\u0441\u0430, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0430\u043a\u0435\u0442\u0430. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 \u0432 \u0447\u0438\u0441\u043b\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 Azure DevOps \u0438 (\u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e) \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043b\u0435\u043d\u0442\u0443.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u0432 \u043b\u0435\u043d\u0442\u0435, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b .pypirc, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043b\u0435\u043d\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0432 Azure DevOps. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">[distutils] Index-servers =   stefanschenk  [stefanschenk] Repository = https:\/\/pkgs.dev.azure.com\/stefanschenk\/_packaging\/stefanschenk\/pypi\/upload<\/code><\/pre>\n<p>  \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0438\u0437 \u0447\u0430\u0441\u0442\u043d\u043e\u0439 \u043b\u0435\u043d\u0442\u044b, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e <a href=\"https:\/\/menziess.github.io\/howto\/install\/python-packages-from-azure-devops\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/700282\/\"> https:\/\/habr.com\/ru\/company\/piter\/blog\/700282\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/700282\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/uo\/os\/ud\/uoosudpqduicyu6iru8n3goeqoa.png\" align=\"left\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/uo\/os\/ud\/uoosudpqduicyu6iru8n3goeqoa.png\"\/><\/a>\u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b Python?<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f (pip install demo).<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 (\u041a\u043e\u043c\u0430\u043d\u0434\u0430 pip install -e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448 \u043f\u0430\u043a\u0435\u0442 \u0438 \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u0430\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0441\u044f \u0432 \u0445\u043e\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438).<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c (from demo.main import say_hello, \u0430 \u0437\u0430\u0442\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e).<br \/>  \u2022 \u041f\u0430\u043a\u0435\u0442\u044b \u043b\u0435\u0433\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b \u043d\u0435 \u0440\u0438\u0441\u043a\u0443\u0435\u0442\u0435 \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043e\u0434\u0430, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0435\u0433\u043e \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 (pip install demo==1.0.3).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-341416","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=341416"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341416\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}