Python 模組庫 自定義工具module

2022-06-07 17:24:10 字數 1074 閱讀 4543

需求:常用的幾個類,來回複製很麻煩,**也不夠整潔

方案:自己製作乙個utils的module,可以通過pip 本地安裝

步驟:

projectname/

setup.py

readme.txt

doc/

documentation.txt

projectname/

__init__.py

foo.py

bar.py

utils/

__init__.py

spam.py

grok.py

examples/

helloworld.py

...

- setup.py

注意package的內容;

#

setup.py

from distutils.core import

setup

setup(name='

projectname',

version='

1.0'

, author='

your name',

author_email='

[email protected]',

url='

',packages=['

projectname

', '

projectname.utils'],

)

- manifest.in

包中需要包含進來的非原始碼檔案

#

manifest.in

include *.txt

recursive-include examples *recursive-include doc *

__init__.py

可以為空,也可以from . import file1

安裝:在setup.py的目錄下:

pip install .

解除安裝:pip uninstall projectname

參考:

自定義工具類01

ftputil ftpclient 工具類 idutils 生成一切id 的策略的工具類。可以使用他生成名稱 jsonutils 物件與json 格式轉換的工具類 public class ftputil 切換到上傳目錄if ftp.changeworkingdirectory basepath f...

(sandbar dll)C 自定義工具條

td.sandbar.menubar menubar td.sandbar.sandbarmanager sandbarmanager td.sandbar.container topsandbardock td.sandbar.view private void form1 load object...

layui自定義工具欄

給大家分享的功能是layui自定義工具欄 功能效果 開啟資料 頭部工具欄區域 關鍵引數 引數型別 string dom boolean 引數說明 demo 指向自定義工具欄模板選擇器 直接傳入工具欄模板字元 true 僅開啟工具欄,不顯示左側模板 default 讓工具欄左側顯示預設的內建模板 在這...