pip install python-office

Overview

github license

🍬 python for office

👉 http://www.python4office.cn/ 👈

github star github contributors github forks github issues github license github license

gitee star gitee fork


🌎 English Documentation


📚 简介

Python-office 是一个 Python 自动化办公第三方库,能解决大部分自动化办公的问题。而且每个功能只需一行代码,不需要小白用户学习 Python 知识,做到了真正的开箱即用。

🍺 特点

  • 一键搭建所有 Python + 自动化办公的编程环境。
  • 使用一行代码解决大部分自动化办公的问题,不需要小白学习 Python 知识
  • 贴合职场办公需求
  • 极简编程,学习成本极低,工作效率提升显著

📦 安装

🍊 pip 自动下载&更新

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-office -U

📝 文档

📘 中文文档

🎬 视频介绍


🛠️ 包含组件

以下所有功能,都在逐步搭建中。

模块 介绍
excel excel处理
word word处理
ppt ppt处理
pdf pdf处理
file 文件和文件夹的操作
tools 便捷小工具
web 网站快捷搭建
email 邮件功能
image 图片处理
video 视频处理
ocr 识别功能:文字识别、语音识别

可以根据需求对每个模块单独引入,也可以通过import office方式引入所有模块。


🏗️ 添砖加瓦

📐 PR的建议

python-office欢迎任何人来添砖加瓦,贡献代码,建议提交的pr(pull request)符合一些规范,规范如下:

参与项目建设的步骤:

  • 例如:你需要给python-office添加一个add方法。
    1. 你的Github账户名为:demo
    2. 于是你在./contributors新建了文件夹./demo
    3. 新建了add.py文件,编辑你的代码
    4. 编辑完成,提交pr到master分支(gitee或者GitHub,都可以)。可以注明你对自己功能的取名建议
    5. 晚枫收到后,会对各位的代码进行测试后,合并后打包上传到python官方库

📐 代码规范

  1. 注释完备,尤其每个新增的方法应按照Google Python文档规范标明方法说明、参数说明、返回值说明等信息,必要时请添加单元测试,如果愿意,也可以加上你的大名。
  2. python-office的文档,需要进行格式化。注意:只能格式化你自己的代码
  3. 请直接pull request到master分支。master是主分支,表示已经发布pypi库的版本。未来参与人数增多,会开辟新的分支,请留意本文档的更新。
  4. 我们如果关闭了你的issue或pr,请不要诧异,这是我们保持问题处理整洁的一种方式,你依旧可以继续讨论,当有讨论结果时我们会重新打开。

🧬 贡献代码的步骤

  1. 在Gitee或者Github上fork项目到自己的repo
  2. 把fork过去的项目也就是你的项目clone到你的本地
  3. 修改代码
  4. commit后push到自己的库
  5. 登录Gitee或Github在你首页可以看到一个 pull request 按钮,点击它,填写一些说明信息,然后提交到master分支即可。
  6. 等待维护者合并

🎋 分支说明

python-office的源码分为两个分支,功能如下:

分支 作用
master 主分支,pypi发布版本使用的分支,可以直接pr
develop 开发分支,供大家各自开发使用

🐞 提供bug反馈或建议

提交问题反馈时,请务必填写和python-office代码本身有关的问题,不进行有关python学习,甚至是个人练习的知识答疑和讨论。


🪙 支持python-office

💳 捐赠

如果你觉得python-office不错,可以捐赠请维护者喝杯咖啡~,在此表示感谢^_^。

捐赠给项目 👈 该项捐赠仅用于支持本项目发展使用

捐赠给程序员晚枫


Star python-office

Stargazers over time

📌 公众号&开源小组

