{"id":13504393,"url":"https://github.com/faust-streaming/faust","last_synced_at":"2025-03-29T21:30:34.119Z","repository":{"id":37680940,"uuid":"306382059","full_name":"faust-streaming/faust","owner":"faust-streaming","description":"Python Stream Processing. A Faust fork","archived":false,"fork":false,"pushed_at":"2024-12-14T19:20:46.000Z","size":10069,"stargazers_count":1727,"open_issues_count":137,"forks_count":188,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-03-04T20:37:53.656Z","etag":null,"topics":["asyncio","distributed-systems","kafka","python-streaming","redis"],"latest_commit_sha":null,"homepage":"https://faust-streaming.github.io/faust/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faust-streaming.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.rst","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-22T15:32:50.000Z","updated_at":"2025-03-02T08:17:28.000Z","dependencies_parsed_at":"2022-07-13T15:29:48.219Z","dependency_job_id":"1e7bd91f-eb92-434a-be42-71db895d5914","html_url":"https://github.com/faust-streaming/faust","commit_stats":{"total_commits":4097,"total_committers":155,"mean_commits":26.43225806451613,"dds":"0.46302172321210644","last_synced_commit":"3a6ce2553dcaa2d312021bb7438a179fad919a86"},"previous_names":[],"tags_count":99,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faust-streaming%2Ffaust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faust-streaming%2Ffaust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faust-streaming%2Ffaust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faust-streaming%2Ffaust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faust-streaming","download_url":"https://codeload.github.com/faust-streaming/faust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249133,"owners_count":20747164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","distributed-systems","kafka","python-streaming","redis"],"created_at":"2024-08-01T00:00:36.542Z","updated_at":"2025-03-29T21:30:33.492Z","avatar_url":"https://github.com/faust-streaming.png","language":"Python","readme":"![faust](https://raw.githubusercontent.com/robinhood/faust/8ee5e209322d9edf5bdb79b992ef986be2de4bb4/artwork/banner-alt1.png)\n\n# Python Stream Processing Fork\n\n![python versions](https://img.shields.io/pypi/pyversions/faust-streaming.svg)\n![version](https://img.shields.io/pypi/v/faust-streaming)\n[![codecov](https://codecov.io/gh/faust-streaming/faust/branch/master/graph/badge.svg?token=QJFBYNN0JJ)](https://codecov.io/gh/faust-streaming/faust)\n[![slack](https://img.shields.io/badge/slack-Faust-brightgreen.svg?logo=slack)](https://join.slack.com/t/fauststreaming/shared_invite/zt-1q1jhq4kh-Q1t~rJgpyuMQ6N38cByE9g)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n![pre-commit](https://img.shields.io/badge/pre--commit-enabled-green)\n![license](https://img.shields.io/pypi/l/faust-streaming)\n![downloads](https://img.shields.io/pypi/dw/faust-streaming)\n\n## Installation\n\n`pip install faust-streaming`\n\n## Documentation\n\n- `introduction`: https://faust-streaming.github.io/faust/introduction.html\n- `quickstart`: https://faust-streaming.github.io/faust/playbooks/quickstart.html\n- `User Guide`: https://faust-streaming.github.io/faust/userguide/index.html\n\n## Why the fork\n\nWe have decided to fork the original `Faust` project because there is a critical process of releasing new versions which causes uncertainty in the community. Everybody is welcome to contribute to this `fork`, and you can be added as a maintainer.\n\nWe want to:\n\n- Ensure continues release\n- Code quality\n- Use of latest versions of kafka drivers (for now only [aiokafka](https://github.com/aio-libs/aiokafka))\n- Support kafka transactions\n- Update the documentation\n\nand more...\n\n## Usage\n\n```python\n# Python Streams\n# Forever scalable event processing \u0026 in-memory durable K/V store;\n# as a library w/ asyncio \u0026 static typing.\nimport faust\n```\n\n**Faust** is a stream processing library, porting the ideas from\n`Kafka Streams` to Python.\n\nIt is used at `Robinhood` to build high performance distributed systems\nand real-time data pipelines that process billions of events every day.\n\nFaust provides both *stream processing* and *event processing*,\nsharing similarity with tools such as `Kafka Streams`, `Apache Spark`, `Storm`, `Samza`, `Flink`,\n\nIt does not use a DSL, it's just Python!\nThis means you can use all your favorite Python libraries\nwhen stream processing: NumPy, PyTorch, Pandas, NLTK, Django,\nFlask, SQLAlchemy, ++\n\nFaust requires Python 3.6 or later for the new `async/await`_ syntax,\nand variable type annotations.\n\nHere's an example processing a stream of incoming orders:\n\n```python\n\napp = faust.App('myapp', broker='kafka://localhost')\n\n# Models describe how messages are serialized:\n# {\"account_id\": \"3fae-...\", amount\": 3}\nclass Order(faust.Record):\n    account_id: str\n    amount: int\n\n@app.agent(value_type=Order)\nasync def order(orders):\n    async for order in orders:\n        # process infinite stream of orders.\n        print(f'Order for {order.account_id}: {order.amount}')\n```\n\nThe Agent decorator defines a \"stream processor\" that essentially\nconsumes from a Kafka topic and does something for every event it receives.\n\nThe agent is an `async def` function, so can also perform\nother operations asynchronously, such as web requests.\n\nThis system can persist state, acting like a database.\nTables are named distributed key/value stores you can use\nas regular Python dictionaries.\n\nTables are stored locally on each machine using a super fast\nembedded database written in C++, called `RocksDB`.\n\nTables can also store aggregate counts that are optionally \"windowed\"\nso you can keep track\nof \"number of clicks from the last day,\" or\n\"number of clicks in the last hour.\" for example. Like `Kafka Streams`,\nwe support tumbling, hopping and sliding windows of time, and old windows\ncan be expired to stop data from filling up.\n\nFor reliability, we use a Kafka topic as \"write-ahead-log\".\nWhenever a key is changed we publish to the changelog.\nStandby nodes consume from this changelog to keep an exact replica\nof the data and enables instant recovery should any of the nodes fail.\n\nTo the user a table is just a dictionary, but data is persisted between\nrestarts and replicated across nodes so on failover other nodes can take over\nautomatically.\n\nYou can count page views by URL:\n\n```python\n# data sent to 'clicks' topic sharded by URL key.\n# e.g. key=\"http://example.com\" value=\"1\"\nclick_topic = app.topic('clicks', key_type=str, value_type=int)\n\n# default value for missing URL will be 0 with `default=int`\ncounts = app.Table('click_counts', default=int)\n\n@app.agent(click_topic)\nasync def count_click(clicks):\n    async for url, count in clicks.items():\n        counts[url] += count\n```\n\nThe data sent to the Kafka topic is partitioned, which means\nthe clicks will be sharded by URL in such a way that every count\nfor the same URL will be delivered to the same Faust worker instance.\n\nFaust supports any type of stream data: bytes, Unicode and serialized\nstructures, but also comes with \"Models\" that use modern Python\nsyntax to describe how keys and values in streams are serialized:\n\n```python\n# Order is a json serialized dictionary,\n# having these fields:\n\nclass Order(faust.Record):\n    account_id: str\n    product_id: str\n    price: float\n    quantity: float = 1.0\n\norders_topic = app.topic('orders', key_type=str, value_type=Order)\n\n@app.agent(orders_topic)\nasync def process_order(orders):\n    async for order in orders:\n        # process each order using regular Python\n        total_price = order.price * order.quantity\n        await send_order_received_email(order.account_id, order)\n```\n\nFaust is statically typed, using the `mypy` type checker,\nso you can take advantage of static types when writing applications.\n\nThe Faust source code is small, well organized, and serves as a good\nresource for learning the implementation of `Kafka Streams`.\n\n**Learn more about Faust in the** `introduction` **introduction page**\n    to read more about Faust, system requirements, installation instructions,\n    community resources, and more.\n\n**or go directly to the** `quickstart` **tutorial**\n    to see Faust in action by programming a streaming application.\n\n**then explore the** `User Guide`\n    for in-depth information organized by topic.\n\n- `Robinhood`: http://robinhood.com\n- `async/await`:https://medium.freecodecamp.org/a-guide-to-asynchronous-programming-in-python-with-asyncio-232e2afa44f6\n- `Celery`: http://celeryproject.org\n- `Kafka Streams`: https://kafka.apache.org/documentation/streams\n- `Apache Spark`: http://spark.apache.org\n- `Storm`: http://storm.apache.org\n- `Samza`: http://samza.apache.org\n- `Flink`: http://flink.apache.org\n- `RocksDB`: http://rocksdb.org\n- `Aerospike`: https://www.aerospike.com/\n- `Apache Kafka`: https://kafka.apache.org\n\n## Local development\n\n1. Clone the project\n2. Create a virtualenv: `python3.7 -m venv venv \u0026\u0026 source venv/bin/activate`\n3. Install the requirements: `./scripts/install`\n4. Run lint: `./scripts/lint`\n5. Run tests: `./scripts/tests`\n\n## Faust key points\n\n### Simple\n\nFaust is extremely easy to use. To get started using other stream processing\nsolutions you have complicated hello-world projects, and\ninfrastructure requirements.  Faust only requires Kafka,\nthe rest is just Python, so If you know Python you can already use Faust to do\nstream processing, and it can integrate with just about anything.\n\nHere's one of the easier applications you can make::\n\n```python\nimport faust\n\nclass Greeting(faust.Record):\n    from_name: str\n    to_name: str\n\napp = faust.App('hello-app', broker='kafka://localhost')\ntopic = app.topic('hello-topic', value_type=Greeting)\n\n@app.agent(topic)\nasync def hello(greetings):\n    async for greeting in greetings:\n        print(f'Hello from {greeting.from_name} to {greeting.to_name}')\n\n@app.timer(interval=1.0)\nasync def example_sender(app):\n    await hello.send(\n        value=Greeting(from_name='Faust', to_name='you'),\n    )\n\nif __name__ == '__main__':\n    app.main()\n```\n\nYou're probably a bit intimidated by the `async` and `await` keywords,\nbut you don't have to know how ``asyncio`` works to use\nFaust: just mimic the examples, and you'll be fine.\n\nThe example application starts two tasks: one is processing a stream,\nthe other is a background thread sending events to that stream.\nIn a real-life application, your system will publish\nevents to Kafka topics that your processors can consume from,\nand the background thread is only needed to feed data into our\nexample.\n\n### Highly Available\n\nFaust is highly available and can survive network problems and server\ncrashes.  In the case of node failure, it can automatically recover,\nand tables have standby nodes that will take over.\n\n### Distributed\n\nStart more instances of your application as needed.\n\n### Fast\n\nA single-core Faust worker instance can already process tens of thousands\nof events every second, and we are reasonably confident that throughput will\nincrease once we can support a more optimized Kafka client.\n\n### Flexible\n\nFaust is just Python, and a stream is an infinite asynchronous iterator.\nIf you know how to use Python, you already know how to use Faust,\nand it works with your favorite Python libraries like Django, Flask,\nSQLAlchemy, NLTK, NumPy, SciPy, TensorFlow, etc.\n\n## Bundles\n\nFaust also defines a group of ``setuptools`` extensions that can be used\nto install Faust and the dependencies for a given feature.\n\nYou can specify these in your requirements or on the ``pip``\ncommand-line by using brackets. Separate multiple bundles using the comma:\n\n```sh\npip install \"faust-streaming[rocksdb]\"\n\npip install \"faust-streaming[rocksdb,uvloop,fast,redis,aerospike]\"\n```\n\nThe following bundles are available:\n\n## Faust with extras\n\n### Stores\n\n#### RocksDB\n\nFor using `RocksDB` for storing Faust table state. **Recommended in production.**\n\n`pip install faust-streaming[rocksdb]` (uses RocksDB 6)\n\n`pip install faust-streaming[rocksdict]` (uses RocksDB 8, not backwards compatible with 6)\n\n\n#### Aerospike\n\n`pip install faust-streaming[aerospike]` for using `Aerospike` for storing Faust table state. **Recommended if supported**\n\n### Aerospike Configuration\nAerospike can be enabled as the state store by specifying\n`store=\"aerospike://\"`\n\nBy default, all tables backed by Aerospike use `use_partitioner=True` and generate changelog topic events similar\nto a state store backed by RocksDB.\nThe following configuration options should be passed in as keys to the options parameter in [Table](https://faust-streaming.github.io/faust/reference/faust.tables.html)\n`namespace` : aerospike namespace\n\n`ttl`: TTL for all KV's in the table\n\n`username`: username to connect to the Aerospike cluster\n\n`password`: password to connect to the Aerospike cluster\n\n`hosts` : the hosts parameter as specified in the [aerospike client](https://www.aerospike.com/apidocs/python/aerospike.html)\n\n`policies`: the different policies for read/write/scans [policies](https://www.aerospike.com/apidocs/python/aerospike.html)\n\n`client`: a dict of `host` and `policies` defined above\n\n### Caching\n\n`faust-streaming[redis]` for using `Redis` as a simple caching backend (Memcached-style).\n\n### Codecs\n\n`faust-streaming[yaml]` for using YAML and the `PyYAML` library in streams.\n\n### Optimization\n\n`faust-streaming[fast]` for installing all the available C speedup extensions to Faust core.\n\n### Sensors\n\n`faust-streaming[datadog]` for using the `Datadog` Faust monitor.\n\n`faust-streaming[statsd]` for using the `Statsd` Faust monitor.\n\n`faust-streaming[prometheus]` for using the `Prometheus` Faust monitor.\n\n### Event Loops\n\n`faust-streaming[uvloop]` for using Faust with `uvloop`.\n\n`faust-streaming[eventlet]` for using Faust with `eventlet`\n\n### Debugging\n\n`faust-streaming[debug]` for using `aiomonitor` to connect and debug a running Faust worker.\n\n`faust-streaming[setproctitle]`when the `setproctitle` module is installed the Faust worker will use it to set a nicer process name in `ps`/`top` listings.vAlso installed with the `fast` and `debug` bundles.\n\n## Downloading and installing from source\n\nDownload the latest version of Faust from https://pypi.org/project/faust-streaming/\n\nYou can install it by doing:\n\n```sh\n$ tar xvfz faust-streaming-0.0.0.tar.gz\n$ cd faust-streaming-0.0.0\n$ python setup.py build\n# python setup.py install\n```\n\nThe last command must be executed as a privileged user if\nyou are not currently using a virtualenv.\n\n## Using the development version\n\n### With pip\n\nYou can install the latest snapshot of Faust using the following `pip` command:\n\n```sh\npip install https://github.com/faust-streaming/faust/zipball/master#egg=faust\n```\n\n## FAQ\n\n### Can I use Faust with Django/Flask/etc\n\nYes! Use ``eventlet`` as a bridge to integrate with ``asyncio``.\n\n### Using eventlet\n\nThis approach works with any blocking Python library that can work with `eventlet`\n\nUsing `eventlet` requires you to install the `faust-aioeventlet` module,\nand you can install this as a bundle along with Faust:\n\n```sh\npip install -U faust-streaming[eventlet]\n```\n\nThen to actually use eventlet as the event loop you have to either\nuse the `-L \u003cfaust --loop\u003e` argument to the `faust` program:\n\n```sh\nfaust -L eventlet -A myproj worker -l info\n```\n\nor add `import mode.loop.eventlet` at the top of your entry point script:\n\n```python\n#!/usr/bin/env python3\nimport mode.loop.eventlet  # noqa\n```\n\nIt's very important this is at the very top of the module,\nand that it executes before you import libraries.\n\n### Can I use Faust with Tornado\n\nYes! Use the `tornado.platform.asyncio` [bridge](http://www.tornadoweb.org/en/stable/asyncio.html)\n\n### Can I use Faust with Twisted\n\nYes! Use the `asyncio` reactor implementation: https://twistedmatrix.com/documents/current/api/twisted.internet.asyncioreactor.html\n\n### Will you support Python 2.7 or Python 3.5\n\nNo. Faust requires Python 3.8 or later, since it heavily uses features that were\nintroduced in Python 3.6 (`async`, `await`, variable type annotations).\n\n### I get a maximum number of open files exceeded error by RocksDB when running a Faust app locally. How can I fix this\n\nYou may need to increase the limit for the maximum number of open files.\nOn macOS and Linux you can use:\n\n```ulimit -n max_open_files``` to increase the open files limit to max_open_files.\n\nOn docker, you can use the --ulimit flag:\n\n```docker run --ulimit nofile=50000:100000 \u003cimage-tag\u003e```\nwhere 50000 is the soft limit, and 100000 is the hard limit [See the difference](https://unix.stackexchange.com/a/29579).\n\n### What kafka versions faust supports\n\nFaust supports kafka with version \u003e= 0.10.\n\n## Getting Help\n\n### Slack\n\nFor discussions about the usage, development, and future of Faust, please join the `fauststream` Slack.\n\n- https://fauststream.slack.com\n- Sign-up: https://join.slack.com/t/fauststreaming/shared_invite/zt-1q1jhq4kh-Q1t~rJgpyuMQ6N38cByE9g\n\n## Resources\n\n### Bug tracker\n\nIf you have any suggestions, bug reports, or annoyances please report them\nto our issue tracker at https://github.com/faust-streaming/faust/issues/\n\n## License\n\nThis software is licensed under the `New BSD License`. See the `LICENSE` file in the top distribution directory for the full license text.\n\n### Contributing\n\nDevelopment of `Faust` happens at [GitHub](https://github.com/faust-streaming/faust)\n\nYou're highly encouraged to participate in the development of `Faust`.\n\n### Code of Conduct\n\nEveryone interacting in the project's code bases, issue trackers, chat rooms,\nand mailing lists is expected to follow the Faust Code of Conduct.\n\nAs contributors and maintainers of these projects, and in the interest of fostering\nan open and welcoming community, we pledge to respect all people who contribute\nthrough reporting issues, posting feature requests, updating documentation,\nsubmitting pull requests or patches, and other activities.\n\nWe are committed to making participation in these projects a harassment-free\nexperience for everyone, regardless of level of experience, gender,\ngender identity and expression, sexual orientation, disability,\npersonal appearance, body size, race, ethnicity, age,\nreligion, or nationality.\n\nExamples of unacceptable behavior by participants include:\n\n- The use of sexualized language or imagery\n- Personal attacks\n- Trolling or insulting/derogatory comments\n- Public or private harassment\n- Publishing other's private information, such as physical or electronic addresses, without explicit permission\n- Other unethical or unprofessional conduct.\n\nProject maintainers have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct. By adopting this Code of Conduct,\nproject maintainers commit themselves to fairly and consistently applying\nthese principles to every aspect of managing this project. Project maintainers\nwho do not follow or enforce the Code of Conduct may be permanently removed from\nthe project team.\n\nThis code of conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community.\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by opening an issue or contacting one or more of the project maintainers.\n","funding_links":[],"categories":["Streaming","Python","Stream Processing","\u003ca name=\"Python\"\u003e\u003c/a\u003ePython","Clients"],"sub_categories":["Vectors","Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaust-streaming%2Ffaust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaust-streaming%2Ffaust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaust-streaming%2Ffaust/lists"}