prettytable 0.6__tar.gz → 0.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,142 @@
1
+ ########## PrettyTable 0.7 - Feb 17, 2013 ###########
2
+
3
+ * Improved Python 2 and 3 compatibility (2.4-3.2).
4
+ * Improved support for non-Latin characters. Table widths should
5
+ now be calculated correctly for tables with e.g. Japanese text.
6
+ * Table contents can now be read in from a .csv file
7
+ * Table contents can now be read in from a DB-API compatible cursor
8
+ * Table contents can now be read in from a string containing a
9
+ HTML table (thanks to Christoph Robbert for submitting this patch!)
10
+ * new valign attribute controls vertical alignment of text when
11
+ some cells in a row have multiple lines of text and others don't.
12
+ (thanks to Google Code user maartendb for submitting this patch!)
13
+ * hrules attribute can now be set to HEADER, which draws a rule only
14
+ under the header row
15
+ * new vrules attribute controls drawing of vertical rules and can
16
+ be set to FRAME, ALL or NONE
17
+ * new header_style attribute controls formatting of text in table
18
+ headers and can be set to "cap", "title", "upper", "lower" or None
19
+ * Fixed a simple bug regarding validation of max_width (thanks to
20
+ Anthony Toole for pointing out this bug and providing a patch).
21
+ * Fixed a simple bug regarding initialisation of int_format value
22
+ for new tables (thanks to Ingo Schmiegel for pointing out this
23
+ bug!)
24
+ * Fixed a bug regarding some constructor keywords, such as "border",
25
+ being ignored (thanks to Google Code user antonio.s.messina for
26
+ reporting this bug).
27
+
28
+ ########## PrettyTable 0.6 - May 5, 2012 ##########
29
+
30
+ * Code is now simultaneously compatible with Python 2 and 3
31
+ * Replaced all setter methods with managed attributes
32
+ * All styling options can now be set persistently as managed attributes
33
+ * Added "add_style" method to make setting style options easily
34
+ * Added "del_row", "clear_rows" and "clear" methods to facilitate
35
+ removal of data from table.
36
+ * Added "copy" method to facilitate cloning of a table.
37
+ * Removed caching functionality, which added complexity and fragility
38
+ for relatively little gain
39
+ * Removed methods that just printed strings produced by get_string and
40
+ get_html_string - just use inbuilt print!
41
+ * Improved unicode support (thanks to Google Code user ru.w31rd0 for
42
+ patch!)
43
+ * Added support for decimal and floating point number formatting
44
+ support (thanks to Google Code user willfurnass for the suggestion!)
45
+ * Added support for using a custom key sorting methods (thanks to
46
+ Google Code user amannijhawan for the suggestion!)
47
+ * Added support for line breaks in data (suggested and implemented by
48
+ Klein Stephane)
49
+ * Added support for max column widths (thanks to Tibor Arpas for the
50
+ suggestion!)
51
+ * Fixed table slicing
52
+ * Fixed bug where closing <tr/> tags in HTML tables were not printed
53
+ (thanks to Google Code user kehander for reporting this bug!)
54
+ * Fixed HTML table sorting bug (thanks to Google Code user dougbeal
55
+ for reporting this bug!)
56
+ * Fixed bug whereby changing field_names did not recompute widths
57
+ (thanks to Google Code user denilsonsa for reporting this bug!)
58
+
59
+ ########## PrettyTable 0.5 - May 26, 2009 ##########
60
+
61
+ * Fixed a bug whereby printing with headers=False and border=False
62
+ would introduce an extraneous newline. Thanks to Alexander Lamaison
63
+ for reporting this bug.
64
+ * When printing with headers=False, column widths will now be reduced
65
+ as appropriate in columns where the field name is wider than the
66
+ data. Thanks to Alexander Lamaison for suggesting this behaviour.
67
+ * Support for Unicode has improved. Thanks to Chris Clark for
68
+ submitting this improvement.
69
+ * The value of the "border" argument now correctly controls the
70
+ presence of a border when printing HTML tables with print_html or
71
+ get_html_string, instead of being incorrectly ignored. Thanks to
72
+ Chris Clark for fixing this.
73
+ * The print_html and get_html_string methods now accept an
74
+ "attributes" argument which is a dictionary of name/value pairs to be
75
+ placed inside the <table> tag (so you can, e.g. set class, name or id
76
+ values in order to style your table with CSS). Thanks to Chris Clark
77
+ for submitting this feature.
78
+ * The print_html and get_html_string methods now, by default, do their
79
+ best to match the various formatting options in their HTML output.
80
+ They use inline CSS to adjust the alignment of data in columns, the
81
+ padding widths of columns and in some cases the border settings. You
82
+ can give either method a "format=False" attribute to turn this
83
+ behaviour off if you want to do your own styling. With "format=False"
84
+ the methods print a "bare bones" table, similar to the default
85
+ behaviour in 0.4.
86
+
87
+ ########## PrettyTable 0.4 - May 13, 2009 ##########
88
+
89
+ * Added "add_column" method to enable building tables up column-by-column.
90
+ * Added "print_HTML" and "get_HTML_string" methods to enable HTML table
91
+ production.
92
+ * Added "set_border_chars" method to enable control over characters used to
93
+ draw the table border.
94
+ * Added "set_left_padding" and "set_right_padding" methods to allow
95
+ independent padding control for both sides of a column.
96
+ * Added "sortby" option to enable column sorting.
97
+ * Added "header" option to enable switching off field name printing at top of
98
+ table.
99
+ * Modified "hrules" option to enable greater control over presence of
100
+ horizontal lines.
101
+ * Added "border" option to enable switching off all line printing.
102
+
103
+ Thanks to Tim Cera, Chris Clark, Alexander Lamaison for suggesting and helping
104
+ to test many of the new features in this release.
105
+
106
+ ########## PrettyTable 0.3 - May 01, 2009 ##########
107
+
108
+ * Added "padding_width" option to control the number of spaces between the
109
+ vertical line rules at the edges of a column and its content. This can be
110
+ set as a keyword argument to the constructor or after instantiation using
111
+ the "set_padding_width" method. The value is set to 1 by defaut. If your
112
+ table is too wide for a small screen with this value, setting it to 0 might
113
+ help you squeeze it in.
114
+
115
+ Thanks to Chris Clark for contributing a patch against 0.2.1 to add this
116
+ feature!
117
+
118
+ ########## PrettyTable 0.2.1 - April 29, 2009 ##########
119
+
120
+ * Caching no longer breaks when using the "printt(fields=[...])" syntax. The
121
+ list of fields was not hashable and hence could not be used as a dictionary
122
+ key. I fixed this using the output of the "cPickle" module's "dumps"
123
+ function as the dictionary key instead.
124
+ * Horizontal lines are now the appropriate length when the above syntax is
125
+ used.
126
+
127
+ Thanks to Julien Koesten for reporting these bugs and testing the fixes almost
128
+ immediately after the release of 0.2!
129
+
130
+ ########## PrettyTable 0.2 - April 29, 2009 ##########
131
+
132
+ * Added "get_string" method.
133
+ * Added "__str__" method (which just calls "get_string") to enable nice
134
+ "print x" syntax.
135
+ * Can now pass field names as a constructor argument.
136
+ * Return values of "get_string" are cached in a dictionary that is only
137
+ cleared after a call to "add_row" or something else which invalidates the
138
+ cache.
139
+
140
+ ########## PrettyTable 0.1 - February 26, 2009 #########
141
+
142
+ * Original release
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2009-2013 Luke Maurits <luke@maurits.id.au>
2
+ # All rights reserved.
3
+ # With contributions from:
4
+ # * Chris Clark
5
+ # * Christoph Robbert
6
+ # * Klein Stephane
7
+ # * "maartendb"
8
+ #
9
+ # Redistribution and use in source and binary forms, with or without
10
+ # modification, are permitted provided that the following conditions are met:
11
+ #
12
+ # * Redistributions of source code must retain the above copyright notice,
13
+ # this list of conditions and the following disclaimer.
14
+ # * Redistributions in binary form must reproduce the above copyright notice,
15
+ # this list of conditions and the following disclaimer in the documentation
16
+ # and/or other materials provided with the distribution.
17
+ # * The name of the author may not be used to endorse or promote products
18
+ # derived from this software without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ # POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ include COPYING
2
+ include CHANGELOG
3
+ include README
4
+ include prettytable_test.py
@@ -1,14 +1,16 @@
1
- Metadata-Version: 1.1
1
+ Metadata-Version: 1.0
2
2
  Name: prettytable