Comments
  • 社区规范化问题:预设

    社区规范化问题:预设

    目前,这个开源项目正处在蓬勃的发展当中,但是在发展的过程中需要更多的规范化。客户以及开发者提出了各种各样的需求,有一些需求比较大众,有一些需求比较小众。如果不对这些需求加以区分而盲目的将api合入office的库中,会导致整个库十分臃肿且没有中心,这势必会对于整个开源生态的发展非常的不利。 为此,我建议采用类似主体+插件的形式对于开源代码进行维护。主体保留最常见的相应功能,这一部分功能是用户使用的频率最高的,呼声最大的功能。而插件——在这里被我称为预设,则保证小众的需求,让客户可以选择的下载。同时在某些预设的使用量较高的情况下,将其合入主体。 这样子有几个好处:首先是,可以分清楚主次以及开发者的职责。主体由项目的主要开发者维护,而预设则主要由预设的创作者来维护。这样子不会出现某些主要开发者专注于维护低频次使用的功能而忽视主要功能的维护升级。 其次是方便项目维护,稳定的特性可以放置在主体中进行维护与迭代,而非稳定的特性可以放到预设进行开发,直到稳定再合入主体。 另外就是鼓励了创作者的开发热情。由于预设并不一定要是完整的功能,仅仅是一个小的办公脚本中就可以加入预设,这样子每一个使用了python脚本的人都可以把自己的脚本分享出来。这就有点类似创意工坊的感觉,可以极大的增加创作者的热情。 当然,预设仍有许多规范化问题需要解决,这需要社区进行讨论,制定相应的预设编写规范以及导入方法

    good first issue 
    opened by mingerfan 4
  • 添加单元测试

    添加单元测试

    现在的贡献方式是在contributors文件夹下编辑各自的代码,再由核心维护者手动把功能整合进office文件夹中,再上传到PyPI上,这种方式有以下弊端:

    • 增加了核心维护者 @CoderWanFeng 进行code review的工作量
    • 贡献者代码质量难以保证,同时优质功能上线周期也长
    • 由于相对路径、相对导入存在一些坑,从contributors到主文件夹的迁移可能产生新的bug
    • office文件夹下现存的实现有的是半成品,有的有待优化,但大家不敢乱动,生怕向后不兼容

    综上原因我建议,在根目录(与office文件夹)建一个tests文件夹,里面存储各模块的单元测试, 同时也改变一下贡献的方式,允许有把握的同学在不改变原有单元测试的前提下,直接commit到office目录,保证新增的功能也提供了有效的单元测试,测试通过后,在核心开发者认定代码质量够高后,即可直接merge并推送到PyPI,实现新功能的快速上线

    enhancement 
    opened by CNSeniorious000 2
  • 安装报错

    安装报错

    在Pycharm 中 输入pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-office -U 都能正常安装,但有一个报错,导致安装失败

    ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. paddlepaddle-gpu 2.2.2 requires numpy<=1.19.3,>=1.13; python_version >= "3.5" and platform_system == "Windows", but you have numpy 1.22.3 which is incompatible.

    opened by ahulxj 2
  • mac 安装后, 运行报错

    mac 安装后, 运行报错

    1. 安装后 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-office -U

    2. 执行 office.excel.fake2excel(columns=['name', 'text'], rows=20)

    3. 报错

    Traceback (most recent call last):
      File "/Users/xxx/work_code/python-lessons/main.py", line 9, in <module>
        import office
      File "/Users/xxx/work_code/python-lessons/venv/lib/python3.8/site-packages/office/__init__.py", line 1, in <module>
        from . import word
      File "/Users/xxx/work_code/python-lessons/venv/lib/python3.8/site-packages/office/word.py", line 12, in <module>
        from win32com.client import constants, gencache
    ModuleNotFoundError: No module named 'win32com'
    
    1. 再次安装缺少的 win32
    pip install pypiwin32
    
    1. 安装 win32 报错
    Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
    Collecting pypiwin32
      Using cached https://mirrors.aliyun.com/pypi/packages/d0/1b/2f292bbd742e369a100c91faa0483172cd91a1a422a6692055ac920946c5/pypiwin32-223-py3-none-any.whl (1.7 kB)
      Using cached https://mirrors.aliyun.com/pypi/packages/2b/ca/5c086c18de8f70222787b3e824e755b68d99272531522e77bb381d4f60c8/pypiwin32-219.zip (4.8 MB)
      Preparing metadata (setup.py) ... error
      error: subprocess-exited-with-error
      
      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [7 lines of output]
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/private/var/folders/2p/c0c3rrys09b8c8y0rrkscn8r0000gn/T/pip-install-b18sn648/pypiwin32_0e47d8d13683441e9c213f629f92a95f/setup.py", line 121
              print "Building pywin32", pywin32_version
                    ^
          SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Building pywin32", pywin32_version)?
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed
    
    × Encountered error while generating package metadata.
    ╰─> See above for output.
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
    
    opened by xingguang2013 1
  • 希望每个功能都能提供一个CLI接口

    希望每个功能都能提供一个CLI接口

    使用场景:在一个充满屏幕截图的文件夹下,用一行命令将这些截图转为ppt

    建议:将命令命名为py-office或者poffice或者po,短命令好打

    这样上述使用场景需要的命令大概是:

    po img2ppt -i . -o output.pptx
    # or:
    python -m python-office img2ppt -i . -o output.pptx
    

    要实现这个功能,需要:

    1. python-office的每个子包都有一个__main__.py文件
    2. 打包一个总的__main__.py为一个exe文件,比如命名为po.exe

    建议:对CLI参数的解析可以借助标准库的argparse模块,

    但个人更推荐使用第三方库typer,用装饰器的方式,更直观更便捷地将已有的功能函数转为cli接口


    提供cli接口的一个用处是,让几乎完全没有python基础的人也能使用python-office

    enhancement 
    opened by CNSeniorious000 1
  • Mac 没办法做支持的吧

    Mac 没办法做支持的吧

    Mac 没办法做支持的吧,安装pip python-office 不报错,执行 /Users/betty/PycharmProjects/pythonProject/venv/bin/python /Users/betty/PycharmProjects/pythonProject/myfaker.py Traceback (most recent call last): File "/Users/betty/PycharmProjects/pythonProject/myfaker.py", line 6, in import office File "/Users/betty/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/office/init.py", line 1, in from office.api import word File "/Users/betty/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/office/api/word.py", line 13, in from office.core.WordType import MainWord File "/Users/betty/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/office/core/WordType.py", line 2, in from win32com.client import constants, gencache ModuleNotFoundError: No module named 'win32com'

    opened by bytebitgo 7
