透過許多小步驟建立 Biopython!
以下說明要求您具有對一些伺服器和程式碼儲存庫的存取權。開始時,請務必擁有對以下的寫入權限
如果您沒有上述任何權限,請詢問。
我們假設您已將這些儲存庫複製到 ~/repositories/
下,並且 git origin
是 Biopython 官方的儲存庫副本。
我們假設您正在執行 Linux (但 macOS 應該也可以),並且已安裝下列工具 (加上盡可能多的 Biopython 可選相依性以進行本機測試)
使用 git 確保我擁有最新的程式碼
$ cd ~/repositories/biopython
$ git checkout master
$ git pull origin master
確保 README.rst
檔案仍為最新
將任何重要資訊新增至 NEWS.rst
或 DEPRECATED.rst
- 您可以像這樣取得最近 git 變更的日誌 (請適當調整日期)
$ git log --since="2020/05/25" --reverse --pretty="medium"
確保 CONTRIB.rst
仍為最新
確保 setup.py
和 MANIFEST.in
仍為最新
更新版本號碼並設定發佈資料
Bio/__init__.py
NEWS.rst
- 填寫發佈日期$ git commit Bio/__init__.py NEWS.rst -m "Call this Biopython 1.78"
進行最後檢查以確保已簽入內容
$ rm -r build
$ rm Tests/*.pyc
$ make clean -C Doc
$ git status
建立 Biopython 並執行最後的回歸測試
drevil:~biopython> python setup.py build
drevil:~biopython> python setup.py test
同時執行測試 (例如使用不同版本的 Python) 是有風險的,因為兩個執行緒都可能嘗試讀取/寫入相同的臨時檔案。
將此推送至 github,如果一切順利,此提交將被標記為發佈版本 (除非在建置文件時或在測試 tar 包時發現問題)
$ git push origin master
在其他地方檢查乾淨的版本
drevil:~tmp1/> git clone https://github.com/biopython/biopython.git
drevil:~tmp1/> cd biopython
在 Doc 中建立文件 PDF (我們已自動化線上 HTML 版本;需要安裝 latexmk
等)
drevil:~tmp1/biopython/> pip install -r .circleci/requirements-sphinx.txt
drevil:~tmp1/biopython/> make -C Doc latexpdf
drevil:~tmp1/biopython/> cp Doc/_build/latex/Biopython_doc.pdf Doc/
drevil:~tmp1/biopython/> make clean -C Doc
建立原始碼發佈版本
drevil:~tmp1/biopython> python setup.py sdist --formats=gztar,zip
在其他地方解壓縮檔案
drevil:~tmp1/biopython/> cd ..
drevil:~tmp1/> tar -xzvf biopython/dist/biopython-1.78.tar.gz
drevil:~tmp1/> cd biopython-1.78
檢查以確保它包含 Doc 底下的文件 PDF 檔案
確保我可以建立 (不會安裝和使用此版本) 並測試它 (使用 tar 包測試檔案)
drevil:~tmp1/biopython-1.78/> python -m pip install . --prefix /tmp/test-install
drevil:~tmp1/biopython-1.78/> cd Tests && python run_tests.py
此處 (在測試中) 失敗的常見原因之一是原始碼發佈版本中缺少範例檔案:將它們新增至 MANIFEST.in
自 Biopython 1.74 以來,Sphinx 已透過持續整合處理 API 文件,但您仍然必須更新「最新」符號連結。
$ cd ~/repositories/docs/
$ git fetch origin
$ git checkout gh-pages # should only be this one branch
$ git rebase origin/gh-pages # get any changes
$ rm latest
$ ln -s 1.78 latest
$ git commit latest -m "Update 'latest' symlink to point at 1.78"
$ git push origin gh-pages
手動更新網站上的教學課程和 PDB FAQ。
$ cd ~/repositories/DIST/docs/tutorial/
$ git fetch origin
$ git checkout gh-pages # should only be this one branch
$ git rebase origin/gh-pages # get any changes
$ cp ../../../biopython/Doc/biopdb_faq.pdf .
$ cp ../../../biopython/Doc/Tutorial.html Tutorial-1.80.html
$ cp ../../../biopython/Doc/Tutorial.pdf Tutorial-1.80.pdf
$ rm Tutorial.html Tutorial.pdf
$ ln -s Tutorial-1.80.html Tutorial.html
$ ln -s Tutorial-1.80.pdf Tutorial.pdf
$ git add Tutorial-1.80.html Tutorial-1.80.pdf
$ git commit Tutorial-1.80.html Tutorial-1.80.pdf Tutorial.html Tutorial.pdf biopdb_faq.pdf -m "Tutorial and FAQ for Biopython 1.80"
$ git push origin gh-pages
現在我們使用 https://github.com/biopython/biopython-wheels 來建置 Wheel,方法是將 .github/workflows/cibuildwheel.yml
中的 git checkout
行更新為新發佈版本的提交雜湊 (如果一切順利,將會取得 git 標籤)。
$ cd ~/repositories
$ git clone git@github.com:biopython/biopython-wheels.git
$ cd biopython-wheels/
$ git submodule update --init
$ emacs .github/workflows/cibuildwheel.yml # update git checkout line
$ git commit .github/workflows/cibuildwheel.yml -m "Build Biopython 1.xx"
$ git push origin master
檢查 Wheel 是否在 GitHub Actions 執行上建置。
您似乎不需要更新 biopython
git 子模組,但如果您需要,這似乎可以運作。
$ git submodule foreach git pull origin master
$ git commit -a -m "Update submodules"
$ git push origin master
成功的 Wheel 將會在 GitHub Actions 執行的頁尾中,透過 artifact.zip
檔案提供。將此檔案下載並解壓縮到您的 ~/repository/biopython/DIST/
資料夾。我們稍後將使用 Twine 將這些檔案上傳到 PyPI。
如果您有 Windows 電腦,請移除任何先前的 Biopython 安裝,並確認 Windows Wheel 檔案是否運作。
回到主要儲存庫,標記發佈版本
$ cd .../tmp1/biopython/
$ git tag biopython-178
$ git push origin master --tags
透過 GitHub Pages DIST
儲存庫將新的發佈 tar 包和 zip 上傳到網站。
$ cp dist/biopython-1.78.* ~/repositories/DIST/
$ cd ~/repositories/DIST/
$ git add biopython-1.78.*
$ git commit biopython-1.78.* -m "Downloads for Biopython 1.78"
$ shasum -a 256 biopython-1.78.*
$ md5sum biopython-1.78.*
$ git commit --amend # paste checksums into comment
$ git push origin gh-pages
上傳到 python 套件索引 (beta/alpha 等級版本除外)
$ cd ~/repositories/biopython/
$ pip install twine
$ twine upload dist/biopython-1.78.tar.gz
$ twine upload dist/biopython-1.78-*.whl
您需要在 pypi 上擁有登入帳戶,並在 Biopython 中註冊才能上傳新版本
檢查此網址是否正常運作 https://pypi.python.org/pypi/biopython/
更新網站
biopython.github.io
儲存庫,(否則請確保您的副本為最新)$ cd ~/repositories
$ git clone git@github.com:biopython/biopython.github.io.git
$ cd ~/repositories/biopython.github.io
$ emacs _config.yml
$ emacs wiki/Biopython.md
$ emacs wiki/Download.md
$ git commit _config.yml wiki/Biopython.md wiki/Download.md -m "Biopython 1.78 released"
公告
一旦 Conda-Forge 出現在 PyPI 上,它應該會自動開啟提取請求以更新套件。請在 github.com/conda-forge/biopython-feedstock 上檢查是否有新的提取請求,一旦合併,它會將新版本上傳到 anaconda.org/conda-forge/biopython
再次更新版本號碼
Bio/__init__.py
版本NEWS.rst
中開始下一個版本的條目加入後綴 .dev0
表示這是開發版本,例如,如果您有 __version__ = "1.78"
,請將其變更為 1.79.dev0