Open uchihashikenshi opened 4 years ago
https://test.pypi.org/project/matchernet-py-001/0.1/ こちらでテスト公開。 requirements.txt の修正などはまだ。
再アップロード手順。
$ rm -f -r matchernet_py_001.egg-info/* dist/*
$ python setup.py sdist bdist_wheel
$ twine upload --repository testpypi dist/*
ドキュメントの公開手順。
まず、/docs
にAPIドキュメント用の Sphinx
プロジェクトを作成する。
$ sphinx-apidoc -F -o docs/ matchernet_py_001/
$ ls docs/
Makefile conf.py
_build index.rst
_static make.bat
_templates matchernet_py_001.rst
Makefile
ができているので、make
を実行することでドキュメントが自動生成される。
$ cd docs
$ make html
docs/_build/html
配下に、HTML
ファイルができている。
$ ls html/
_modules matchernet_py_001.html
_sources objects.inv
_static py-modindex.html
genindex.html search.html
index.html searchindex.js
テスト公開されたことで、pip install
したものを使うようになりますが、こちらを利用するとバージョンが上がるまで開発状況が反映されなくなります。
手元で修正・新規開発したもの、あるいは最新のブランチを使用したい場合は、以下のようにして手元のライブラリの優先順位を上げてください。
import sys
import os
sys.path.insert(1, os.getcwd())
# ライブラリを検索する際、現在のディレクトリが実行ファイルパスの次に優先順位が高くなる
docs/
以下をドキュメントとして公開する方針にした。
その際、conf.py
に extensions
を2つ追加。
'sphinx.ext.githubpages',
'sphinx.ext.mathjax'
sphinx.ext.githubpages
によって .nojekyll
が生成され、css
が反映されるようになる。
ドキュメントの公開手順を更新。
まず、/docs
にAPIドキュメント用の Sphinx
プロジェクトを作成する。
$ sphinx-apidoc -F -o docs/ matchernet_py_001/
$ ls docs/
Makefile conf.py
_build index.rst
_static make.bat
_templates matchernet_py_001.rst
Makefile
ができているので、make
を実行することでドキュメントが自動生成される。
$ cd docs
$ make html
docs/_build/html
配下に、HTML
ファイルができている。
$ ls html/
_modules matchernet_py_001.html
_sources objects.inv
_static py-modindex.html
genindex.html search.html
index.html searchindex.js
ドキュメントとして公開されるのは docs/
以下であるため、docs/_build/html
のファイルをdocs
以下に持ってくる必要がある。
# pwd: docs
$ cp -pr _build/html/* ./
$ cp -pr _build/html/.nojekyll ./
隠しファイルはデフォルトでコピーできないので、別途 .nojekyll
のコピーも行っている。
以上を行ったあと、add & commit & push でドキュメントが更新される。
pypi
のパッケージページの readme
に画像を反映させるには外部リンクの取得が必要。
https://stackoverflow.com/questions/41983209/how-do-i-add-images-to-a-pypi-readme-that-works-on-github/46875147
目的
PyPI
にテストでパッケージ公開を行う提案内容
__init__.py
: パッケージ基本情報を記述setup.py
: パッケージ作成情報を記述MANIFEST.in
: 配布物に追加、または除外するファイルを記述 まで行った上で、テストアップロード、PyPI
からのインストールまで確認。タスク
関連