Skip to content

Commit 69e880b

Browse files
committed
Add logo for the project and ARM64 Linux platform support
- Update README and load_lib function - Bump version 0.0.2
1 parent 799f013 commit 69e880b

File tree

5 files changed

+124
-34
lines changed

5 files changed

+124
-34
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212

1313
Package excelize-py is a Python port of Go [Excelize](https://github.com/xuri/excelize) library, providing a set of functions that allow you to write and read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data. This library needs Python version 3.7 or later. The full API docs can be found at [docs reference](https://xuri.me/excelize/).
1414

15+
## Platform Compatibility
16+
17+
Operating system | CPU Architecture
18+
---|---
19+
Windows | amd64
20+
Darwin | amd64
21+
Darwin | arm64
22+
Linux | amd64
23+
Linux | arm64
24+
1525
## Basic Usage
1626

1727
### Installation
@@ -48,3 +58,15 @@ if err is not None: {
4858
print(err)
4959
}
5060
```
61+
62+
## Contributing
63+
64+
Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.
65+
66+
## Licenses
67+
68+
This program is under the terms of the BSD 3-Clause License. See [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause).
69+
70+
The Excel logo is a trademark of [Microsoft Corporation](https://aka.ms/trademarks-usage). This artwork is an adaptation.
71+
72+
gopher.{ai,svg,png} was created by [Takuya Ueda](https://twitter.com/tenntenn). Licensed under the [Creative Commons 3.0 Attributions license](http://creativecommons.org/licenses/by/3.0/).

README_zh.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# excelize-py
2+
3+
<p align="center"><img width="500" src="https://github.com/xuri/excelize-py/raw/main/excelize-py.svg" alt="excelize-py logo"></p>
4+
5+
<p align="center">
6+
<a href="https://pypi.org/project/excelize"><img src="https://img.shields.io/pypi/v/excelize.svg" alt="Pipy version"></a>
7+
<a href="https://github.com/xuri/excelize-py/actions/workflows/build.yml"><img src="https://github.com/xuri/excelize-py/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
8+
<a href="https://codecov.io/gh/xuri/excelize-py"><img src="https://codecov.io/gh/xuri/excelize-py/branch/main/graph/badge.svg" alt="Code Coverage"></a>
9+
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-bsd-orange.svg" alt="Licenses"></a>
10+
<a href="https://www.paypal.com/paypalme/xuri"><img src="https://img.shields.io/badge/Donate-PayPal-green.svg" alt="Donate"></a>
11+
</p>
12+
13+
excelize-py 是 Go 语言 [Excelize](https://github.com/xuri/excelize) 基础库的 Python 实现,可用于操作 Office Excel 文档,基于 ECMA-376,ISO/IEC 29500 国际标准。可以使用它来读取、写入由 Microsoft Excel&trade; 2007 及以上版本创建的电子表格文档。支持 XLAM / XLSM / XLSX / XLTM / XLTX 等多种文档格式,高度兼容带有样式、图片(表)、透视表、切片器等复杂组件的文档。可应用于各类报表平台、云计算、边缘计算等系统。获取更多信息请访问 [参考文档](https://xuri.me/excelize/)
14+
15+
## 运行环境兼容性
16+
17+
操作系统 | CPU 架构
18+
---|---
19+
Windows | amd64
20+
Darwin | amd64
21+
Darwin | arm64
22+
Linux | amd64
23+
Linux | arm64
24+
25+
## 快速上手
26+
27+
### 安装
28+
29+
```bash
30+
pip install excelize
31+
```
32+
33+
### 创建 Excel 文档
34+
35+
下面是一个创建 Excel 文档的简单例子:
36+
37+
```python
38+
import excelize
39+
40+
f = excelize.new_file()
41+
# 新建一张工作表
42+
index, err = f.new_sheet("Sheet2")
43+
if err is not None:
44+
print(err)
45+
exit()
46+
# 设置单元格的值
47+
f.set_cell_value("Sheet2", "A2", "Hello world.")
48+
f.set_cell_value("Sheet1", "B2", 100)
49+
# 设置工作簿的默认工作表
50+
f.set_active_sheet(index)
51+
# 根据指定路径保存文件
52+
err = f.save_as("Book1.xlsx")
53+
if err is not None: {
54+
print(err)
55+
}
56+
err = f.close()
57+
if err is not None: {
58+
print(err)
59+
}
60+
```
61+
62+
## 社区合作
63+
64+
欢迎您为此项目贡献代码,提出建议或问题、修复 Bug 以及参与讨论对新功能的想法。
65+
66+
## 开源许可
67+
68+
本项目遵循 BSD 3-Clause 开源许可协议,访问 [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause) 查看许可协议文件。
69+
70+
Excel 徽标是 [Microsoft Corporation](https://aka.ms/trademarks-usage) 的商标,项目的图片是一种改编。
71+
72+
gopher.{ai,svg,png} 由 [Takuya Ueda](https://twitter.com/tenntenn) 创作,遵循 [Creative Commons 3.0 Attributions license](http://creativecommons.org/licenses/by/3.0/) 创作共用授权条款。

excelize-py.svg

+1
Loading

excelize.py

+27-33
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,36 @@
3434

3535

3636
def load_lib():
37-
name = "libexcelize"
38-
39-
# Check architecture (only 64-bit supported)
37+
system = platform.system().lower()
4038
arch = platform.architecture()[0]
41-
if "64" not in arch:
42-
print(f"Unsupported architecture {arch}")
43-
exit(1)
44-
45-
# Get machine type for architecture suffix
46-
machine_type = platform.machine().lower()
47-
arch_suffix = ""
48-
if "arm" in machine_type:
49-
arch_suffix = ".arm64"
50-
elif "x86_64" in machine_type or "amd64" in machine_type:
51-
arch_suffix = ".amd64"
52-
if not arch_suffix:
53-
print(f"Unsupported architecture {arch_suffix}")
54-
exit(1)
55-
56-
name += arch_suffix
57-
58-
# Map OS to their respective suffix
59-
os_mapping = {
60-
"Windows": ".windows.dll",
61-
"Darwin": ".darwin.dylib",
62-
"Linux": ".linux.so",
39+
machine = platform.machine().lower()
40+
ext_map = {"linux": ".so", "darwin": ".dylib", "windows": ".dll"}
41+
arch_map = {
42+
"linux": {
43+
"64bit": {
44+
"x86_64": "amd64",
45+
"aarch64": "arm64",
46+
},
47+
},
48+
"darwin": {
49+
"64bit": {
50+
"x86_64": "amd64",
51+
"arm64": "arm64",
52+
},
53+
},
54+
"windows": {
55+
"64bit": {
56+
"x86_64": "amd64",
57+
},
58+
},
6359
}
60+
if system in ext_map and arch in arch_map.get(system, {}):
61+
arch_name = arch_map[system][arch].get(machine)
62+
if arch_name:
63+
return f"libexcelize.{arch_name}.{system}{ext_map[system]}"
6464

65-
os = platform.system()
66-
if os not in os_mapping:
67-
print(f"Unsupported OS {os}")
68-
exit()
69-
70-
name += os_mapping[os]
71-
72-
return name
65+
print("This platform or architecture is not supported.")
66+
exit(1)
7367

7468

7569
lib = CDLL(os.path.join(os.path.dirname(__file__), load_lib()))

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def run(self):
2828
os.makedirs(self.install_lib, exist_ok=True)
2929
for shared_library in [
3030
"libexcelize.amd64.linux.so",
31+
"libexcelize.arm64.linux.so",
3132
"libexcelize.amd64.darwin.dylib",
3233
"libexcelize.arm64.darwin.dylib",
3334
"libexcelize.amd64.windows.dll",
@@ -37,7 +38,7 @@ def run(self):
3738

3839
setup(
3940
name="excelize",
40-
version="0.0.1",
41+
version="0.0.2",
4142
license="BSD 3-Clause",
4243
license_files=("LICENSE"),
4344
description="A Python build of the Go Excelize library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets",

0 commit comments

Comments
 (0)