awesome-functional-python

awesome-functional-python

Python函数式编程精选资源大全

本列表汇集了Python函数式编程的优质资源,包含官方文档、书籍、演讲和各类工具库。涵盖从入门到进阶的全面内容,助力开发者掌握函数式编程范式。收录了不可变数据结构、模式匹配、响应式编程等多个领域的实用工具,以及专为Python函数式编程设计的库。另外还介绍了Python生态系统中的相关函数式编程语言,为开发者提供全方位的学习参考。

Python函数式编程开源库编程范式开发工具Github开源项目

Awesome Functional Python

A curated list of awesome things related to functional programming in Python.

Awesome

Official documentation

  • Functional Programming HOWTO - "In this document, we’ll take a tour of Python’s features suitable for implementing programs in a functional style".

Books

Free books / ebooks

Non-free books

Talks

Introductory

  • Functional Programming with Python (slides) - Alexey Kachayev, UA PYCon 2012.
  • Purely Functional Programming in Python: Pure Fun (slides) - Christopher Armstrong, PyTenessee 2015.
  • Side Effects are a Public API (video) - Christopher Armstrong, Strangeloop 2015
  • Functional Programming with Python (video) - Mike Müller, PyCon US 2013.
  • Using Functional Programming for efficient Data Processing and Analysis (video) - Reuben Cummings, PyCon US 2017.
  • Immutable Programming Writing Functional Python (slides, video), Calen Pennington, PyCon 2017.
  • Functional Programming inside OOP? It’s possible with Python (Slides) - Carlos Villavicencio, EuroPython 2021.
  • A Hitchhiker’s Guide to functools (Slides) - Scott Irwin, EuroPython 2021.
  • Writing Functional Code in Python (Video) - Vic Kumar, PyCon 2022

Advanced or specialized

  • Functionalish programming in Python with effect (video), Robert Collins, NZ PyCon 2015.
  • Monadic Parsing in Python (slides), Alexey Kachayev, KyivPy 2014.
  • Immutability and Python - Introducing Pyrsistent (slides), Tobias Gustafsson, 2014.
  • Understanding Transducers (slides, video), Austin Bingham, PyCon Belarus 2015.

Data science oriented

  • Functional Performance with Core Data Structures (video), Matthew Rocklin, PyData SV 2014.
  • Old School - Functional Data Analysis (video), Matthew Rocklin, PyData NYC 2013.
  • Learning Data Science Using Functional Python (video, slides), Joel Grus, PyData Seattle 2015.

Other resources

Video lectures (not free)

Blog posts

Scientific papers

Presentation slides

Libraries

General

  • toolz ★4619 - "A functional standard library for Python".
  • more-itertools ★3639 - "More routines for operating on iterables, beyond itertools".
  • fn.py ★3348 - "Functional programming in Python: implementation of missing features to enjoy FP" (unmaintained since 2014). Maintained fork.
  • funcy ★3333 - "A fancy and practical functional tools".
  • PyFunctional ★2380 - "Python library for functional programming with collections in a data pipeline style".
  • Pipe ★1898 - "A Python library to use infix notation in Python".
  • Pydash ★1291 - "The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library".
  • hask ★858 - "Haskell language features and standard libraries in pure Python".
  • OSlash ★709 - "Functors, Applicatives, And Monads in Python".
  • Expression ★454 - "Pragmatic functional programming for Python inspired by F#". Successor of OSlash.
  • Effect ★369 - "Effect isolation in Python, to facilitate more purely functional code".
  • Underscore.py ★291 - "A Python port of excellent javascript library underscore.js".
  • fnc ★247 - "Functional programming in Python with generators and other utilities".
  • Flupy ★192 - Implements a fluent interface for operating on python iterables.
  • PyMonad ★189 - "a small library implementing monads and related data abstractions -- functors, applicative functors, and monoids -- for use in implementing functional style programs".
  • pfun ★149 - "Pure functional programming in python".
  • Phi ★132 - "A library that intends to remove as much of the pain as possible from your functional programming experience in Python."
  • pyramda ★127 - "Python package supporting heavy functional programming through currying. Translation of the Ramda library from javascript to python".
  • unpythonic ★87 - "Supercharge your Python with parts of Lisp and Haskell."
  • ziopy ★75 - "ZIO for Python (with ZIO = A type-safe, composable library for async and concurrent programming in Scala)"
  • pyMonet ★34 - "High abstract python library for functional programming. Contains algebraic data structures known from Haskell or Scala".
  • Compose ★32 - The classic compose, with all the Pythonic features.
  • pyeffects ★30 - "Handle side-effects in Python like a boss. Implements functional types for Either, Option, Try, and Future."
  • Iter ★10 - map, filter etc. as methods on a sequence.