Releases(0.1.38)
Owner
程序员晚枫
💻法学院毕业的Python程序员 💪请大家多指点
程序员晚枫
Election Exit Poll Prediction and U.S.A Presidential Speech Analysis using Machine Learning

Machine_Learning Election Exit Poll Prediction and U.S.A Presidential Speech Analysis using Machine Learning This project is based on 2 case-studies:

Avnika Mehta 1 Jan 27, 2022
AI virtual gym is an AI program which can be used to exercise and can be used to see if we are doing the exercises

AI virtual gym is an AI program which can be used to exercise and can be used to see if we are doing the exercises

4 Feb 13, 2022
Reinforcement learning framework and algorithms implemented in PyTorch.

Reinforcement learning framework and algorithms implemented in PyTorch.

Robotic AI & Learning Lab Berkeley 2.1k Jan 04, 2023
Img-process-manual - Utilize Python Numpy and Matplotlib to realize OpenCV baisc image processing function

Img-process-manual - Opencv Library basic graphic processing algorithm coding reproduction based on Numpy and Matplotlib library

Jack_Shaw 2 Dec 12, 2022
This is the repo for Uncertainty Quantification 360 Toolkit.

UQ360 The Uncertainty Quantification 360 (UQ360) toolkit is an open-source Python package that provides a diverse set of algorithms to quantify uncert

International Business Machines 207 Dec 30, 2022
Training Very Deep Neural Networks Without Skip-Connections