3
- Version: 0.6
3
+ Version: 0.7.1
4
4
  Summary: A simple Python library for easily displaying tabular data in a visually appealing ASCII table format
5
5
  Home-page: http://code.google.com/p/prettytable
6
6
  Author: Luke Maurits
7
7
  Author-email: luke@maurits.id.au
8
- License: UNKNOWN
8
+ License: BSD (3 clause)
9
9
  Description: UNKNOWN
10
10
  Platform: UNKNOWN
11
11
  Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 2.4
13
+ Classifier: Programming Language :: Python :: 2.5
12
14
  Classifier: Programming Language :: Python :: 2.6
13
15
  Classifier: Programming Language :: Python :: 2.7
14
16
  Classifier: Programming Language :: Python :: 3
@@ -1,4 +1,4 @@
1
- TUTORIAL ON HOW TO USE THE PRETTYTABLE 0.6 API
1
+ TUTORIAL ON HOW TO USE THE PRETTYTABLE 0.6+ API
2
2
 
3
3
  *** This tutorial is distributed with PrettyTable and is meant to serve
4
4
  as a "quick start" guide for the lazy or impatient. It is not an
@@ -13,15 +13,15 @@ Let's suppose you have a shiny new PrettyTable:
13
13
  from prettytable import PrettyTable