Return types

  • returns ★3421 - "Make your functions return something meaningful, typed, and safe!"
  • result ★1458 - A simple Rust like Result type for Python 3. Fully type annotated.
  • Option ★84 - Rust-like Option and Result types in Python.
  • Meiga ★76 - A simple, typed and monad-based Result type for Python.
  • Safetywrap ★43 - Fully typesafe, Rust-like Result and Option types for Python.

Immutable / persistent data structures

  • Pyrsistent ★2005 - "Persistent/Immutable/Functional data structures for Python".
  • Immutables ★1116 - "An immutable mapping type for Python."

Dead projects:

  • Discodb ★98 - "An efficient, immutable, persistent mapping object".
  • Funktown ★74 - "Immutable Data Structures for Python".
  • Amino ★35 - "functional data structures and type classes".
  • Pysistence - "Pysistence is a project that seeks to make functional programming in python easier".

Pattern matching

Note: Pattern matching is now a standard feature in Python 3.10.

  • pampy ★3511 - "Pampy: The Pattern Matching for Python you always dreamed of."
  • python-pattern-matching ★161 - "Python pattern matching like functional languages."
  • patmat ★30 - "Functional-style recursive pattern matching in Python. Crazy stuff."
  • apm ★107 - "Pattern Matching for Python 3.8+ in a simple, yet powerful, extensible manner."

Tranducers

(Both projects are dead).

  • Tranducers-Python ★202 - "Transducers are composable algorithmic transformations".
  • Transducers ★55 - "This is a port of the transducer concept from Clojure to Python, with an emphasis on providing as Pythonic as interpretation of transducers as possible, rather than reproducing Clojurisms more literally".

Support for reactive style

  • RxPy ★4727 - "Reactive Extensions for Python".
  • broqer ★74 - "Library to operate with continuous streams of data in a reactive style"
  • sodium-python ★3 - "Python implementation of Sodium - Functional Reactive Programming (FRP) Library"

Lenses and declarative data manipulations

  • Glom ★1868 - "Python's nested data operator (and CLI), for all your declarative restructuring needs.".
  • python-lenses ★304 - "A python lens library for manipulating deeply nested immutable structures".

Other / specialized

  • deal ★719 - "Design by contract for Python with many validators support."
  • classes ★651 - "Smart, pythonic, ad-hoc, typed polymorphism for Python."
  • chainable ★192 - "Method chaining built on generators".
  • ADT ★172 - Algebraic data types for Python
  • sumtypes ★42 - "Sum Types, aka Tagged Unions, for Python".
  • python-mini-lambda ★13 - "Simple Lambda functions without lambda x: and with string conversion capability"
  • Orinoco ★11 - "Functional composable pipelines allowing clean separation of the business logic and its implementation"
  • slist ★11 - "A drop-in replacement for the python mutable list. But with much more methods for typesafe method chaining."
  • py-frm ★1 - "Proof-of-concept Functional-Relational Mapping (FRM) for Python"

Languages

Functional programming languages that are not Python but are related to the Python ecosystem:

Active languages

  • Hy ★4822 -

编辑推荐精选

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

3FS

3FS

一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。

3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。

下拉加载更多