DiracNets v2 update (January 2018): The code was updated for DiracNets-v2 in which we removed NCReLU by adding per-channel a and b multipliers without

Sergey Zagoruyko 585 Oct 12, 2022
A code repository associated with the paper A Benchmark for Rough Sketch Cleanup by Chuan Yan, David Vanderhaeghe, and Yotam Gingold from SIGGRAPH Asia 2020.

A Benchmark for Rough Sketch Cleanup This is the code repository associated with the paper A Benchmark for Rough Sketch Cleanup by Chuan Yan, David Va

33 Dec 18, 2022
A system for quickly generating training data with weak supervision

Programmatically Build and Manage Training Data Announcement The Snorkel team is now focusing their efforts on Snorkel Flow, an end-to-end AI applicat

Snorkel Team 5.4k Jan 02, 2023
KwaiRec: A Fully-observed Dataset for Recommender Systems (Density: Almost 100%)

KuaiRec: A Fully-observed Dataset for Recommender Systems (Density: Almost 100%) KuaiRec is a real-world dataset collected from the recommendation log

Chongming GAO (高崇铭) 70 Dec 28, 2022
Improving 3D Object Detection with Channel-wise Transformer

"Improving 3D Object Detection with Channel-wise Transformer" Thanks for the OpenPCDet, this implementation of the CT3D is mainly based on the pcdet v

Hualian Sheng 107 Dec 20, 2022
Modified prey-predator system - Modified prey–predator model describes the rate of change for each species by adding coupling terms.

Modified prey-predator system We aim to study the behaviors of the modified prey–predator model and establish the effects of several parameters that p

Seoyoung Oh 1 Jan 02, 2022
MANO hand model porting for the GraspIt simulator

Learning Joint Reconstruction of Hands and Manipulated Objects - ManoGrasp Porting the MANO hand model to GraspIt! simulator Yana Hasson, Gül Varol, D

Lucas Wohlhart 10 Feb 08, 2022
ResNEsts and DenseNEsts: Block-based DNN Models with Improved Representation Guarantees

ResNEsts and DenseNEsts: Block-based DNN Models with Improved Representation Guarantees This repository is the official implementation of the empirica

Kuan-Lin (Jason) Chen 2 Oct 02, 2022
PFLD pytorch Implementation

PFLD-pytorch Implementation of PFLD A Practical Facial Landmark Detector by pytorch. 1. install requirements pip3 install -r requirements.txt 2. Datas

zhaozhichao 669 Jan 02, 2023
A colab notebook for training Stylegan2-ada on colab, transfer learning onto your own dataset.

Stylegan2-Ada-Google-Colab-Starter-Notebook A no thrills colab notebook for training Stylegan2-ada on colab. transfer learning onto your own dataset h

Harnick Khera 66 Dec 16, 2022
some classic model used to segment the medical images like CT、X-ray and so on

github_project This is a project for medical image segmentation. This project includes common medical image segmentation models such as U-net, FCN, De

2 Mar 30, 2022
Yet Another Reinforcement Learning Tutorial

This repo contains self-contained RL implementations

Sungjoon 65 Dec 10, 2022
《LXMERT: Learning Cross-Modality Encoder Representations from Transformers》(EMNLP 2020)

The Most Important Thing. Our code is developed based on: LXMERT: Learning Cross-Modality Encoder Representations from Transformers

53 Dec 16, 2022
Repository for "Improving evidential deep learning via multi-task learning," published in AAAI2022

Improving evidential deep learning via multi task learning It is a repository of AAAI2022 paper, “Improving evidential deep learning via multi-task le

deargen 11 Nov 19, 2022
4D Human Body Capture from Egocentric Video via 3D Scene Grounding

4D Human Body Capture from Egocentric Video via 3D Scene Grounding [Project] [Paper] Installation: Our method requires the same dependencies as SMPLif

Miao Liu 37 Nov 08, 2022