auto-app-panel
Automatically generate a Code Ocean App Panel from an argument parser defined in code.
Status
- Initial release supporting extraction from
pydantic_settings.BaseSettingsandargparse.ArgumentParserclasses at top-level of a specified Python file.
TODO
- support classes defined inside functions or conditionals
- preserve groups and other formatting in existing app panel
- create explicit string/number/integer Parameter classes to support additional constraints (e.g. min/max length for strings, regex validators etc.) - see codeocean sdk for full schema
Usage
Typical Workflow
- Develop your code with a class for parsing capsule parameters at the top-level of the file (not inside a function or conditional)
- Run the tool in a Code Ocean cloud workstation terminal, pointing to the file containing the parameter-parsing class:
pip install auto-app-panel auto-app-panel /root/capsule/code/run.py
This generates/root/capsule/.codeocean/app-panel.json, which configures the capsule's App Panel GUI. - Re-run the tool when you add/modify parameters (use
--strategy preserveto keep any edits made in the App Panel GUI/in an existingapp-panel.json) - Verify that the App Panel is visible and has all expected fields when you exit the cloud workstation
Command Line Interface
auto-app-panel SOURCE [OUTPUT] [OPTIONS]
Arguments:
SOURCE- Path to Python file containing argument parsing class (required)OUTPUT- Output path for app-panel.json (default:/root/capsule/.codeocean/app-panel.json)
Options:
--strategy [overwrite|preserve]- Merge strategy (default:preserve)overwrite: Updates parameter values from code, preserves existing descriptionspreserve: Keeps all existing values, only adds new parameters
--no-backup- Skip creating timestamped backup of existing file
Example files
Input Python file (run.py):
import time
import pydantic
import pydantic_settings
class Params(pydantic_settings.BaseSettings):
max_workers: int | None = pydantic.Field(6, description="Number of parallel workers. Leave empty or set to 0 to use max available.")
threshold: float = 0.5
output_dir: str = pydantic.Field("/root/capsule/results/dryrun", description="Output path for results, posix format.")
save_intermediate: bool = False
# other attributes that are not parsed from command-line inputs (e.g. PrivateAttr or @computed_field) are ignored
_start_time: float = pydantic.PrivateAttr(time.time())
# Ensure class parses arguments from command line (and set priority of other sources):
@classmethod
def settings_customise_sources(
cls,
settings_cls,
init_settings,
*args,
**kwargs,
):
# instantiating the class will use arguments passed directly, or provided via the command line/app panel
# - the order of the sources below defines the priority (highest to lowest):
# - for each field in the class, the first source that contains a value will be used
return (
init_settings,
pydantic_settings.sources.JsonConfigSettingsSource(settings_cls, json_file='parameters.json'),
pydantic_settings.CliSettingsSource(settings_cls, cli_parse_args=True),
)
Generate file at standard path:
auto-app-panel /root/capsule/code/run.py
Generated app-panel.json:
{
"version": 1,
"named_parameters": true,
"parameters": [
{
"id": "a1b2c3d4e5f6g7h8",
"name": "max_workers",
"param_name": "max_workers",
"description": "Number of parallel workers",
"help_text": "Number of parallel workers",
"type": "text",
"value_type": "integer",
"default_value": "6"
},
{
"id": "i9j0k1l2m3n4o5p6",
"name": "threshold",
"param_name": "threshold",
"type": "text",
"value_type": "number",
"default_value": "0.5"
},
{
"id": "q7r8s9t0u1v2w3x4",
"name": "output_dir",
"param_name": "output_dir",
"description": "Output path for results, posix format.",
"help_text": "Output path for results, posix format.",
"type": "text",
"value_type": "string",
"default_value": "/root/capsule/results/dryrun"
},
{
"id": "y5z6a7b8c9d0e1f2",
"name": "save_intermediate",
"param_name": "save_intermediate",
"type": "text",
"value_type": "integer",
"default_value": "0",
"minimum": 0,
"maximum": 1
}
]
}
Development
Clone the repository and setup with uv sync.
Run tests with uv run task test.
Pushing to main or creating a PR to main will trigger CI/CD. Updates on main that pass all tests
will trigger a minor version bump, then be published on PyPI.
Metadata
Release files for auto-app-panel 0.1.3
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 | |
|---|---|---|---|---|
| auto_app_panel-0.1.3.tar.gz | 8.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auto_app_panel-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.6 kB
Release files / auto_app_panel-0.1.3.tar.gz
| Download URL | auto_app_panel-0.1.3.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
370225cb65e8ef7ff0364017d3dacee6c2a802397dbf4752cc94cb2f651c3cad
|
|
BLAKE2b-256 checksum How to use checksums |
c86913dff8b5e266bf908d0ef787643870e19d85812a08f5426faa8533d34f53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / auto_app_panel-0.1.3-py3-none-any.whl
| Download URL | auto_app_panel-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
008f203f142cc1adaf587f45d8eec85c5b942d770d5d8a8dfea799886b5f9e82
|
|
BLAKE2b-256 checksum How to use checksums |
138c8350b551c4ffce695842078708cdde8c330b746d5a4c2d57acbaacf26835
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for auto-app-panel 0.1.3
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.