14
14
  x = PrettyTable()
15
15
 
16
- and you want to put some data into it. You have two (sane) options
16
+ and you want to put some data into it. You have a few options.
17
17
 
18
18
  == Row by row ==
19
19
 
20
- You can add data one row at a time. To do this you need to set the field names
21
- first using the `set_field_names` method, and then add the rows one at a time
20
+ You can add data one row at a time. To do this you can set the field names
21
+ first using the `field_names` attribute, and then add the rows one at a time
22
22
  using the `add_row` method:
23
23
 
24
- x.set_field_names(["City name", "Area", "Population", "Annual Rainfall"])
24
+ x.field_names = ["City name", "Area", "Population", "Annual Rainfall"]
25
25
  x.add_row(["Adelaide",1295, 1158259, 600.5])
26
26
  x.add_row(["Brisbane",5905, 1857594, 1146.4])
27
27
  x.add_row(["Darwin", 112, 120900, 1714.7])
@@ -54,6 +54,39 @@ nicely as if you'd done it using just one of the two approaches. Tables built
54
54
  this way are kind of confusing for other people to read, though, so don't do
55
55
  this unless you have a good reason.
56
56
 
57
+ == Importing data from a CSV file ==
58
+
59
+ If you have your table data in a comma separated values file (.csv), you can
60
+ read this data into a PrettyTable like this:
61
+
62
+ from prettytable import from_csv
63
+ fp = open("myfile.csv", "r")
64
+ mytable = from_csv(fp)
65
+ fp.close()
66
+
67
+ == Importing data from a HTML string ==
68
+
69
+ If you have a string containing a HTML <table>, you can read this data into a
70
+ PrettyTable like this:
71
+
72
+ from prettytable import from_html
73
+ mytable = from_html(html_string)
74
+
75
+ == Importing data from a database cursor ==
76
+
77
+ If you have your table data in a database which you can access using a library
78
+ which confirms to the Python DB-API (e.g. an SQLite database accessible using
79
+ the sqlite module), then you can build a PrettyTable using a cursor object,
80
+ like this:
81
+
82
+ import sqlite3
83
+ from prettytable import from_db_cursor
84
+
85
+ connection = sqlite3.connect("mydb.db")
86
+ cursor = connection.cursor()
87
+ cursor.execute("SELECT field1, field2, field3 FROM my_table")
88
+ mytable = from_db_cursor(cursor)
89
+
57
90
  == Getting data out ==
