Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

onecode_logo

GitHub release PyPI - License PyPI - Python Version GitHub Workflow Status Windows supported Linux supported MacOS supported Maintainability Coverage


OneCode 2 is for the new OneCode Cloud. An app is a single main.py: flows, .onecode.json and onecode_ext are gone. Apps for the legacy OneCode Cloud stay on 1.3.x, which receives security fixes until 30 June 2027 (see SECURITY.md). See Upgrading from 1.x.

OneCode, your gateway to Python application deployment on the Cloud!

🐍 OneCode in One Minute

Create your first OneCode app

With uv:

uvx --from onecode onecode-create "Hello World"

⠋ Creating new OneCode project
✅ Created Hello World OneCode project in ./Hello_World

This creates the app in a new Hello_World folder:

Hello_World/
├── main.py             # your app
├── requirements.txt    # the packages it needs, starting with onecode>=2,<3
├── data/               # input data, and outputs under data/outputs/
├── README.md
├── LICENSE
└── .gitignore

Write your app

Your code goes in the run() function of main.py. Replace hard-coded values with OneCode Elements, here a text input:

import onecode


def run():
    name = onecode.text_input("name", "World", label="Your name")
    onecode.Logger.info(f"Hello {name}!")


if __name__ == "__main__":
    onecode.main(run)

Keep the last two lines: onecode.main(run) is what runs the app. Bigger apps add modules or packages next to main.py and import them as usual.

Run your app

cd Hello_World
uv venv
uv pip install -r requirements.txt
uv run python main.py

# You should see the following printed
2026-11-29 10:00:00,000 [INFO] main.py:6 - Hello World!

The text input takes World by default, and any other value without changing the code:

uv run onecode-extract params.json   # writes {"name": "World"}: edit it
uv run python main.py params.json

🎉 Congratulations, you now are a OneCoder! 🎉

🌋 Deploy on OneCode Cloud

  1. Push your app to a GitHub repository.
  2. Register the app on OneCode Cloud with Register app, and pick the repository and branch.
  3. OneCode Cloud builds it: it installs requirements.txt, then runs onecode-build to turn your input elements into the app's run form.
  4. Each run is python main.py params.json with the values entered in the form. Files written with file_output() are the run's results.

Each new commit pushed to the registered branch triggers a new build.

🚀 Getting Started with the OneCode API

OneCode relies on the following principles:

  • no-disruption: OneCode doesn't force you to change the way you code. No matter what your code structure and Python files hierarchy, OneCode can seamlessly be integrated with it.

  • controllable input parameters: simply replace your hard-coded parameters with OneCode functions (called Elements) so that their value can change without having to change the code. One Code, many ways to run!

  • automated interface: OneCode push on the cloud, the interface will automatically be generated from the OneCode Elements

  • easy deployment: no need to change the code between your local machine and the cloud. Simply push your code as-is on your synchronized GitHub account and your App (environment and UI!) will build automatically!

The most important part of the API are Input and Output Elements. They can be inlined within your code or not, that's up to you (no-disruption!), see examples below:

  • use Input Elements whenever you need to expose a parameter with a specific widget. For example:
# instead of: df = pd.read_csv('test.csv')
df = csv_reader('your df', 'test.csv')

# instead of: for i in range(5):
for i in range(slider('N', 5, min=0, max=10)):  # inlined
    # do stuff

# instead of: choice = 'cat'
choice = dropdown('your choice', 'cat', options=['dog', 'cat', 'fish']) # not inlined
Logger.info(f'Your choice is {choice}')
# instead of: plt.savefig('stuff.png')
plt.savefig(file_output('stuff', 'stuff.png'))  # inlined

# instead of: filepath = 'test.txt'
filepath = file_output('test', 'test.txt')  # not inlined
with open(filepath, 'w') as f:
    # do stuff

Check out the full API documentation here!

⬆️ Upgrading from 1.x

An app with one flow (the usual case) moves in a few steps:

  1. Move the body of flows/<id>.py into main.py, keep def run(), and end the file with:
    if __name__ == "__main__":
        onecode.main(run)
    
  2. Move helper modules out of flows/, next to main.py or into a package, and turn relative imports such as from .utils import x into from utils import x.
  3. Delete .onecode.json, flows/ and any flows/onecode_ext/.
  4. In requirements.txt, change onecode>=1,<2 to onecode>=2,<3.
  5. Drop reads of Project().current_flow. Code that opens outputs/<flow>/MANIFEST.txt itself now opens outputs/MANIFEST.txt.

Element keys, parameters files, the data/ layout and file_output() paths do not change, so saved parameters keep working. The OneCode 2 CLIs stop with 1.x project: pin onecode<2 when they find a .onecode.json.

python main.py no longer takes --flow or --flush. onecode-add, onecode-start, onecode-zip and onecode-check are removed. See the 2.0.0 changelog for the full list.

🚧 Work in Progress

As onecode is still transitioning to OneCode Cloud, early versions of the OneCode Cloud don't yet support completely the following features:

  • Folder Inputs: as the cloud doesn't really have directory structures, it needs some special work. In the meantime, replace with multiple selection file_input instead.

  • Dynamic options: dynamic expressions in options of the dropdown element) is not fully supported yet. You can still use it, in that case, the elements will ask user to fill out values as regular text input (e.g. CSV column names, etc.).

  • Dynamic optional: optional as True/False (static) works as expected, however dynamnic expressions will be ignored for now. As a consequence, hide_when_disabled attribute is obsolete until dynamic optional are supported again.

  • Attribute count: we go back-and-forth with this one on bringing this one to the Cloud. In the meantime, switch back to non-dynamic elements, e.g. multiple dropdown, text input collecting list of values, etc.

👋 Getting Help

Security reports go through private vulnerability reporting. See SECURITY.md. Security fixes are published for the latest 2.x release, and for the 1.3.x line until 30 June 2027.

Issues labeled cra-vulnerability come from the dependency scan. They are not the place to disclose a new flaw.

If you are a OneCode customer, you may directly email our support team. Feel free as well to browse the GitHub Issues and reach out to the community by posting bug reports, questions and suggestions.

Metadata

Release files for onecode 2.0.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onecode 2.0.0rc1
File Size Uploaded Provenance Actions
onecode-2.0.0rc1.tar.gz 59.6 kB Without provenance Details for onecode-2.0.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for onecode 2.0.0rc1
File Interpreter ABI Platform Actions
onecode-2.0.0rc1-py3-none-any.whl Python 3 none any Details for onecode-2.0.0rc1-py3-none-any.whl

Total release size: 154.8 kB

Release files / onecode-2.0.0rc1.tar.gz

Download URL onecode-2.0.0rc1.tar.gz
Size 59.6 kB
Tags Source
SHA-256 checksum
How to use checksums
01d4016b3b3852cb8180a638af433440068dd898a258ecf9aea48b5d627f1125
BLAKE2b-256 checksum
How to use checksums
50e7dd663d562f5becc598d45ad5c09a73d6d1579cf13c864bb021f3ff4d0af1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / onecode-2.0.0rc1-py3-none-any.whl

Download URL onecode-2.0.0rc1-py3-none-any.whl
Size 95.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b59c70ed1b9e41af01d11c11aec1bbbe7ac805e8192081fddcba32a3cce6ddb
BLAKE2b-256 checksum
How to use checksums
c60cdf2fcafd24ed0d92857c476baa9f27ddf15354043e9226d2dd61afb6bc65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for onecode 2.0.0rc1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page