{"id":346811,"date":"2023-03-16T09:01:31","date_gmt":"2023-03-16T09:01:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346811"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346811","title":{"rendered":"<span>Python \u0414\u0430\u0439\u0434\u0436\u0435\u0441\u0442: \u043a\u0430\u043a \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pre-commit<\/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\">\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a open source \u043f\u0440\u043e\u0435\u043a\u0442 Python \u0414\u0430\u0439\u0434\u0436\u0435\u0441\u0442 \u0441\u043f\u0443\u0441\u0442\u044f 5 \u043b\u0435\u0442 \u0431\u0435\u0437 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0441\u0442\u044d\u043a\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439. \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/first\/blog\/709068\/\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c outdated \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 Python 3.4 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e Python 3.11 \u0438 Django 4.1.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u0448\u0435\u0432\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/jb\/vb\/gm\/jbvbgmjlec7411ubkfujg30ak4g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/jb\/vb\/gm\/jbvbgmjlec7411ubkfujg30ak4g.jpeg\" data-blurred=\"true\"\/><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"soderzhanie-cikla-statey\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u0430 \u0441\u0442\u0430\u0442\u0435\u0439<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/first\/blog\/709068\/\">1 \u0447\u0430\u0441\u0442\u044c: \u041a\u0430\u043a \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0441 Python 3.4 \u0434\u043e Python 3.11, \u0435\u0441\u043b\u0438 pip \u0443\u0436\u0435 \u0441\u043b\u043e\u043c\u0430\u043d<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/first\/blog\/721732\/\">2 \u0447\u0430\u0441\u0442\u044c: \u041a\u0430\u043a \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pre-commit<\/a><br \/>  \u2014 \u0432\u044b \u0437\u0434\u0435\u0441\u044c \u2014 <\/li>\n<li>3 \u0447\u0430\u0441\u0442\u044c: \u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c CI \u0434\u043b\u044f OpenSource \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 Github Actions<\/li>\n<li>4 \u0447\u0430\u0441\u0442\u044c: \u041a\u0430\u043a \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c Django \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e (\u043f\u043e\u0447\u0442\u0438) \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"sostoyanie-posle-obnovleniya-do-python-311\">\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e Python 3.11<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442.<\/li>\n<li>\u041a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Python 3.4 \u0438 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Python 2.7.<\/li>\n<li>\u041a\u0443\u0447\u0430 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u0434 \u043d\u0435 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0435\u0442 \u0434\u0430\u0436\u0435 \u0447\u0430\u0441\u0442\u0438 PEP8, \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u044b\u0433\u0430\u0435\u0442.<\/li>\n<li>\u041d\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0440\u0443\u043a\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 3.6+ \u0444\u0438\u0447.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"zadacha-chast-2--pereyti-ot-ruchnogo-formatirovaniya-koda-k-avtomatizirovannomu\">\u0417\u0430\u0434\u0430\u0447\u0430 (\u0447\u0430\u0441\u0442\u044c 2) \u2014 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043e\u0442 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<h2 id=\"plan-rabot\">\u041f\u043b\u0430\u043d \u0440\u0430\u0431\u043e\u0442<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u043e\u0434<\/li>\n<li>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c<\/li>\n<li>\u041e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"zachem-formatiruem-kod\">\u0417\u0430\u0447\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434<\/h2>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u2014 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043c\u044b\u0441\u043b\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043d\u0430 COW-language, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0441\u0438\u043b\u0438\u0439, \u0434\u0430 \u0438 \u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043b\u043b\u0435\u0433 \u0437\u0430\u0445\u043e\u0442\u044f\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c. \u0427\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u043f\u0440\u043e\u0449\u0435 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0447\u0435\u043c \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u0435\u0440\u0435\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0438 \u0441\u0432\u043e\u0438 \u0433\u043b\u0430\u0437\u0430.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u0447\u0430\u0449\u0435, \u0447\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u043b\u043e\u043d\u043d\u044b \u043a \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044e \u0432 \u0441\u0442\u0438\u043b\u0435 \u00ab\u043a\u0430\u043a \u043f\u043e\u0439\u0434\u0435\u0442\u00bb. \u0418 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u0442\u0438\u043b\u044f. \u041f\u043e\u0441\u043b\u0435 \u0433\u043e\u0434\u0430-\u0434\u0432\u0443\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442 \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0441\u0442\u0438\u043b\u044c \u0434\u043e\u043b\u044c\u0448\u0435 \u0438 \u0436\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0443 \u0432\u0441\u0435\u0445, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u044b\u0439 code style. \u0418 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u043a\u0430\u043a \u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"kak-delat-avtoformatirovanie-koda\">\u041a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430<\/h2>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u00ab\u0430\u0432\u0442\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Python \u043a\u043e\u0434\u0430\u00bb, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/psf\/black\">black<\/a>\/<a href=\"https:\/\/github.com\/hhatto\/autopep8\">autopep8<\/a>\/<a href=\"https:\/\/flake8.pycqa.org\/en\/latest\/\">flake8<\/a>\/<a href=\"https:\/\/pycqa.github.io\/isort\/\">isort<\/a>\/<a href=\"https:\/\/redbaron.readthedocs.io\/en\/latest\/\">redbaron<\/a>\/<a href=\"https:\/\/github.com\/google\/yapf\">yapf<\/a> \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u0438\u0445 \u0431\u0430\u0437\u0435. \u042d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u0434 \u043a \u0435\u0434\u0438\u043d\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443. \u041f\u0440\u043e \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430 habr \u2014 <a href=\"https:\/\/habr.com\/ru\/post\/251531\/\">\u0440\u0430\u0437<\/a>, <a href=\"https:\/\/habr.com\/ru\/post\/324336\/\">\u0434\u0432\u0430<\/a>, <a href=\"https:\/\/habr.com\/ru\/post\/708916\/\">\u0442\u0440\u0438<\/a>, \u0430 <a href=\"https:\/\/habr.com\/ru\/users\/sobolevn\/\" class=\"user_link\">sobolevn<\/a> \u0441\u0434\u0435\u043b\u0430\u043b \u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u0432 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0432\u0438\u0434 \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, isort \u2014 \u0438\u043c\u043f\u043e\u0440\u0442\u044b. \u0414\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043d\u0430 Python, \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432. <\/p>\n<p>  <\/p>\n<p>\u0412 Python \u0414\u0430\u0439\u0434\u0436\u0435\u0441\u0442 \u043d\u0435\u0442 \u00ab\u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u0432\u0448\u0438\u0445\u0441\u044f\u00bb \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u0434\u043e\u043c, \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0430\u0432\u0442\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0441\u0440\u0430\u0437\u0443 \u0438 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a. \u0417\u043d\u0430\u0447\u0438\u0442, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/github.com\/psf\/black\">black<\/a>, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<h2 id=\"kak-obnovit-kod-pod-novuyu-versiyu-python\">\u041a\u0430\u043a \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e Python<\/h2>\n<p>  <\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Python \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442\u0441\u044f\/\u0434\u043e\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439, \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f API \u0434\u0430\u0436\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00ab\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00bb \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0412\u0441\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0432 changelog&#8217;\u0430\u0445 \u043a \u0432\u0435\u0440\u0441\u0438\u044f\u043c Python.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 f-string \u0432 3.6 \u2014 \u044d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0442\u0440\u043e\u043a. \u0421\u0442\u0440\u043e\u043a\u0438 \u0441\u0442\u0430\u043b\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043b\u0435\u0433\u0447\u0435 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u0432\u0441\u0435\u0439 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0438 .format \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 f-string \u2014 \u0437\u0430\u043d\u044f\u0442\u0438\u0435 \u043d\u0430 \u043c\u043d\u043e\u0433\u043e \u0447\u0430\u0441\u043e\u0432. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438 <code>six<\/code> \u0438 <code>future flags<\/code> \u0434\u043b\u044f \u043f\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/asottile\/pyupgrade\">pyupgrade<\/a>.<\/p>\n<p>  <\/p>\n<p>pyupgrade \u2014 \u0443\u0442\u0438\u043b\u0438\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 X \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 Y. \u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u00ab\u0441\u0442\u0430\u0440\u044b\u0435\u00bb \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043d\u0430 \u00ab\u043d\u043e\u0432\u044b\u0435\u00bb. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0438 \u043d\u0435 \u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u043e\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"chem-zapuskal-skripty-formatirovaniya--pre-commit\">\u0427\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 pre-commit<\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0435\u0441\u0442\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043d\u0446\u0435\u043f\u0442 \u0441 pre-commit git hooks, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438. \u041e\u0431\u0449\u0435\u0443\u043f\u043e\u0442\u0440\u0435\u0431\u0438\u043c\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 <code>pre-commit<\/code>. <\/p>\n<p>  <\/p>\n<p><code>pre-commit<\/code> \u2014 \u044d\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0439 (\u0437\u0430 \u0441\u0447\u0435\u0442 hook\/\u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432) \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043f\u0435\u0440\u0435\u0434 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c. <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e \u043d\u0435\u0433\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/503270\/\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/nixys\/blog\/682612\/\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0447\u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0437\u0434\u0443\u043c\u0430\u0435\u0448\u044c \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e <a href=\"https:\/\/pre-commit.com\/hooks.html\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0418\u0437 \u0432\u0441\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e black, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u0441 isort \u0438 autoflake<\/li>\n<li>\u041f\u043e\u0438\u0441\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432\/\u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0432 \u043a\u043e\u0434\u0435<\/li>\n<li>\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 (JSON, YAML), \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u043b\u044f CI<\/li>\n<li>\u041f\u043e\u0438\u0441\u043a \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 dependabot<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043e Python 3.11 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pyupgrade<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435 \u0443\u043c\u0435\u044e\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u044b <code>pre-commit<\/code>. \u0412\u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u2014 <a href=\"https:\/\/github.com\/pythondigest\/pythondigest\/blob\/master\/.pre-commit-config.yaml\">.pre-commit-config.yaml<\/a>, <a href=\"https:\/\/github.com\/pythondigest\/pythondigest\/blob\/master\/pyproject.toml#L78-L89\">pyproject.yaml<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"kak-nastroil-pre-commit\">\u041a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b pre-commit<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0442\u0430\u043a\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0434\u043b\u044f <code>pre-commit<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\"># copy-paste .pre-commit-config.yaml # .... exclude: \"^docs\/|\/migrations\/\" default_stages: [commit]  repos:   - repo: https:\/\/github.com\/pre-commit\/pre-commit-hooks     rev: v4.4.0     hooks:       - id: trailing-whitespace       - id: end-of-file-fixer       - id: check-yaml       - id: check-merge-conflict       - id: detect-private-key       - id: debug-statements    - repo: https:\/\/github.com\/asottile\/pyupgrade     rev: v3.3.1     hooks:       - id: pyupgrade         args: [--py311-plus]    - repo: https:\/\/github.com\/PyCQA\/isort     rev: 5.12.0     hooks:       - id: isort    - repo: https:\/\/github.com\/psf\/black     rev: 23.1.0     hooks:       - id: black         exclude: ^.*\\b(migrations)\\b.*$    -   repo: https:\/\/github.com\/PyCQA\/autoflake       rev: v2.0.1       hooks:       -   id: autoflake    - repo:  https:\/\/github.com\/python-jsonschema\/check-jsonschema     rev: 0.21.0     hooks:       - id: check-github-workflows       - id: check-dependabot    - repo: https:\/\/github.com\/pre-commit\/pygrep-hooks     rev: v1.10.0     hooks:       - id: python-use-type-annotations       - id: python-check-blanket-noqa    -   repo: https:\/\/github.com\/Yelp\/detect-secrets       rev: v1.4.0       hooks:       -   id: detect-secrets           args: ['--baseline', '.secrets.baseline']           exclude: package.lock.json<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0447\u0442\u043e\u0431\u044b <code>black<\/code> \u0438 <code>isort<\/code> \u043d\u0435 \u0441\u0441\u043e\u0440\u0438\u043b\u0438\u0441\u044c \u2014 \u0432\u043d\u0435\u0441 \u0442\u0430\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\"># copy isort\/black settings in pyproject.toml # ...  [tool.black] line-length = 119 target-version = ['py311'] include = '\\.pyi?$'  [tool.isort] profile = \"black\" line_length = 119 multi_line_output = 3 include_trailing_comma = true use_parentheses = true ensure_newline_before_comments = true<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"kak-ispolzoval-pre-commit\">\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b pre-commit<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># install poetry add pre-commit --group dev pre-commit install  # run check pre-commit run --show-diff-on-failure --color=always --all-files<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/pythondigest\/pythondigest\/blob\/master\/Makefile#L42\">Makefile<\/a> \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>check<\/code> \u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c.<\/p><\/blockquote>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 <code>pre-commit<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b.<\/p>\n<p>  <\/p>\n<h2 id=\"chto-otformatiroval-v-kode\">\u0427\u0442\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0432 \u043a\u043e\u0434\u0435<\/h2>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0423\u0434\u0430\u043b\u0435\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u0438 <code>from __future__ import unicode_literals<\/code> \u0438 <code># -*- encoding: utf-8 -*-<\/code>.<br \/> \n<pre><code class=\"python\">- # -*- coding: utf-8 -*- - from __future__ import unicode_literals<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0421\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u2014 \u0434\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a \u0438 f-string.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">- name = '{} - {}'.format(package.name, package_version)  + name = f\"{package.name} - {package_version}\"<\/code><\/pre>\n<p>  <\/li>\n<li>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u044b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0433\u0440\u0443\u043f\u043f\u044b \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435, django \u0438 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u044b \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435\/\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u044b<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">- from mock import patch  + from unittest.mock import patch<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 Dictionary Comprehension, \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 dict.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">- headers = dict((n, n) for n in fieldnames)  + headers = {n: n for n in fieldnames}<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u044b\/\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b \u0441\u0442\u0440\u043e\u043a, \u0433\u0434\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">- list_filter = ('is_activated', 'if_element', 'if_action', 'then_element', 'then_action',)  + list_filter = (     \"is_activated\",     \"if_element\",     \"if_action\",     \"then_element\",     \"then_action\", )<\/code><\/pre>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e \u2014 \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u0435\u0440\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u043b\u0435\u0441\u0442\u044c <code>pre-commit<\/code>, \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432 CI (\u043f\u0440\u043e \u044d\u0442\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438) \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043a\u043e\u0434\u0430. \u0418 \u0442\u043e\u0433\u0434\u0430 \u0442\u043e\u0442, \u043a\u0442\u043e \u00ab\u0437\u0430\u0431\u044b\u043b\u00bb \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 <code>pre-commit<\/code> \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u0434\u0438\u0442\u044c \u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<h2 id=\"vyvody\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0430\u0432\u0442\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0435\u0440\u044b Python \u043a\u043e\u0434\u0430 \u0443\u0436\u0435 \u043d\u0435 \u0441\u043a\u043b\u043e\u043d\u043d\u044b \u043b\u043e\u043c\u0430\u0442\u044c \u043a\u043e\u0434 \u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u0435\u0435 (\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442).<\/li>\n<li>pre-commit \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043b\u0438\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0435 \u0442\u043e \u0438\u043b\u0438 \u043d\u0435 \u0442\u0430\u043a. \u0413\u043e\u0442\u043e\u0432\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430\u0439\u0434\u0435\u0442, \u0447\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430. \u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u0438\u0441\u043a \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u2014 \u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u043e\u0447\u043d\u043e.<br \/> <br \/>\n<hr\/>\n<p>  <\/p>\n<p>\u041d\u041b\u041e \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430:<br \/>  \u2014 <a href=\"https:\/\/firstvds.ru\/?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=product&amp;utm_content=vds15exeptprogrev\">15% \u043d\u0430 \u0432\u0441\u0435 \u0442\u0430\u0440\u0438\u0444\u044b VDS<\/a> (\u043a\u0440\u043e\u043c\u0435 \u0442\u0430\u0440\u0438\u0444\u0430 \u041f\u0440\u043e\u0433\u0440\u0435\u0432) \u2014 <strong>HABRFIRSTVDS<\/strong>.<\/p>\n<p>  <\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/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\/first\/blog\/721732\/\"> https:\/\/habr.com\/ru\/company\/first\/blog\/721732\/<\/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\">\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a open source \u043f\u0440\u043e\u0435\u043a\u0442 Python \u0414\u0430\u0439\u0434\u0436\u0435\u0441\u0442 \u0441\u043f\u0443\u0441\u0442\u044f 5 \u043b\u0435\u0442 \u0431\u0435\u0437 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0441\u0442\u044d\u043a\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439. \u0412 <a href=\"https:\/\/habr.com\/ru\/company\/first\/blog\/709068\/\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c outdated \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 Python 3.4 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e Python 3.11 \u0438 Django 4.1.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u0448\u0435\u0432\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0432 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/jb\/vb\/gm\/jbvbgmjlec7411ubkfujg30ak4g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/jb\/vb\/gm\/jbvbgmjlec7411ubkfujg30ak4g.jpeg\" data-blurred=\"true\"\/><\/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-346811","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346811","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=346811"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346811\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}