久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <bdo id='hFqQG'></bdo><ul id='hFqQG'></ul>
    1. <i id='hFqQG'><tr id='hFqQG'><dt id='hFqQG'><q id='hFqQG'><span id='hFqQG'><b id='hFqQG'><form id='hFqQG'><ins id='hFqQG'></ins><ul id='hFqQG'></ul><sub id='hFqQG'></sub></form><legend id='hFqQG'></legend><bdo id='hFqQG'><pre id='hFqQG'><center id='hFqQG'></center></pre></bdo></b><th id='hFqQG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hFqQG'><tfoot id='hFqQG'></tfoot><dl id='hFqQG'><fieldset id='hFqQG'></fieldset></dl></div>

      <tfoot id='hFqQG'></tfoot>
    2. <small id='hFqQG'></small><noframes id='hFqQG'>

        <legend id='hFqQG'><style id='hFqQG'><dir id='hFqQG'><q id='hFqQG'></q></dir></style></legend>
      1. 將版本嵌入 Python 包的標(biāo)準(zhǔn)方法?

        Standard way to embed version into Python package?(將版本嵌入 Python 包的標(biāo)準(zhǔn)方法?)
        <legend id='BrBQJ'><style id='BrBQJ'><dir id='BrBQJ'><q id='BrBQJ'></q></dir></style></legend>

        <small id='BrBQJ'></small><noframes id='BrBQJ'>

        • <tfoot id='BrBQJ'></tfoot>
              <i id='BrBQJ'><tr id='BrBQJ'><dt id='BrBQJ'><q id='BrBQJ'><span id='BrBQJ'><b id='BrBQJ'><form id='BrBQJ'><ins id='BrBQJ'></ins><ul id='BrBQJ'></ul><sub id='BrBQJ'></sub></form><legend id='BrBQJ'></legend><bdo id='BrBQJ'><pre id='BrBQJ'><center id='BrBQJ'></center></pre></bdo></b><th id='BrBQJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BrBQJ'><tfoot id='BrBQJ'></tfoot><dl id='BrBQJ'><fieldset id='BrBQJ'></fieldset></dl></div>

                <bdo id='BrBQJ'></bdo><ul id='BrBQJ'></ul>

                    <tbody id='BrBQJ'></tbody>
                  本文介紹了將版本嵌入 Python 包的標(biāo)準(zhǔn)方法?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  是否有一種標(biāo)準(zhǔn)方法可以將版本字符串與 Python 包相關(guān)聯(lián),以便我可以執(zhí)行以下操作?

                  Is there a standard way to associate version string with a Python package in such way that I could do the following?

                  import foo
                  print(foo.version)
                  

                  我想有一些方法可以在沒(méi)有任何額外硬編碼的情況下檢索該數(shù)據(jù),因?yàn)樵?setup.py 中已經(jīng)指定了次要/主要字符串.我發(fā)現(xiàn)的替代解決方案是在我的 foo/__init__.py 中有 import __version__ ,然后由 setup 生成 __version__.py.py.

                  I would imagine there's some way to retrieve that data without any extra hardcoding, since minor/major strings are specified in setup.py already. Alternative solution that I found was to have import __version__ in my foo/__init__.py and then have __version__.py generated by setup.py.

                  推薦答案

                  不能直接回答您的問(wèn)題,但您應(yīng)該考慮將其命名為 __version__,而不是 version.

                  Not directly an answer to your question, but you should consider naming it __version__, not version.

                  這幾乎是一個(gè)準(zhǔn)標(biāo)準(zhǔn).標(biāo)準(zhǔn)庫(kù)中的許多模塊都使用 __version__,這也用于 很多 第三方模塊,所以它是準(zhǔn)標(biāo)準(zhǔn)的.

                  This is almost a quasi-standard. Many modules in the standard library use __version__, and this is also used in lots of 3rd-party modules, so it's the quasi-standard.

                  通常,__version__ 是一個(gè)字符串,但有時(shí)它也是一個(gè)浮點(diǎn)數(shù)或元組.

                  Usually, __version__ is a string, but sometimes it's also a float or tuple.

                  如 S.Lott 所述(謝謝!),PEP 8 明確表示:

                  as mentioned by S.Lott (Thank you!), PEP 8 says it explicitly:

                  模塊級(jí)別的dunders"(即具有兩個(gè)前導(dǎo)和兩個(gè)尾隨的名稱下劃線),例如 __all____author____version__ 等.應(yīng)該放在模塊文檔字符串之后但在任何導(dǎo)入之前除了來(lái)自 __future__ 導(dǎo)入的語(yǔ)句.

                  Module Level Dunder Names

                  Module level "dunders" (i.e. names with two leading and two trailing underscores) such as __all__, __author__, __version__, etc. should be placed after the module docstring but before any import statements except from __future__ imports.

                  您還應(yīng)該確保版本號(hào)符合 PEP 440 中描述的格式(PEP 386 本標(biāo)準(zhǔn)的先前版本).

                  You should also make sure that the version number conforms to the format described in PEP 440 (PEP 386 a previous version of this standard).

                  這篇關(guān)于將版本嵌入 Python 包的標(biāo)準(zhǔn)方法?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫(kù)的 Python 包)
                    <tbody id='lr1QX'></tbody>
                  <tfoot id='lr1QX'></tfoot>

                    <bdo id='lr1QX'></bdo><ul id='lr1QX'></ul>

                    <small id='lr1QX'></small><noframes id='lr1QX'>

                      <legend id='lr1QX'><style id='lr1QX'><dir id='lr1QX'><q id='lr1QX'></q></dir></style></legend>
                          • <i id='lr1QX'><tr id='lr1QX'><dt id='lr1QX'><q id='lr1QX'><span id='lr1QX'><b id='lr1QX'><form id='lr1QX'><ins id='lr1QX'></ins><ul id='lr1QX'></ul><sub id='lr1QX'></sub></form><legend id='lr1QX'></legend><bdo id='lr1QX'><pre id='lr1QX'><center id='lr1QX'></center></pre></bdo></b><th id='lr1QX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lr1QX'><tfoot id='lr1QX'></tfoot><dl id='lr1QX'><fieldset id='lr1QX'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 黄色毛片网站在线观看 | 日本久久久一区二区三区 | 欧美一级免费观看 | 一区二区三区四区五区在线视频 | 精品视频一区二区三区在线观看 | 伊人网综合 | m豆传媒在线链接观看 | 亚洲精品视频免费观看 | 精品亚洲二区 | 亚洲日本一区二区三区四区 | 日本黄色一级片视频 | 91精品国产91久久久久久吃药 | 天天久 | 91视频在线看 | 91视频在线观看 | 中文字幕 在线观看 | 欧美a区 | 久久久久久久久久久久91 | 国产精品精品久久久久久 | 成人高清视频在线观看 | 欧美区日韩区 | 精精国产xxxx视频在线播放 | 亚洲精品亚洲人成人网 | 久久精品网 | 欧美一级观看 | 欧美久久久久久 | 成人激情视频在线 | 国产区在线免费观看 | 超碰在线免费 | 欧美a在线看| 一级欧美一级日韩片免费观看 | 欧美a v在线 | 91久久综合亚洲鲁鲁五月天 | 91精品久久久久 | 日本一道本 | 精品国产一区二区久久 | 一区在线免费视频 | 免费看a | 最新免费黄色网址 | 精品视频在线免费观看 | 成人欧美一区二区三区视频xxx |