Mengemas dan mempublikasi

Terbitkan modul anda pada PyPI

Mencantumkan modul pada PyPI adalah salah satu cara paling mudah bagi pengguna untuk memasang paket anda. Silakan melihat ke dokumentasi dan tutorial yang terkait tentang PyPI dan pip untuk paket penerbitan.

For EFB modules, the package is RECOMMENDED to have a name starts with efb-, or in the format of efb-platform-type, e.g. efb-irc-slave or efb-wechat-mp-filter-middleware. If there is a collision of name, you MAY adjust the package name accordingly while keeping the package name starting with efb-.

When you are ready, you may also want to add your module to the Modules Repository of EFB.

Modul penemuan

EH Forwarder Bot menggunakan Setuptools' Entry Point fitur untuk menemukan dan mengelola saluran dan middlewares. Setup.py script atau .egg-info/entry_points.txt, menentukan kelompok dan objek sebagai berikut:

  • Grup untuk saluran utama: ehforwarderbot.master

  • Grup untuk saluran slave: ehforwarderbot.slave

  • Grup untuk middlewares: ehforwarderbot.middleware

Convention for object names is <author>.<platform>, e.g. alice.irc. This MUST also be your module's ID.

Object reference MUST point to your module's class, which is a subclass of either Channel or Middleware.

Contoh

setup.py script

setup(
    # ...
    entry_points={
        "ehforwarderbot.slave": ['alice.irc = efb_irc_slave:IRCChannel']
    },
    # ...
)

.egg-info/entry_points.txt

[ehforwarderbot.slave]
alice.irc = efb_irc_slave:IRCChannel

Modul pribadi

Jika anda ingin mengembangkan dari, atau membuat perubahan pada modul yang ada untuk digunakan secara pribadi, anda dapat memiliki modulnya di modul pribadi direktori.

For such modules, your channel ID MUST be the fully-qualified name of the class. For example, if your class is located at <EFB_BASE_PATH>/modules/bob_irc_mod/__init__.py:IRCChannel, the channel MUST have ID bob_ric_mod.IRCChannel for the framework to recognise it.