README.rst 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ========================
  2. EditorConfig Python Core
  3. ========================
  4. .. image:: https://secure.travis-ci.org/editorconfig/editorconfig-core-py.png?branch=master
  5. :target: http://travis-ci.org/editorconfig/editorconfig-core-py
  6. EditorConfig Python Core provides the same functionality as the
  7. `EditorConfig C Core <https://github.com/editorconfig/editorconfig-core>`_.
  8. EditorConfig Python core can be used as a command line program or as an
  9. importable library.
  10. EditorConfig Project
  11. ====================
  12. EditorConfig makes it easy to maintain the correct coding style when switching
  13. between different text editors and between different projects. The
  14. EditorConfig project maintains a file format and plugins for various text
  15. editors which allow this file format to be read and used by those editors. For
  16. information on the file format and supported text editors, see the
  17. `EditorConfig website <http://editorconfig.org>`_.
  18. Installation
  19. ============
  20. With setuptools::
  21. sudo python setup.py install
  22. Getting Help
  23. ============
  24. For help with the EditorConfig core code, please write to our `mailing list
  25. <http://groups.google.com/group/editorconfig>`_. Bugs and feature requests
  26. should be submitted to our `issue tracker
  27. <https://github.com/editorconfig/editorconfig/issues>`_.
  28. If you are writing a plugin a language that can import Python libraries, you
  29. may want to import and use the EditorConfig Python Core directly.
  30. Using as a Library
  31. ==================
  32. Basic example use of EditorConfig Python Core as a library:
  33. .. code-block:: python
  34. from editorconfig import get_properties, EditorConfigError
  35. filename = "/home/zoidberg/humans/anatomy.md"
  36. try:
  37. options = get_properties(filename)
  38. except EditorConfigError:
  39. print "Error occurred while getting EditorConfig properties"
  40. else:
  41. for key, value in options.items():
  42. print "%s=%s" % (key, value)
  43. For details, please take a look at the `online documentation
  44. <http://pydocs.editorconfig.org>`_.
  45. Running Test Cases
  46. ==================
  47. `Cmake <http://www.cmake.org>`_ has to be installed first. Run the test cases
  48. using the following commands::
  49. cmake .
  50. ctest .
  51. Use ``-DPYTHON_EXECUTABLE`` to run the tests using an alternative versions of
  52. Python (e.g. Python 3)::
  53. cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 .
  54. ctest .
  55. License
  56. =======
  57. Unless otherwise stated, all files are distributed under the PSF license. The
  58. odict library (editorconfig/odict.py) is distributed under the New BSD license.
  59. See LICENSE.txt file for details on PSF license.