---
title: "Exsssspanding Possibilities with Python 🐍"
description: "Python server code for your production Firebase apps."
published: "2023-11-16"
last_updated: "2023-11-16"
authors:
  - "Chris Gill (Product Manager)"
  - "Jeff Huleatt (Developer Relations Engineer)"
categories:
  - "Cloud Functions"
  - "Web"
  - "Python"
  - "Launch"
canonical_url: "https://firebase.blog/posts/2023/11/python-functions-ga"
---

# Exsssspanding Possibilities with Python 🐍

_Python server code for your production Firebase apps._

*Published November 16, 2023 by Chris Gill (Product Manager), Jeff Huleatt (Developer Relations Engineer)*

---
Calling all Python enthusiasts! The day you've been waiting for has finally arrived.

> Python support in Cloud Functions for Firebase has officially graduated from public preview to general availability 🎉🐍

Since the [introduction of Python support at Google I/O](https://firebase.blog/posts/2023/07/cloud-functions-firebase-ga-and-python/#introducing-support-for-python) earlier this year, we've been working hard on Python support to ensure it matches the capabilities and reliability of Node.js support so that you can confidently use it in your production apps.

### Unlocking the Power of Python's Ecosystem

Previously, Cloud Functions for Firebase only supported Node.js, a popular JavaScript runtime environment. While Node.js has its strengths, we know not everyone loves to write their backend code in JavaScript or TypeScript. If you're more comfortable with Python, write in Python!

Plus, Python's extensive collection of libraries, particularly in the domains of machine learning and data processing, is now readily available within Cloud Functions. This means you can integrate these powerful libraries into your backend solutions, making it easier than ever to build intelligent services and handle large datasets.

- [Numpy](https://numpy.org/)
- [TensorFlow](https://tensorflow.org/)
- [Pandas](https://pandas.pydata.org/)
- [Flask](https://flask.palletsprojects.com/)
- [Vertex AI](https://cloud.google.com/vertex-ai)
- [LangChain](https://python.langchain.com/docs/get_started/introduction)
- [SciPy](https://scipy.org/)

### AI at Your Fingertips with Vertex, PaLM, and TensorFlow

Run models locally with TensorFlow, or use the convenient Python SDKs for Cloud Vertex or PaLM to integrate powerful machine learning models into your app in a way that scales. In this demo, Product Manager Chris Gill demonstrates chaining together Imagen and PaLM with Vertex AI to create an app that will generate a poem for any image:

[Video: Using AI to generate poems from pictures with Python in Firebase](https://www.youtube.com/watch?v=mvEHYMsk_AE)

Check out the source code for the demo [on GitHub](https://github.com/FirebaseExtended/poem-from-image) to try it yourself.

### The Integration you Expect from Cloud Functions for Firebase

Just like with Node, you can trigger your functions directly via an HTTP request or callable function, or based off of background events in Firebase, like a write to Cloud Firestore, or a new upload to Cloud Storage. You can use our provided logging library to easily log structured data to Cloud Logging. Check out the [use cases documentation](https://firebase.google.com/docs/functions/use-cases) to see what's possible!

**`main.py`**

```python
from firebase_functions import firestore_fn, logger

@firestore_fn.on_document_created(document="messages/{pushId}")
def makeuppercase(event):
    # Get the value of "original" from the new Firestore document.
    original = event.data.get("original")
    logger.info(f"Uppercasing {original}", doc_id=event.params["pushId"])

    # Uppercase the text and write it back to Firestore.
    upper = original.upper()
    event.data.reference.update({"uppercase": upper})
```

### Try it out

For all you Pythonistas out there, we hope that this update helps you supercharge your app development with Firebase.

**Spin up a project:**

```bash
firebase init functions
```

If you'd like to give Python a try, take a look at the [getting started guide](https://firebase.google.com/docs/functions/get-started?gen=2nd#python) to learn how to write your own Python functions. Or, start with a prebuilt sample in the [functions-samples GitHub repository](https://github.com/firebase/functions-samples/tree/main/Python).

#### Let us know what you think

- Request new features on the [Firebase Feature Requests Portal](https://firebase.uservoice.com/forums/948424-general?category_id=464863)
- Problem deploying? Find help on the [support page](https://firebase.google.com/support)
- Report bugs on the open source repositories for [Python](https://github.com/firebase/firebase-functions-python) and [Node](https://github.com/firebase/firebase-functions)

> **[Cloud Functions for Firebase](https://firebase.google.com/docs/functions)** — Write code that responds to events and invokes functionality exposed by other Firebase features.
