Wie Doku-Head in .py dateien aufbauen...
Verfasst: Freitag 1. Dezember 2006, 16:47
Ich möchte meine PyLucid Sourcedateien etwas aufräumen... Ich hab z.B. immer __history__ und __version__ drin, pflege diese aber nicht wirklich gut... Somit will ich mal die Header aufräumen...
Aber wie gestalten???
Es gibt das verschiedene Variante:
http://trac.edgewall.org/browser/trunk/ ... achment.py
http://pysvn.tigris.org/source/browse/p ... _dialog.py
http://trac.pocoo.org/browser/pocoo/trunk/pocoo/db.py
http://pylucid.net/trac/browser/trunk/PyLucid_app.py
http://gelb.bcom.at/trac/misc/browser/s ... dressdb.py
Ich glaube die Liste kann man endlos lange führen Wenn man sich die Python Lib selber anschaut gibt es da auch nichts einheitliches...
An für sich, finde ich es nicht schlecht __author__, __license__ und __url__ zu nutzten... Aber was ist wenn mehrere Leute daran gearbeitet haben??? Bei __author__ eine Liste machen?
Außerdem werden diese Angaben bei jedem einlesen auch als echte Python Objekte gepast... Ein großer Dok-String wird im Optimize Modus einfach ignoriert... Mag sich da nur um ein paar MiliSek. handeln, aber wenn es in jeder Datei geparst werden muß?
Also was machen???
Aber wie gestalten???
Es gibt das verschiedene Variante:
http://trac.edgewall.org/browser/trunk/ ... achment.py
Code: Alles auswählen
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2005 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://trac.edgewall.org/log/.
#
# Author: Jonas Borgström <jonas@edgewall.com>
# Christopher Lenz <cmlenz@gmx.de>
from datetime import datetime
...
Code: Alles auswählen
'''
====================================================================
Copyright (c) 2003-2006 Barry A Scott. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
====================================================================
wb_subversion_properties_dialog.py
'''
import os
Code: Alles auswählen
# -*- coding: utf-8 -*-
"""
pocoo.db
~~~~~~~~
Database support, a thin layer on top of SQLAlchemy.
How to use the database layer
=============================
TODO: this needs to be written.
:copyright: 2006 by Georg Brandl, Armin Ronacher.
:license: GNU GPL, see LICENSE for more details.
"""
import os
...
Code: Alles auswählen
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# copyleft: jensdiemer.de (GPL v2 or above)
__author__ = "Jens Diemer (www.jensdiemer.de)"
__license__ = """GNU General Public License v2 or above -
http://www.opensource.org/licenses/gpl-license.php"""
__url__ = "http://www.PyLucid.org"
__version__ = "0.7.1beta"
__info__ = """<a href="%s" title="\
PyLucid - A OpenSource CMS in pure Python CGI by Jens Diemer">PyLucid</a> \
v%s""" % (__url__, __version__)
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
"""
Kleine Adressdatenbank mit einfacher Kommandozeilenoberfläche.
Diese Adressdatenbank soll die Verwendung von pysqlite demonstrieren.
Das besondere Format der Docstrings ist für die Verwendung von
epydoc_ optimiert.
.. _epydoc: http://epydoc.sourceforge.net/
Created: 2006-07-10 by Gerold
Requirements: Python: http://www.python.org
pysqlite: http://initd.org/tracker/pysqlite
"""
import os
...
Ich glaube die Liste kann man endlos lange führen Wenn man sich die Python Lib selber anschaut gibt es da auch nichts einheitliches...
An für sich, finde ich es nicht schlecht __author__, __license__ und __url__ zu nutzten... Aber was ist wenn mehrere Leute daran gearbeitet haben??? Bei __author__ eine Liste machen?
Außerdem werden diese Angaben bei jedem einlesen auch als echte Python Objekte gepast... Ein großer Dok-String wird im Optimize Modus einfach ignoriert... Mag sich da nur um ein paar MiliSek. handeln, aber wenn es in jeder Datei geparst werden muß?
Also was machen???