58
91
 
59
92
  There are three ways to get data out of a PrettyTable, in increasing order of
@@ -99,8 +132,9 @@ print(x)
99
132
 
100
133
  in Python 3.x.
101
134
 
102
- The old x.printt() method from versions 0.5 and earlier has been removed. To
103
- pass options changing the look of the table, use the get_string() method
135
+ The old x.printt() method from versions 0.5 and earlier has been removed.
136
+
137
+ To pass options changing the look of the table, use the get_string() method
104
138
  documented below:
105
139
 
106
140
  print x.get_string()
@@ -314,9 +348,11 @@ The options are these:
314
348
  or not the first row of the table is a header showing the names of all the
315
349
  fields.
316
350
  * `hrules` - Controls printing of horizontal rules after rows. Allowed
317
- values: FRAME, ALL, NONE - note that these are variables defined inside the
318
- `prettytable` module so make sure you import them or use `prettytable.FRAME`
319
- etc.
351
+ values: FRAME, HEADER, ALL, NONE - note that these are variables defined
352
+ inside the `prettytable` module so make sure you import them or use
353
+ `prettytable.FRAME` etc.
354
+ * `vrules` - Controls printing of vertical rules between columns. Allowed
355
+ values: FRAME, ALL, NONE.
320
356
  * `int_format` - A string which controls the way integer data is printed.
321
357
  This works like: print "%<int_format>d" % data
322
358
  * `float_format` - A string which controls the way floating point data is
@@ -390,7 +426,7 @@ exactly the same way as ASCII printing.
390
426
  By default, PrettyTable outputs HTML for "vanilla" tables. The HTML code is
391
427
  quite simple. It looks like this:
392
428
 
393
- <table border="1">
429
+ <table>
394
430
  <tr>
395
431
  <th>City name</th>
396
432
  <th>Area</th>
@@ -437,7 +473,7 @@ x.print_html(attributes={"name":"my_table", "class":"red_table"})
437
473
 
438
474
  will print:
439
475
 
440
- <table border="1" name="my_table" class="red_table">
476
+ <table name="my_table" class="red_table">
441
477
  <tr>
442
478
  <th>City name</th>
443
479
  <th>Area</th>
@@ -1,14 +1,16 @@
1
- Metadata-Version: 1.1
1
+ Metadata-Version: 1.0
2
2
  Name: prettytable
3
- Version: 0.6
3
+ Version: 0.7.1
4
4
  Summary: A simple Python library for easily displaying tabular data in a visually appealing ASCII table format
5
5
  Home-page: http://code.google.com/p/prettytable
6
6
  Author: Luke Maurits
7
7
  Author-email: luke@maurits.id.au
8
- License: UNKNOWN
8
+ License: BSD (3 clause)
9
9
  Description: UNKNOWN
10
10
  Platform: UNKNOWN
11
11
  Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 2.4
13
+ Classifier: Programming Language :: Python :: 2.5
12
14
  Classifier: Programming Language :: Python :: 2.6
13
15
  Classifier: Programming Language :: Python :: 2.7
14
16
  Classifier: Programming Language :: Python :: 3
@@ -1,5 +1,9 @@
1
+ CHANGELOG
2
+ COPYING
3
+ MANIFEST.in
1
4
  README
2
5
  prettytable.py
6
+ prettytable_test.py
3
7
  setup.py
4
8
  prettytable.egg-info/PKG-INFO
5
9
  prettytable.egg-info/SOURCES.txt