pyfastexcel 0.0.5__tar.gz → 0.0.7__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.
- pyfastexcel-0.0.7/PKG-INFO +183 -0
- pyfastexcel-0.0.7/README.md +159 -0
- pyfastexcel-0.0.7/pyfastexcel/__init__.py +13 -0
- pyfastexcel-0.0.7/pyfastexcel/driver.py +717 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel/pyfastexcel.dll +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel/pyfastexcel.so +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel/utils.py +42 -2
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel/writer.py +115 -134
- pyfastexcel-0.0.7/pyfastexcel.egg-info/PKG-INFO +183 -0
- pyfastexcel-0.0.7/pyfastexcel.egg-info/requires.txt +2 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/setup.cfg +2 -2
- pyfastexcel-0.0.5/PKG-INFO +0 -309
- pyfastexcel-0.0.5/README.md +0 -285
- pyfastexcel-0.0.5/pyfastexcel/__init__.py +0 -6
- pyfastexcel-0.0.5/pyfastexcel/driver.py +0 -310
- pyfastexcel-0.0.5/pyfastexcel.egg-info/PKG-INFO +0 -309
- pyfastexcel-0.0.5/pyfastexcel.egg-info/requires.txt +0 -2
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/LICENSE +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel.egg-info/SOURCES.txt +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel.egg-info/dependency_links.txt +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel.egg-info/not-zip-safe +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/pyfastexcel.egg-info/top_level.txt +0 -0
- {pyfastexcel-0.0.5 → pyfastexcel-0.0.7}/setup.py +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyfastexcel
|
|
3
|
+
Version: 0.0.7
|
|
4
|
+
Summary: High performace excel file generation library.
|
|
5
|
+
Home-page: https://github.com/Zncl2222/pyfastexcel
|
|
6
|
+
Author: Zncl2222
|
|
7
|
+
Author-email: 3002shinning@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Go
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.7
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: msgspec
|
|
23
|
+
Requires-Dist: openpyxl-style-writer>=1.1.3
|
|
24
|
+
|
|
25
|
+
# pyfastexcel
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
[](https://goreportcard.com/report/github.com/Zncl2222/pyfastexcel)
|
|
29
|
+

|
|
30
|
+

|
|
31
|
+
[](https://app.codacy.com/gh/Zncl2222/pyfastexcel/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
32
|
+
[](https://codecov.io/gh/Zncl2222/pyfastexcel)
|
|
33
|
+
[](https://pyfastexcel.readthedocs.io/en/stable/?badge=stable)
|
|
34
|
+
|
|
35
|
+
This package enables high-performance Excel writing by integrating with the
|
|
36
|
+
streaming API from the golang package
|
|
37
|
+
[excelize](https://github.com/qax-os/excelize). Users can leverage this
|
|
38
|
+
functionality without the need to write any Go code, as the entire process
|
|
39
|
+
can be accomplished through Python.
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- Python and Golang Integration: Seamlessly call Golang built shared
|
|
44
|
+
libraries from Python.
|
|
45
|
+
|
|
46
|
+
- No Golang Code Required: Users can solely rely on Python for Excel file
|
|
47
|
+
generation, eliminating the need for Golang expertise.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### Install via pip (Recommended)
|
|
52
|
+
|
|
53
|
+
You can easily install the package via pip
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install pyfastexcel
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Install manually
|
|
60
|
+
|
|
61
|
+
If you prefer to build the package manually, follow these steps:
|
|
62
|
+
|
|
63
|
+
1. Clone the repository:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git clone https://github.com/Zncl2222/pyfastexcel.git
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. Go to the project root directory:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cd pyfastexcel
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
3. Install the required golang packages:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
go mod download
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
4. Build the Golang shared library using the Makefile:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
make
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
5. Install the required python packages:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install -r requirements.txt
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
or
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pipenv install
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
6. Import the project and start using it!
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
The index assignment is now avaliable in `Workbook` and the `FastWriter`.
|
|
104
|
+
Here is the example usage:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from pyfastexcel import Workbook
|
|
108
|
+
from pyfastexcel.utils import set_custom_style
|
|
109
|
+
|
|
110
|
+
# CustomStyle will be integrate to the pyfatexcel in next version
|
|
111
|
+
# Beside, CustomStyle will be re-implement in future to make it no-longer
|
|
112
|
+
# depend on openpyxl_style writer and openpyxl
|
|
113
|
+
from openpyxl_style_writer import CustomStyle
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if __name__ == '__main__':
|
|
117
|
+
# Workbook
|
|
118
|
+
wb = Workbook()
|
|
119
|
+
|
|
120
|
+
# Set and register CustomStyle
|
|
121
|
+
bold_style = CustomStyle(font_size=15, font_bold=True)
|
|
122
|
+
set_custom_style('bold_style', bold_style)
|
|
123
|
+
|
|
124
|
+
ws = wb['Sheet1']
|
|
125
|
+
# Write value with default style
|
|
126
|
+
ws['A1'] = 'A1 value'
|
|
127
|
+
# Write value with custom style
|
|
128
|
+
ws['B1'] = ('B1 value', 'bold_style')
|
|
129
|
+
|
|
130
|
+
# Write value in slice with default style
|
|
131
|
+
ws['A2': 'C2'] = [1, 2, 3]
|
|
132
|
+
# Write value in slice with custom style
|
|
133
|
+
ws['A3': 'C3'] = [(1, 'bold_style'), (2, 'bold_style'), (3, 'bold_style')]
|
|
134
|
+
|
|
135
|
+
# Write value by row with default style (python index 0 is the index 1 in excel)
|
|
136
|
+
ws[3] = [9, 8, 'go']
|
|
137
|
+
# Write value by row with custom style
|
|
138
|
+
ws[4] = [(9, 'bold_style'), (8, 'bold_style'), ('go', 'bold_style')]
|
|
139
|
+
|
|
140
|
+
# Send request to golang lib and create excel
|
|
141
|
+
wb.read_lib_and_create_excel()
|
|
142
|
+
|
|
143
|
+
# File path to save
|
|
144
|
+
file_path = 'pyexample_workbook.xlsx'
|
|
145
|
+
wb.save(file_path)
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
You can also using the `FastWriter` or `NormalWriter` which was the
|
|
150
|
+
subclass of `Workbook` to write excel row by row, see the more in documentations [quickstart](https://pyfastexcel.readthedocs.io/en/stable/quickstart/).
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
The documentation is hosted on Read the Docs.
|
|
155
|
+
|
|
156
|
+
- [Development Version](https://pyfastexcel.readthedocs.io/en/latest/)
|
|
157
|
+
|
|
158
|
+
- [Latest Stable Version](https://pyfastexcel.readthedocs.io/en/stable/)
|
|
159
|
+
|
|
160
|
+
## How it Works
|
|
161
|
+
|
|
162
|
+
The core functionality revolves around encoding Excel cell data and styles,
|
|
163
|
+
or any other Excel properties, into a JSON string within Python. This JSON
|
|
164
|
+
payload is then passed through ctypes to a Golang shared library. In Golang,
|
|
165
|
+
the JSON is parsed, and using the streaming writer of
|
|
166
|
+
[excelize](https://github.com/qax-os/excelize) to wrtie excel in
|
|
167
|
+
high performance.
|
|
168
|
+
|
|
169
|
+
## Current Limitations & Future Plans
|
|
170
|
+
|
|
171
|
+
### Problem 1: Dependence on Other Excel Package
|
|
172
|
+
|
|
173
|
+
Limitations:
|
|
174
|
+
|
|
175
|
+
This project currently depends on the `CustomStyle` object of
|
|
176
|
+
the [openpyxl_style_writer](https://github.com/Zncl2222/openpyxl_style_writer)
|
|
177
|
+
package, which is built for openpyxl to write styles in write-only
|
|
178
|
+
mode more efficiently without duplicating code.
|
|
179
|
+
|
|
180
|
+
Future Plans:
|
|
181
|
+
|
|
182
|
+
This project plans to create its own `Style` object, making it no longer
|
|
183
|
+
dependent on the mentioned package.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# pyfastexcel
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
[](https://goreportcard.com/report/github.com/Zncl2222/pyfastexcel)
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
[](https://app.codacy.com/gh/Zncl2222/pyfastexcel/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
8
|
+
[](https://codecov.io/gh/Zncl2222/pyfastexcel)
|
|
9
|
+
[](https://pyfastexcel.readthedocs.io/en/stable/?badge=stable)
|
|
10
|
+
|
|
11
|
+
This package enables high-performance Excel writing by integrating with the
|
|
12
|
+
streaming API from the golang package
|
|
13
|
+
[excelize](https://github.com/qax-os/excelize). Users can leverage this
|
|
14
|
+
functionality without the need to write any Go code, as the entire process
|
|
15
|
+
can be accomplished through Python.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Python and Golang Integration: Seamlessly call Golang built shared
|
|
20
|
+
libraries from Python.
|
|
21
|
+
|
|
22
|
+
- No Golang Code Required: Users can solely rely on Python for Excel file
|
|
23
|
+
generation, eliminating the need for Golang expertise.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
### Install via pip (Recommended)
|
|
28
|
+
|
|
29
|
+
You can easily install the package via pip
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install pyfastexcel
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Install manually
|
|
36
|
+
|
|
37
|
+
If you prefer to build the package manually, follow these steps:
|
|
38
|
+
|
|
39
|
+
1. Clone the repository:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/Zncl2222/pyfastexcel.git
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. Go to the project root directory:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cd pyfastexcel
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
3. Install the required golang packages:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
go mod download
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
4. Build the Golang shared library using the Makefile:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
make
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
5. Install the required python packages:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install -r requirements.txt
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
or
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pipenv install
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
6. Import the project and start using it!
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
The index assignment is now avaliable in `Workbook` and the `FastWriter`.
|
|
80
|
+
Here is the example usage:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from pyfastexcel import Workbook
|
|
84
|
+
from pyfastexcel.utils import set_custom_style
|
|
85
|
+
|
|
86
|
+
# CustomStyle will be integrate to the pyfatexcel in next version
|
|
87
|
+
# Beside, CustomStyle will be re-implement in future to make it no-longer
|
|
88
|
+
# depend on openpyxl_style writer and openpyxl
|
|
89
|
+
from openpyxl_style_writer import CustomStyle
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == '__main__':
|
|
93
|
+
# Workbook
|
|
94
|
+
wb = Workbook()
|
|
95
|
+
|
|
96
|
+
# Set and register CustomStyle
|
|
97
|
+
bold_style = CustomStyle(font_size=15, font_bold=True)
|
|
98
|
+
set_custom_style('bold_style', bold_style)
|
|
99
|
+
|
|
100
|
+
ws = wb['Sheet1']
|
|
101
|
+
# Write value with default style
|
|
102
|
+
ws['A1'] = 'A1 value'
|
|
103
|
+
# Write value with custom style
|
|
104
|
+
ws['B1'] = ('B1 value', 'bold_style')
|
|
105
|
+
|
|
106
|
+
# Write value in slice with default style
|
|
107
|
+
ws['A2': 'C2'] = [1, 2, 3]
|
|
108
|
+
# Write value in slice with custom style
|
|
109
|
+
ws['A3': 'C3'] = [(1, 'bold_style'), (2, 'bold_style'), (3, 'bold_style')]
|
|
110
|
+
|
|
111
|
+
# Write value by row with default style (python index 0 is the index 1 in excel)
|
|
112
|
+
ws[3] = [9, 8, 'go']
|
|
113
|
+
# Write value by row with custom style
|
|
114
|
+
ws[4] = [(9, 'bold_style'), (8, 'bold_style'), ('go', 'bold_style')]
|
|
115
|
+
|
|
116
|
+
# Send request to golang lib and create excel
|
|
117
|
+
wb.read_lib_and_create_excel()
|
|
118
|
+
|
|
119
|
+
# File path to save
|
|
120
|
+
file_path = 'pyexample_workbook.xlsx'
|
|
121
|
+
wb.save(file_path)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can also using the `FastWriter` or `NormalWriter` which was the
|
|
126
|
+
subclass of `Workbook` to write excel row by row, see the more in documentations [quickstart](https://pyfastexcel.readthedocs.io/en/stable/quickstart/).
|
|
127
|
+
|
|
128
|
+
## Documentation
|
|
129
|
+
|
|
130
|
+
The documentation is hosted on Read the Docs.
|
|
131
|
+
|
|
132
|
+
- [Development Version](https://pyfastexcel.readthedocs.io/en/latest/)
|
|
133
|
+
|
|
134
|
+
- [Latest Stable Version](https://pyfastexcel.readthedocs.io/en/stable/)
|
|
135
|
+
|
|
136
|
+
## How it Works
|
|
137
|
+
|
|
138
|
+
The core functionality revolves around encoding Excel cell data and styles,
|
|
139
|
+
or any other Excel properties, into a JSON string within Python. This JSON
|
|
140
|
+
payload is then passed through ctypes to a Golang shared library. In Golang,
|
|
141
|
+
the JSON is parsed, and using the streaming writer of
|
|
142
|
+
[excelize](https://github.com/qax-os/excelize) to wrtie excel in
|
|
143
|
+
high performance.
|
|
144
|
+
|
|
145
|
+
## Current Limitations & Future Plans
|
|
146
|
+
|
|
147
|
+
### Problem 1: Dependence on Other Excel Package
|
|
148
|
+
|
|
149
|
+
Limitations:
|
|
150
|
+
|
|
151
|
+
This project currently depends on the `CustomStyle` object of
|
|
152
|
+
the [openpyxl_style_writer](https://github.com/Zncl2222/openpyxl_style_writer)
|
|
153
|
+
package, which is built for openpyxl to write styles in write-only
|
|
154
|
+
mode more efficiently without duplicating code.
|
|
155
|
+
|
|
156
|
+
Future Plans:
|
|
157
|
+
|
|
158
|
+
This project plans to create its own `Style` object, making it no longer
|
|
159
|
+
dependent on the mentioned package.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from openpyxl_style_writer import CustomStyle, DefaultStyle
|
|
2
|
+
|
|
3
|
+
from pyfastexcel.writer import FastWriter, NormalWriter, Workbook
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
'Workbook',
|
|
7
|
+
'FastWriter',
|
|
8
|
+
'NormalWriter',
|
|
9
|
+
# Temporary link the CustomStyle from openpyxl_style_writer for
|
|
10
|
+
# convinent usage.
|
|
11
|
+
'CustomStyle',
|
|
12
|
+
'DefaultStyle',
|
|
13
|
+
]
|