This release is a pre-release and may not be stable for production use.
OneCode 2 is for the new OneCode Cloud. An app is a single
main.py: flows,.onecode.jsonandonecode_extare 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
- Deploy on OneCode Cloud
- Getting Started with the OneCode API
- Upgrading from 1.x
- Work in Progress
- Getting Help
🐍 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.
onecode-extract and onecode-build read the elements without running the app, so write
their arguments in the call: values, onecode and its enums such as FileFilter.CSV, or os.
An argument that names a variable of the app stops them with an error.
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
- Push your app to a GitHub repository.
- Register the app on OneCode Cloud with Register app, and pick the repository and branch.
- OneCode Cloud builds it: it installs
requirements.txt, then runsonecode-buildto turn your input elements into the app's run form. - Each run is
python main.py params.jsonwith the values entered in the form. Files written withfile_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}')
- use Output Elements whenever an output should be returned. For example:
# 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:
- Move the body of
flows/<id>.pyintomain.py, keepdef run(), and end the file with:if __name__ == "__main__": onecode.main(run)
- Move helper modules out of
flows/, next tomain.pyor into a package, and turn relative imports such asfrom .utils import xintofrom utils import x. - Delete
.onecode.json,flows/and anyflows/onecode_ext/. - In
requirements.txt, changeonecode>=1,<2toonecode>=2,<3. - Drop reads of
Project().current_flow. Code that opensoutputs/<flow>/MANIFEST.txtitself now opensoutputs/MANIFEST.txt.
Element keys, parameters files, the data/ layout and file_output() paths do not change, so
saved parameters keep working. An element whose arguments cannot be read, such as one that names
a variable of the app, now stops onecode-extract and onecode-build: 1.x left it out of the
parameters and the run form. 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_inputinstead. -
Dynamic
options: dynamic expressions inoptionsof thedropdownelement) 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:optionalasTrue/False(static) works as expected, however dynamnic expressions will be ignored for now. As a consequence,hide_when_disabledattribute is obsolete until dynamicoptionalare 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.0rc2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| onecode-2.0.0rc2.tar.gz | 60.5 kB | Without provenance | Details for onecode-2.0.0rc2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| onecode-2.0.0rc2-py3-none-any.whl | Python 3 | none | any | Details for onecode-2.0.0rc2-py3-none-any.whl |
Total release size: 156.7 kB
Release files / onecode-2.0.0rc2.tar.gz
| Download URL | onecode-2.0.0rc2.tar.gz |
|---|---|
| Size | 60.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1b53b516977834e3e60a419b99a81d74995c121e5a20aeee3e0e4262fd314cd
|
|
BLAKE2b-256 checksum How to use checksums |
acd2982706a8c02b6490cfe4945690f5efa0f9e77316dd5bf86344ca535db64b
|
| 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.0rc2-py3-none-any.whl
| Download URL | onecode-2.0.0rc2-py3-none-any.whl |
|---|---|
| Size | 96.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9197c123b022f54edee0c0fc0a4d27c328c629fca2b15c4475e64353d4277a97
|
|
BLAKE2b-256 checksum How to use checksums |
5d9cbfe930403fca867dedbd27767acff8ab23795985aaba5ede6aa985e1fc73
|
| 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.0rc2
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.