]> khamidou — GitHub mirrors - flanker.git/commitdiff
Changed README from MD to RST. Updated longdesc to point to README.rst
authorRussell Jones <rjones@mailgunhq.com>
Wed, 11 Dec 2013 01:17:03 +0000 (17:17 -0800)
committerRussell Jones <rjones@mailgunhq.com>
Wed, 11 Dec 2013 01:17:03 +0000 (17:17 -0800)
so it can be displayed on PyPi.

README.md [deleted file]
README.rst [new file with mode: 0644]
setup.py

diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index be5451c..0000000
--- a/README.md
+++ /dev/null
@@ -1,203 +0,0 @@
-[![Build Status](https://drone.io/github.com/mailgun/flanker/status.png)](https://drone.io/github.com/mailgun/flanker/latest)
-
-Flanker
-=======
-
-Flanker is an open source parsing library written in Python by the Mailgun Team.
-Flanker currently consists of an address parsing library (`flanker.addresslib`) as
-well as a MIME parsing library (`flanker.mime`).
-
-Detailed documentation is provided in the [User Manual](docs/User Manual.md) as well as the
-[API Reference](docs/API Reference.md). A Quickstart Guide is provided below.
-
-## Quickstart Guide
-
-### Installing
-
-##### Flanker was built and tested with Python 2.7.2.
-
-You can install flanker via `pip` or clone the repo from GitHub.
-
-You'll need Python headers files before you start working with flanker, so install them first:
-
-```shell
-# ubuntu 
-sudo apt-get install python-dev
-# fedora 
-sudo yum install python-devel
-```
-
-If you are using `pip`, simply type:
-
-```shell
-pip install flanker
-```
-
-If you are cloning from GitHub, you can type:
-
-```shell
-git clone git@github.com:mailgun/flanker.git
-cd flanker
-python setup.py install
-```
-
-### Address Parsing
-
-To parse a single mailbox (display name as well as email address):
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.parse('Foo foo@example.com')
-Foo <foo@example.com>
-```
-
-An invalid address is returned as `None`:
-
-```python
->>> from flanker.addresslib import address
->>>
->>> print address.parse('@example.com')
-None
-```
-
-To parse a single email address (no display name):
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.parse('foo@example.com', addr_spec_only=True)
-foo@example.com
-```
-
-To parse an address list:
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.parse_list('foo@example.com, bar@example.com, @example.com')
-[foo@example.com, bar@example.com]
-```
-
-To parse an address list as well as return a tuple containing the parsed 
-addresses and the unparsable portions
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.parse_list('foo@example.com, bar@example.com, @example.com', as_tuple=True)
-[foo@example.com, bar@example.com], ['@example.com']
-```
-
-To parse an address list in strict mode:
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.parse_list('foo@example.com, bar@example.com, @example.com', strict=True)
-[foo@example.com, bar@example.com]
-```
-
-To validate an email address (parse as well as DNS, MX existence, and ESP grammar checks):
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.validate_address('foo@mailgun.com')
-foo@mailgun.com
-```
-
-To validate an address list:
-
-```python
->>> from flanker.addresslib import address
->>>
->>> address.validate_list('foo@mailgun.com, bar@mailgun.com, @mailgun.com', as_tuple=True)
-([foo@mailgun.com, bar@mailgun.com], ['@mailgun.com'])
-```
-
-### MIME Parsing
-
-For the following examples, `message_string` will be set to the following MIME message:
-
-```
-MIME-Version: 1.0
-Content-Type: multipart/alternative; boundary=001a11c1d71697c7f004e6856996
-From: Bob <bob@example.com>
-To: Alice <alice@example.com>
-Subject: hello, world
-Date: Mon, 16 Sep 2013 12:43:03 -0700
-
---001a11c1d71697c7f004e6856996
-Content-Type: text/plain; charset=us-ascii
-
-Hello, *Alice*
-
---001a11c1d71697c7f004e6856996
-Content-Type: text/html; charset=us-ascii
-
-<p>Hello, <b>Alice</b></p>
-
---001a11c1d71697c7f004e6856996--
-```
-
-To parse a MIME message:
-
-```python
->>> from flanker import mime
->>>
->>> msg = mime.from_string(message_string)
-```
-
-MIME message headers (unicode multi-value dictionary with headers):
-
-```python
->>> from flanker import mime
->>>
->>> msg = mime.from_string(message_string)
->>> msg.headers.items()
-[('Mime-Version', '1.0'),
- ('Content-Type',
-  ('multipart/alternative', {'boundary': u'001a11c1d71697c7f004e6856996'})),
- ('From', 'Bob <bob@example.com>'),
- ('To', 'Alice <alice@example.com>'),
- ('Subject', 'hello, world'),
- ('Date', 'Mon, 16 Sep 2013 12:43:03 -0700')]
-```
-
-Useful content_type member with predicates:
-
-```python
->>> from flanker import mime
->>> msg = mime.from_string(message_string)
->>>
->>> msg.content_type.is_multipart()
-True
->>>
->>> msg.content_type.is_singlepart()
-False
->>>
->>> msg.content_type.is_message_container()
-False 
-```
-
-Decoded body of a message:
-
-```python
->>> from flanker import mime
->>> msg = mime.from_string(message_string)
->>>
->>> # None because message is multipart
->>> print msg.body
-None
->>>
->>> for part in msg.parts:
-       print 'Content-Type: {} Body: {}'.format(part, part.body)
-
-Content-Type: (text/plain) Body: Hello, *Alice*
-Content-Type: (text/html) Body: <p>Hello, <b>Alice</b></p>
-
->>> # None because no enclosed messages exist
->>> print msg.enclosed
-None
-```
diff --git a/README.rst b/README.rst
new file mode 100644 (file)
index 0000000..82cb637
--- /dev/null
@@ -0,0 +1,209 @@
+.. image:: https://drone.io/github.com/mailgun/flanker/status.png
+
+*******
+Flanker
+*******
+
+Flanker is an open source parsing library written in Python by the Mailgun Team.
+Flanker currently consists of an address parsing library (`flanker.addresslib`) as
+well as a MIME parsing library (`flanker.mime`).
+
+Detailed documentation is provided in the `User Manual <https://github.com/mailgun/flanker/blob/master/docs/User%20Manual.md>`_ as well as the
+`API Reference <https://github.com/mailgun/flanker/blob/master/docs/API%20Reference.md>`_. A Quickstart Guide is provided below.
+
+Quickstart Guide
+################
+
+Installing
+**********
+
+**Flanker was built and tested with Python 2.7.2.**
+
+You can install flanker via `pip` or clone the repo from GitHub.
+
+You'll need Python headers files before you start working with flanker, so install them first:
+
+::
+
+   # ubuntu 
+   sudo apt-get install python-dev
+   # fedora 
+   sudo yum install python-devel
+
+If you are using `pip`, simply type:
+
+
+::
+
+   pip install flanker
+
+If you are cloning from GitHub, you can type:
+
+::
+
+   git clone git@github.com:mailgun/flanker.git
+   cd flanker
+   python setup.py install
+
+Address Parsing
+***************
+
+To parse a single mailbox (display name as well as email address):
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.parse('Foo foo@example.com')
+   Foo <foo@example.com>
+
+An invalid address is returned as `None`:
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> print address.parse('@example.com')
+   None
+
+To parse a single email address (no display name):
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.parse('foo@example.com', addr_spec_only=True)
+   foo@example.com
+
+To parse an address list:
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.parse_list('foo@example.com, bar@example.com, @example.com')
+   [foo@example.com, bar@example.com]
+
+To parse an address list as well as return a tuple containing the parsed 
+addresses and the unparsable portions
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.parse_list('foo@example.com, bar@example.com, @example.com', as_tuple=True)
+   [foo@example.com, bar@example.com], ['@example.com']
+
+To parse an address list in strict mode:
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.parse_list('foo@example.com, bar@example.com, @example.com', strict=True)
+   [foo@example.com, bar@example.com]
+
+To validate an email address (parse as well as DNS, MX existence, and ESP grammar checks):
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.validate_address('foo@mailgun.com')
+   foo@mailgun.com
+
+To validate an address list:
+
+::
+
+   >>> from flanker.addresslib import address
+   >>>
+   >>> address.validate_list('foo@mailgun.com, bar@mailgun.com, @mailgun.com', as_tuple=True)
+   ([foo@mailgun.com, bar@mailgun.com], ['@mailgun.com'])
+
+MIME Parsing
+************
+
+For the following examples, `message_string` will be set to the following MIME message:
+
+::
+
+   MIME-Version: 1.0
+   Content-Type: multipart/alternative; boundary=001a11c1d71697c7f004e6856996
+   From: Bob <bob@example.com>
+   To: Alice <alice@example.com>
+   Subject: hello, world
+   Date: Mon, 16 Sep 2013 12:43:03 -0700
+   
+   --001a11c1d71697c7f004e6856996
+   Content-Type: text/plain; charset=us-ascii
+   
+   Hello, *Alice*
+   
+   --001a11c1d71697c7f004e6856996
+   Content-Type: text/html; charset=us-ascii
+   
+   <p>Hello, <b>Alice</b></p>
+   
+   --001a11c1d71697c7f004e6856996--
+   
+To parse a MIME message:
+
+::
+
+   >>> from flanker import mime
+   >>>
+   >>> msg = mime.from_string(message_string)
+
+MIME message headers (unicode multi-value dictionary with headers):
+
+::
+
+   >>> from flanker import mime
+   >>>
+   >>> msg = mime.from_string(message_string)
+   >>> msg.headers.items()
+   [('Mime-Version', '1.0'),
+    ('Content-Type',
+     ('multipart/alternative', {'boundary': u'001a11c1d71697c7f004e6856996'})),
+    ('From', 'Bob <bob@example.com>'),
+    ('To', 'Alice <alice@example.com>'),
+    ('Subject', 'hello, world'),
+    ('Date', 'Mon, 16 Sep 2013 12:43:03 -0700')]
+
+Useful content_type member with predicates:
+
+::
+
+   >>> from flanker import mime
+   >>> msg = mime.from_string(message_string)
+   >>>
+   >>> msg.content_type.is_multipart()
+   True
+   >>>
+   >>> msg.content_type.is_singlepart()
+   False
+   >>>
+   >>> msg.content_type.is_message_container()
+   False 
+
+Decoded body of a message:
+
+::
+
+   >>> from flanker import mime
+   >>> msg = mime.from_string(message_string)
+   >>>
+   >>> # None because message is multipart
+   >>> print msg.body
+   None
+   >>>
+   >>> for part in msg.parts:
+          print 'Content-Type: {} Body: {}'.format(part, part.body)
+
+   Content-Type: (text/plain) Body: Hello, *Alice*
+   Content-Type: (text/html) Body: <p>Hello, <b>Alice</b></p>
+
+   >>> # None because no enclosed messages exist
+   >>> print msg.enclosed
+   None
index 836e07de63c30cc50b31fafc8cb5cdd00b451b69..68d93c32a45cdd0d6576266971d5ca07a6fd0a3b 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ from setuptools import setup, find_packages
 setup(name='flanker',
       version='0.3.3',
       description='Mailgun Parsing Tools',
-      long_description='',
+      long_description=open('README.rst').read(),
       classifiers=[],
       keywords='',
       author='Mailgun Inc.',