用于构造python模块的约定

时间:2014-07-23 08:46:36

标签: python module structure convention pep

是否有用于构造python模块内容的PEP或通常绑定约定? 我目前的结构就像

  1. 模块doctring
  2. 元变量(__ all __,__ author __,__ version__,...)
  3. 包括
  4. 模块方法
  5. 看起来像这样(这里没有模块方法):

    """
    Generic clients
    
    This package contains abstract, generic clients for foreign-API interaction.
    Please see the client's documentation for advises for implementation. 
    """
    __date__ = "16.07.2014"
    __author__ = "My Name <me@company.com>"
    __all__ = ['ImportClient',
               'ExportClient',
               'IEClient', 
               'CRUDClient']
    
    from .abc import CustomerAwareConfigurableSlaveLog
    from ..config import Config
    import pyopenimmo as OpenImmo
    from abc import abstractmethod
    
    class ImportClient(CustomerAwareConfigurableSlaveLog):
        """
        Generic client that can import OpenImmo data
        """
        @abstractmethod
        def import_(self, openimmo):
            """
            Imports OpenImmo data from API
            """
            pass
    
    
    class ExportClient(CustomerAwareConfigurableSlaveLog):
        """
        Generic client that can export OpenImmo data
        """
        @abstractmethod
        def export(self, openimmo): #@UnusedVariable
            """
            Exports OpenImmo data to API
            """
            return
    <snip>
    

    这对我来说似乎很可行,但我也希望其他人能够轻松理解我的代码。

0 个答案:

没有答案