MainSequence CLI
This page gives a practical overview of the mainsequence command-line interface.
For command-by-command behavior, use --help (for example: mainsequence project --help).
For a deeper workflow guide, see CLI Deep Dive.
Installation
pip install mainsequence
Authentication
mainsequence login you@company.com
mainsequence login you@company.com 127.0.0.1:8000 mainsequence-dev
mainsequence logout
Backend/base-folder overrides passed to login are terminal-session only. They do not rewrite the persisted CLI settings for other terminals.
If you prefer shell-managed environment variables:
mainsequence login you@company.com --export
mainsequence logout --export
Core Command Groups
Top-Level Commands
mainsequence --help
mainsequence doctor
mainsequence constants --help
mainsequence secrets --help
mainsequence organization --help
mainsequence data-node list
mainsequence markets --help
mainsequence user
mainsequence settings show
mainsequence sdk latest
Project Commands
mainsequence project --help
Most frequently used flows:
# Markets
mainsequence constants list
mainsequence constants list --show-filters
mainsequence constants create APP__MODE production
mainsequence constants create ASSETS__MASTER '{"dataset":"bloomberg"}'
mainsequence constants can_view 42
mainsequence constants can_edit 42
mainsequence constants add_to_view 42 7
mainsequence constants add_to_edit 42 7
mainsequence constants add_team_to_view 42 9
mainsequence constants add_team_to_edit 42 9
mainsequence constants remove_from_view 42 7
mainsequence constants remove_from_edit 42 7
mainsequence constants remove_team_from_view 42 9
mainsequence constants remove_team_from_edit 42 9
mainsequence constants delete 42
mainsequence secrets list
mainsequence secrets list --show-filters
mainsequence secrets create API_KEY super-secret-value
mainsequence secrets can_view 42
mainsequence secrets can_edit 42
mainsequence secrets add_to_view 42 7
mainsequence secrets add_to_edit 42 7
mainsequence secrets add_team_to_view 42 9
mainsequence secrets add_team_to_edit 42 9
mainsequence secrets remove_from_view 42 7
mainsequence secrets remove_from_edit 42 7
mainsequence secrets remove_team_from_view 42 9
mainsequence secrets remove_team_from_edit 42 9
mainsequence secrets delete 42
mainsequence organization project-names
mainsequence organization teams list
mainsequence organization teams list --show-filters
mainsequence organization teams create Research --description "Model validation"
mainsequence organization teams edit 9 --name "Research Core" --inactive
mainsequence organization teams can_view 9
mainsequence organization teams can_edit 9
mainsequence organization teams add_to_view 9 7
mainsequence organization teams add_to_edit 9 7
mainsequence organization teams remove_from_view 9 7
mainsequence organization teams remove_from_edit 9 7
mainsequence organization teams delete 9
mainsequence data-node list
mainsequence data-node list --show-filters
mainsequence data-node list --filter id__in=42,43
mainsequence data-node list --data-source-id 2
mainsequence data-node org-unique-identifiers
mainsequence data_node search "close price"
mainsequence data-node search "close price" --data-source-id 2
mainsequence data-node search "portfolio weights" --mode description
mainsequence data-node search close --mode column
mainsequence data-node detail 123
mainsequence data-node refresh-search-index 123
mainsequence data-node can_view 123
mainsequence data-node can_edit 123
mainsequence data-node add_to_view 123 7
mainsequence data-node add_to_edit 123 7
mainsequence data-node add_team_to_view 123 9
mainsequence data-node add_team_to_edit 123 9
mainsequence data-node remove_from_view 123 7
mainsequence data-node remove_from_edit 123 7
mainsequence data-node remove_team_from_view 123 9
mainsequence data-node remove_team_from_edit 123 9
mainsequence data-node delete 123
mainsequence data-node delete 123 --full-delete-selected
mainsequence data-node delete 123 --full-delete-selected --override-protection
mainsequence markets portfolios list
mainsequence markets portfolios list --filter id__in=42
mainsequence markets asset-translation-table list
mainsequence markets asset-translation-table list --show-filters
mainsequence markets asset-translation-table detail 12
# 1) List and create
mainsequence project list
mainsequence project can_view 123
mainsequence project can_edit 123
mainsequence project add_to_view 123 7
mainsequence project add_to_edit 123 7
mainsequence project add_team_to_view 123 9
mainsequence project add_team_to_edit 123 9
mainsequence project remove_from_view 123 7
mainsequence project remove_from_edit 123 7
mainsequence project remove_team_from_view 123 9
mainsequence project remove_team_from_edit 123 9
mainsequence project images list
mainsequence project images list 123
mainsequence project images list --show-filters
mainsequence project images list --filter project_repo_hash__in=4a1b2c3d,5e6f7a8b
mainsequence project create tutorial-project
mainsequence project images create
mainsequence project images create 123
mainsequence project images create 123 4a1b2c3d
mainsequence project images create 123 --timeout 600 --poll-interval 15
mainsequence project jobs list
mainsequence project jobs runs list 91
mainsequence project jobs runs logs 501
mainsequence project jobs runs logs 501 --max-wait-seconds 900
mainsequence project jobs run 91
mainsequence project jobs create --name daily-run --execution-path scripts/test.py
mainsequence project data-node-updates list
mainsequence project data-node-updates list 123
mainsequence project project_resource list
mainsequence project project_resource list --show-filters
mainsequence project project_resource list --filter resource_type=dashboard
# 2) Set up locally
mainsequence project set-up-locally 123
mainsequence project refresh_token
# 3) Environment setup
mainsequence project build_local_venv
mainsequence project build_local_venv --path .
mainsequence project freeze-env --path .
# 4) Day-to-day sync
mainsequence project sync "Update environment"
mainsequence project sync --path . -m "Update environment"
# 5) Docker/devcontainer
mainsequence project build-docker-env --path .
# 6) SDK maintenance
mainsequence project sdk-status --path .
mainsequence project update-sdk --path .
List Filters
Most list commands accept the same generic filter interface:
mainsequence <...> list --show-filters
mainsequence <...> list --filter KEY=VALUE
mainsequence <...> list --filter KEY=VALUE --filter OTHER_KEY=VALUE
Rules:
- Allowed filters are taken from the backing SDK model
FILTERSET_FIELDS. - Value expectations are derived from
FILTER_VALUE_NORMALIZERS. __infilters accept comma-separated values such asid__in=1,2,3.- Some commands always apply scoping filters internally and will reject attempts to override them.
mainsequence project images listalways scopes by the selected project.mainsequence project project_resource listalways scopes by project and upstream remoterepo_commit_sha.mainsequence project jobs runs listalways scopes byjob__id.- If a command's backing model does not expose filter metadata,
--show-filterswill tell you that no additional model filters are available. mainsequence constants listexposes filters fromConstant.FILTERSET_FIELDS, currentlynameandname__in.mainsequence secrets listexposes filters fromSecret.FILTERSET_FIELDS, currentlynameandname__in.
Settings
mainsequence settings show
mainsequence settings set-backend https://main-sequence.app
mainsequence settings set-base ~/mainsequence
Troubleshooting
- Run
mainsequence doctorto check config, auth visibility, and tool availability. - If a command says not logged in, run
mainsequence login <email>again. - If your shell cannot use secure token storage, use
--exportmode. mainsequence usershows the authenticated MainSequence user through the SDK clientUser.get_logged_user()path.mainsequence organization project-nameslists the project names visible to the authenticated user's organization through the SDK clientProject.get_org_project_names()path.mainsequence organization teams listlists teams through the SDK clientTeam.filter()path.mainsequence organization teams create,edit, anddeleteuse the SDK clientTeam.create(),Team.patch(), andTeam.delete()paths.mainsequence organization teams can_viewandcan_editinspect team access through the SDKTeam.can_view()andTeam.can_edit()paths.mainsequence organization teams add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate explicit user access on teams through the SDKTeampermission-action paths.mainsequence constants listlists constants through the SDK clientConstant.filter()path.mainsequence constants createcreates a constant through the SDK clientConstant.create()path and only acceptsnameandvalue.mainsequence constants can_viewlists users returned by the SDKShareableObjectMixin.users_can_view()path forConstant.mainsequence constants can_editlists users returned by the SDKShareableObjectMixin.users_can_edit()path forConstant.mainsequence constants add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate constant user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence constants add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate constant team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence constants deletedeletes a constant through the SDK clientConstant.delete()path and always requires typed verification before the delete call is sent.- Constant names that include a double underscore display the prefix before
__as the terminal category. Example:ASSETS__MASTERis shown under categoryASSETS. mainsequence secrets listlists secrets through the SDK clientSecret.filter()path.mainsequence secrets createcreates a secret through the SDK clientSecret.create()path and only acceptsnameandvalue.mainsequence secrets can_viewlists users returned by the SDKShareableObjectMixin.users_can_view()path forSecret.mainsequence secrets can_editlists users returned by the SDKShareableObjectMixin.users_can_edit()path forSecret.mainsequence secrets add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate secret user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence secrets add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate secret team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence secrets deletedeletes a secret through the SDK clientSecret.delete()path and always requires typed verification before the delete call is sent.- Secret list and delete previews intentionally show metadata only, not secret values.
mainsequence data-node listlists data node storages through the SDK clientDataNodeStorage.filter()path.mainsequence data-node list --show-filtersprints the filters exposed byDataNodeStorage.FILTERSET_FIELDSand the expected value shapes fromFILTER_VALUE_NORMALIZERS.mainsequence data-node list --data-source-id 2is the first-class shortcut for the commondata_source__idfilter.mainsequence data-node org-unique-identifierslists the organization-visible unique identifiers exposed by the SDK clientDataNodeStorage.get_org_unique_identifiers()path.mainsequence data-node searchis the public search command for data nodes. It can search descriptions, columns, or both through the SDK clientDataNodeStorage.description_search()andDataNodeStorage.column_search()paths.mainsequence data-node search --mode descriptiononly usesDataNodeStorage.description_search().mainsequence data-node search --mode columnonly usesDataNodeStorage.column_search().mainsequence data-node search --data-source-id 2is the first-class shortcut for filtering search results by data source.mainsequence data-node searchsupports the same--filter KEY=VALUEand--show-filterspattern asdata-node list, based onDataNodeStorage.FILTERSET_FIELDSandFILTER_VALUE_NORMALIZERS.mainsequence data-node detailfetches one storage throughDataNodeStorage.get()and renders its configuration in the terminal.mainsequence data-node refresh-search-indexcalls the SDK instance methodDataNodeStorage.refresh_table_search_index()for one storage and prints the backend response in the terminal.mainsequence data-node can_viewlists users returned by the SDKShareableObjectMixin.can_view()path forDataNodeStorage.mainsequence data-node can_editlists users returned by the SDKShareableObjectMixin.can_edit()path forDataNodeStorage.mainsequence data-node add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate data-node user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence data-node add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate data-node team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence data-node deleteexecutes the SDK clientDataNodeStorage.delete()path and exposes the same delete flags as the client:full_delete_selected,full_delete_downstream_tables,delete_with_no_table, andoverride_protection.mainsequence data-node deletealways requires typed verification before the delete call is sent.mainsequence markets portfolios listlists markets portfolios through the SDK clientPortfolio.filter()path.mainsequence markets asset-translation-table listlists translation tables through the SDK clientAssetTranslationTable.filter()path.mainsequence markets asset-translation-table detailfetches one translation table throughAssetTranslationTable.get()and renders each rule as a readablematch => targetmapping in the terminal.mainsequence project images listlists project images using the SDK clientProjectImage.filter()path.- All list commands share the same
--filter KEY=VALUEand--show-filterspattern. Commands that already enforce scoping filters reject overriding those keys. mainsequence project images createonly accepts pushed commits forproject_repo_hash. If omitted, it lists commits from the current branch upstream (or remote refs as fallback), shows which commits already have image ids, and waits untilis_ready=trueby polling every 30 seconds for up to 5 minutes by default.mainsequence project jobs listlists project jobs through the SDK clientJob.filter()path.mainsequence project jobs listshows a human-readable schedule summary fromtask_schedule.mainsequence project data-node-updates listlists data node updates through the SDK clientProject.get_data_nodes_updates()path.mainsequence project can_viewlists users returned by the SDKShareableObjectMixin.users_can_view()path forProject.mainsequence project can_editlists users returned by the SDKShareableObjectMixin.users_can_edit()path forProject.mainsequence project add_to_view,add_to_edit,remove_from_view, andremove_from_editmutate project user sharing through the SDKShareableObjectMixinpaths and render the resulting permission state in the terminal.mainsequence project add_team_to_view,add_team_to_edit,remove_team_from_view, andremove_team_from_editmutate project team sharing through the SDKShareableObjectMixinteam-action paths.mainsequence project project_resource listlists project resources through the SDK clientProjectResource.filter()path and always appliesrepo_commit_shafrom the current upstream branch head.mainsequence project syncperforms the local uv/git sync flow and, after a successful push, calls the SDK clientProject.sync_project_after_commit()path for the resolved project id.mainsequence project jobs runs listlists job-run history through the SDK clientJobRun.filter(job__id=[job_id])path.mainsequence project jobs runs logsfetches logs through the SDK clientJobRun.get_logs()path, polls every 30 seconds by default while the job run isPENDINGorRUNNING, and stops after 10 minutes unless you override--max-wait-secondsor disable it with--max-wait-seconds 0.mainsequence project jobs runtriggers a manual run through the SDK clientJob.run_job()path.mainsequence project jobs createcreates jobs through the SDK clientJob.create()path, requires a project image, expectsexecution_pathrelative to the content root, for examplescripts/test.py, builds interval or crontab schedules interactively when requested, and defaults compute settings tocpu_request=0.25,memory_request=0.5,spot=false,max_runtime_seconds=86400when omitted.