Shipping part of Python standard library

前端 未结 2 663
孤城傲影
孤城傲影 2021-01-26 11:00

How do I ship some standard modules from Python together with my code?

I\'m writing an add-on for Anki, for which I need Queue and threading mo

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-26 11:31

    From the Anki doc:

    For a simple one-file add-on, you can upload the .py file. For multi-file add-ons, please create a subfolder that acts as a Python package, and create a small .py file that imports that package. Using the Japanese support add-on as an example, the structure looks like:

    japanese/file1.py
    japanese/file2.py
    japanese/__init__.py # can be empty; marks the folder as a package
    japanese/
    jp.py
    

    To upload a multi-file add-on, please zip up the folder and the loader .py file and upload the zip.

    The can be the modules you want.

    Checkout html_cleaner and image-occlusion-enhanced on Github if you want to see how others do it.

提交回复
热议问题