python-libraclient/HACKING.rst
Endre Karlson 00861be6ab Bring repository up to speed
* Adds the "build" folder to be ignored by git
    * Adds CONTRIBUTING.rst file contribution instructions.
    * Adds HACKING.rst for hacking guidelines
    * Renames README > README.rst to be more inline with other client repos.
    * Moves *requirements.txt into root to be inline with other repos.
    * Adds LICENSE with Apache license contents
    * Changes project to use PBR for versioning etc instead of hardcoded
      versioning - other change is being made in order to tag the client
      repository to utilize TAGS / git SHA1 for versioning instead when doing
      sdist etc..

Change-Id: I707fb628cd292be807e6e0fd7ad0062635051953
2013-10-14 15:05:18 +02:00

1.4 KiB

Libra Client Style Commandments

Libra Client Specific Commandments

None so far

Text encoding

  • All text within python code should be of type 'unicode'.

    WRONG:

    >>> s = 'foo' >>> s 'foo' >>> type(s) <type 'str'>

    RIGHT:

    >>> u = u'foo' >>> u u'foo' >>> type(u) <type 'unicode'>

  • Transitions between internal unicode and external strings should always be immediately and explicitly encoded or decoded.

  • All external text that is not explicitly encoded (database storage, commandline arguments, etc.) should be presumed to be encoded as utf-8.

    WRONG:

    mystring = infile.readline() myreturnstring = do_some_magic_with(mystring) outfile.write(myreturnstring)

    RIGHT:

    mystring = infile.readline() mytext = s.decode('utf-8') returntext = do_some_magic_with(mytext) returnstring = returntext.encode('utf-8') outfile.write(returnstring)

Running Tests

The testing system is based on a combination of tox and testr. If you just want to run the whole suite, run tox and all will be fine. However, if you'd like to dig in a bit more, you might want to learn some things about testr itself. A basic walkthrough for OpenStack can be found at http://wiki.openstack.org/testr