Go back

Revamping Publishing & Python Micros

April 12, 2023

Changelog

Note: To use the changes to both Publishing and Python Micros, you’ll first need to update to the latest Space CLI via space version upgrade.

Improved Publishing Flow

A lot of developers have been slightly confused with the concept of publishing an app on Deta Discovery. As a result, Discovery has been filled with apps that are not quite ready for public use. To fix this, we’ve reworked the publishing process to make it more clear what publishing an app means and to make it easier to customize your app’s listing on Discovery.

New CLI Flow

The Space CLI will now do two things before you can release an app to Deta Discovery:

  • ask for confirmation
  • prompt you to give your app a name and description if the Discovery.md file is missing
Terminal window
> space release --listed
Creating a listed release makes your app available on Deta Discovery for anyone to install and use.
If you only want to use this app yourself, use your Builder instance instead.
? Are you sure you want to release this app publicly on Discovery? (y/n) y
Please give your app a friendly name and add a short description so others know what this app does.
? App Name (max 12 chars): My App
? App Description (max 69 chars): This is my app

New Builder UI Flow

We’ve also added the ability to update the Discovery page of an app through the Builder UI when creating a new release. You can now specify/edit all the fields from the Discovery.md file as well as write and preview the app’s Markdown description. This will help you make sure your app’s listing is ready to go before publishing.

Publish Release Through Builder

Both flows were made possible because we moved the Discovery data from “revisions” to “releases”. Consequently, you can now modify the Discovery data of your app and publish, without having to do space push or wait for a new build.

⚠️ Important Note:

For this to work we had to move the app_name from the Spacefile into the Discovery.md file. This means that you’ll need to add the app_name to your Discovery.md file if you want to customize your app’s name, otherwise it will default to the name of your project. For now we still support the app_name in the Spacefile for backwards compatibility, but we’ll be removing it in the future.

We have even more improvements coming to publishing on Space very soon, so stay tuned!

Revamped Python Micros

We’ve also made a change to how Python Micros are run.

Previously, Python Micros were run using an internal library that wrapped your Python app. This meant that we only supported a few Python frameworks and that we had to maintain our own library.

We’ve now changed this so that Python Micros are run using the same mechanism as the other Micros. Consequently, you should be able to run any Python HTTP server with your own run command and you’ll also face a lot less bugs.

Going forward with Python Micros, you simply need to specify a run command that starts an HTTP server on the port specified by the PORT environment variable in your Spacefile. Here’s an example using the FastAPI framework:

# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0
v: 0
micros:
- name: python-app
src: .
engine: python3.9
run: uvicorn main:app

More information about how to run Python Micros can be found in the Spacefile docs.

We will continue to support the old standard of running Python Micros for the time being, but we’ll be removing it in the future. We recommend that you update your Spacefiles in the meanwhile. If you have any questions or feedback, please let us know in the Discord.

Raycast Extension

If you are a Raycast user we have some good news: Space now has its own Raycast extension! 🎉

Browsing Discovery with the Raycast Extension

You can now use Raycast to launch your installed Space apps, search through your Builder projects and browse through Discovery. You can find the extension in the Raycast Store, and the source code on GitHub. We welcome any feedback and contributions.

A big thank you to @SlumberDemon for building this extension!

Space CLI Bug Fixes and Improvements

  • space dev improvements
    • add support for static micros
    • automatically set the uvicorn port
    • add a log when a micro can not start due to an invalid dev command
  • version check are now disabled in some commands (e.g. space completions)
  • multiple improvements to the Spacefile JSON Schema (thx @lemonyte)

You can get an exhaustive list of the changes in the Space CLI changelog.

Thank you for all the valuable feedback — please continue to share your thoughts as we work to build and improve Space.