### Start a local server with authentication via environment variable Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/auth.html Starts the server with authentication by setting the `IXMP4_SERVER__SECRET_HS256` environment variable. The secret value replaces `changeme`. ```bash IXMP4_SERVER__SECRET_HS256=changeme ixmp4 server start ``` -------------------------------- ### Start the ixmp4 web API Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/server/modules.html Use this command to start the ixmp4 ASGI server. You can optionally specify the host and port. ```bash ixmp4 server start [--host 127.0.0.1] [--port 9000] ``` -------------------------------- ### Start a local server with authentication via ServerSettings Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/auth.html Sets up the server with authentication by passing `ServerSettings(secret_hs256="changeme")` to `Ixmp4Server`. Then use `server.asgi_app` to start the server. The secret is used for cryptographic verification and never sent during communication. ```python from ixmp4.server import Ixmp4Server from ixmp4.conf.settings import ServerSettings server = Ixmp4Server(ServerSettings(secret_hs256="changeme")) # ... use server.asgi_app to start a server ``` -------------------------------- ### Install ixmp4 from source with Poetry Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/installation.rst.txt Clones the ixmp4 repository from GitHub and installs it from source using Poetry. The optional --with flag installs additional dependency groups (dev, docs, server). ```bash git clone git@github.com:iiasa/ixmp4.git cd ixmp4/ poetry install [--with dev,docs,server] ``` -------------------------------- ### Start PostgreSQL with docker-compose Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/tests.html Start the PostgreSQL database container defined in the tests/docker-compose.yml file. The database must be running before running the tests. ```bash cd tests/ docker-compose up ``` -------------------------------- ### ixmp4 DocsDescriptor __get__ example Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/docs.html Retrieves the documentation string for a region. If the entry does not exist, the DocsNotFound exception is caught and None is returned. ```python region.docs #> "Region documentation string. ``` -------------------------------- ### Install ixmp4 with pip Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/installation.rst.txt Installs the ixmp4 package from the Python Package Index using pip. ```bash pip install ixmp4 ``` -------------------------------- ### Get a run with platform.runs.get() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/run.html Retrieves a run by model, scenario, and optional version. If version is None, gets the default version. Raises RunNotFound if the run does not exist. ```python default_run = platform.runs.get("Model", "Scenario") specific_run = platform.runs.get("Model", "Scenario", version=2) ``` -------------------------------- ### ixmp4 DocsDescriptor __set__ example Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/docs.html Sets a documentation string for a model, retrieves it, and deletes it by setting to None. The output shows the updated/retrieved string and the 'Entry deleted.' confirmation. ```python model.docs = "Model documentation string." model.docs #> "Model documentation string. scenario.docs = None #> Entry deleted. ``` -------------------------------- ### Example .env file for ixmp4 settings Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/configuration.html A sample .env file that configures the settings object. It sets the mode, storage directory, manager URL, and various server and client settings. The file uses the IXMP4_ prefix and nested delimiters (__) for server and client sections. ```dotenv IXMP4_MODE=development IXMP4_STORAGE_DIRECTORY=~/.local/share/ixmp4/ IXMP4_MANAGER_URL=https://api.manager.ece.iiasa.ac.at/v1/ IXMP4_CHECK_ALEMBIC_VERSION=true # Server Settings IXMP4_SERVER__MANAGER_URL=https://api.manager.ece.iiasa.ac.at/v1/ IXMP4_SERVER__TOML_PLATFORMS=/custom/path/to/platforms.toml IXMP4_SERVER__SECRET_HS256=None IXMP4_SERVER__MAX_PAGE_SIZE=10000 IXMP4_SERVER__DEFAULT_PAGE_SIZE=5000 IXMP4_SERVER__LOG_EXCEPTIONS=always # Client Settings IXMP4_CLIENT__DEFAULT_UPLOAD_CHUNK_SIZE=10000 IXMP4_CLIENT__CONCURRENCY=2 IXMP4_CLIENT__RETRIES=3 IXMP4_CLIENT__TIMEOUT=30 IXMP4_CLIENT__SECRET_HS256=None ``` -------------------------------- ### Connect a client to an authenticated local server Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/auth.html Configure a client to connect to a local server using the `secret_hs256` in `ClientSettings`. The request URL and secret must match the server. Anyone with the secret gets superuser access; without it, an 'unauthorized' response is received. ```python import ixmp4 from ixmp4.conf.settings import ClientSettings from ixmp4.transport import HttpxTransport transport = HttpxTransport.from_url( "http://localhost:9000/v1/test/", ClientSettings(secret_hs256="changeme"), ) platform = ixmp4.Platform(transport) ``` -------------------------------- ### Define versioned table and attach PostgresVersionTriggers Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/locks-and-versioning.html Shows how to define a versioned table pair and attach PostgresVersionTriggers. The Example model has a unique constraint on name, while ExampleVersion omits constraints. The triggers are created on the provided tables and will be emitted when BaseModel.metadata.create_all() is called. ```python from sqlalchemy import orm from toolkit.db.types import String from ixmp4.data import versions from ixmp4.data.base.db import BaseModel class Example(BaseModel): # ... name: String = orm.mapped_column(unique=True) class ExampleVersion(versions.BaseVersionModel): # ... name: String # omit any constraints version_triggers = versions.PostgresVersionTriggers( Example.__table__, ExampletVersion.__table__ ) ``` -------------------------------- ### Tabulate run meta indicators with PlatformRunMetaFacade.tabulate() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/meta.html Query meta indicators by criteria. The example filters by run model name and returns a DataFrame with columns key, value, model, scenario, version. ```python df = platform.meta.tabulate( run={ "default_only": False, "model": {"name": "Model"}, } ) #> key value model scenario version # 0 indicator 1.23 Model Scenario 1 ``` -------------------------------- ### Provide Backend or DirectTransport directly Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/platform.html Provides a Backend or Transport class directly to the Platform constructor. The example shows both a Backend instance and a DirectTransport created from a DSN. ```python from ixmp4.transport import DirectTransport from ixmp4.data.backend import Backend platform = ixmp4.Platform(Backend(...)) # or platform = ixmp4.Platform(DirectTransport.from_dsn(...)) ``` -------------------------------- ### Create a model with platform.models.create() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/model.html Creates a new model with the given name. Raises ModelNotUnique if a model with that name already exists. The example shows the typical return value. ```python platform.models.create("Model") #> ``` -------------------------------- ### Alembic migration to create PostgresVersionTriggers Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/locks-and-versioning.html Alembic migration example for manually creating or updating version triggers. It checks the dialect is postgresql, autoloads the transaction, version, and data tables, then creates the trigger entities. The downgrade drops them. This is required because triggers do not support alembic autogeneration. ```python def upgrade(): conn = op.get_bind() dialect_name = conn.dialect.name metadata = sa.MetaData() if dialect_name == "postgresql": transaction_table = sa.Table( "transaction", metadata, autoload_with=conn ) version_table = sa.Table( "example", metadata, autoload_with=conn ) data_table = sa.Table( "example_version", metadata, autoload_with=conn ) triggers = PostgresVersionTriggers( data_table, version_table, transaction_table ) triggers.create_entities(conn) def downgrade(): # ... if dialect_name == "postgresql": # ... triggers.drop_entities(conn) ``` -------------------------------- ### Initialize a local SQLite database Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/setup.rst.txt Create a new local SQLite database instance using the CLI. ```bash ixmp4 platforms add ``` -------------------------------- ### Instantiate a Platform by name Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/platform.html Creates a Platform instance by name. The name is first searched in the local 'platforms.toml' file and then in the ECE Manager API. ```python import ixmp4 platform = ixmp4.Platform("") ``` -------------------------------- ### ixmp4 --help and subcommand help Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/cli.html Use the --help option to find out more about any command. ```bash ixmp4 --help ixmp4 platforms --help ixmp4 alembic --help ixmp4 test --help ixmp4 server --help ``` -------------------------------- ### get Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/optimization.html Retrieves an equation by its name and run_id. ```APIDOC ## get ### Description Retrieves an equation by its name and run_id. ### Method GET ### Endpoint /optimization/equations/{run_id}/{name} ### Parameters #### Path Parameters - **run_id** (int) - Required - The unique name of the equation. - **name** (str) - Required - The unique name of the equation. ### Request Example No request body required. ### Response #### Success Response (200) - **id** (int) - Integer id of the equation. - **name** (str) - Name of the equation. - **data** (dict[str, list[float] | list[int] | list[str]]) - Data of the equation. - **indexset_names** (list[str] | None) - Names of index sets associated with the equation. - **column_names** (list[str] | None) - Column names of the equation. - **run__id** (int) - Run id associated with the equation. #### Response Example { "id": 1, "name": "string", "data": {}, "indexset_names": ["string"], "column_names": ["string"], "run__id": 1 } ### Error Handling - **EquationNotFound** - If the equation with name does not exist. - **Unauthorized** - If the current user is not authorized to perform this action. ``` -------------------------------- ### get_by_name Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/optimization.html Gets a variable by name for this run. ```APIDOC ## get_by_name(name: str) -> Variable ### Description Gets a variable by name for this run. ### Method get_by_name ### Parameters - **name** (str) - Required - Name of the variable. ### Request Example ```python run.optimization.variables.get_by_name("Production") ``` ### Response - **Variable** - The variable with the given name. ``` -------------------------------- ### Instantiate service with DirectTransport and HttpxTransport Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/services.html Instantiates ExampleService with both DirectTransport and HttpxTransport, then calls do_something() on each. Both calls raise ExampleError, demonstrating that the same procedure works via direct and HTTP transports. Note the typo 'DirectTranport' in the source. ```python from ixmp4.transport import DirectTransport, HttpxTransport from .example import ExampleService direct = DirectTranport.from_dsn("sqlite://...") direct_svc = ExampleService(direct) http = HttpxTransport.from_url/from_asgi(...) http_svc = ExampleService(http) direct_svc.do_something() #> ExampleError http_svc.do_something() #> ExampleError ``` -------------------------------- ### List available platforms Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/usage/cli.rst.txt Lists all platforms available from the local toml file and the configured manager API. ```bash ixmp4 platforms list ``` -------------------------------- ### GET /scenarios Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Lists scenarios by specified criteria. ```APIDOC ## GET /scenarios ### Description Lists scenarios by specified criteria. ### Method GET ### Endpoint /scenarios ### Parameters #### Query Parameters - **name** (string) - Optional - Filter by scenario name. - **id** (integer) - Optional - Filter by scenario id. ### Response #### Success Response (200) - **items** (array) - List of scenarios. - **id** (integer) - The unique identifier. - **name** (string) - The name. - **created_at** (datetime) - The creation timestamp. - **created_by** (string) - The creator. #### Response Example { "items": [ { "id": 1, "name": "scenario_name", "created_at": "2023-01-01T00:00:00", "created_by": "user" } ] } ``` -------------------------------- ### GET /scenarios/{name} Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Retrieves a scenario by its unique name. ```APIDOC ## GET /scenarios/{name} ### Description Retrieves a scenario by its unique name. ### Method GET ### Endpoint /scenarios/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The unique name of the scenario. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the scenario. - **name** (string) - The name of the scenario. - **created_at** (datetime) - The creation timestamp. - **created_by** (string) - The user who created the scenario. #### Response Example { "id": 1, "name": "scenario_name", "created_at": "2023-01-01T00:00:00", "created_by": "user" } ### Error Handling - **ScenarioNotFound** - If the scenario with the given name does not exist. ``` -------------------------------- ### GET /scenarios/{id} Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Retrieves a scenario by its unique integer id. ```APIDOC ## GET /scenarios/{id} ### Description Retrieves a scenario by its unique integer id. ### Method GET ### Endpoint /scenarios/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique integer id of the scenario. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the scenario. - **name** (string) - The name of the scenario. - **created_at** (datetime) - The creation timestamp. - **created_by** (string) - The user who created the scenario. #### Response Example { "id": 1, "name": "scenario_name", "created_at": "2023-01-01T00:00:00", "created_by": "user" } ### Error Handling - **ScenarioNotFound** - If the scenario with the given id does not exist. ``` -------------------------------- ### GET /scenarios/tabulate Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Tabulates scenarios by specified criteria, returning a pandas DataFrame. ```APIDOC ## GET /scenarios/tabulate ### Description Tabulates scenarios by specified criteria, returning a pandas DataFrame. ### Method GET ### Endpoint /scenarios/tabulate ### Parameters #### Query Parameters - **name** (string) - Optional - Filter by scenario name. - **id** (integer) - Optional - Filter by scenario id. ### Response #### Success Response (200) - **data** (array) - The tabulated data. - **columns** (array) - The column names. - **index** (array) - The index. #### Response Example { "data": [[1, "scenario_name"]], "columns": ["id", "name"], "index": [0] } ``` -------------------------------- ### Create a new SQLite database with migrations Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/database.html Run this command to create a new local SQLite database and automatically run migrations. The output shows the interactive prompt and the alembic migration logs. ```bash $ ixmp4 platforms add test No DSN supplied, assuming you want to add a local sqlite database... No file at the standard filesystem location for name 'test' exists. Do you want to create a new database? [y/N]: y Creating the database and running migrations... [INFO] 16:51:40 - alembic.runtime.migration: Context impl SQLiteImpl. [INFO] 16:51:40 - alembic.runtime.migration: Will assume non-transactional DDL. [INFO] 16:51:40 - alembic.runtime.migration: Running upgrade -> c71efc396d2b, Initial Migration ... ``` -------------------------------- ### check_root() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/transport.html Checks connectivity and compatibility with the remote server by sending a GET request to the root endpoint. ```APIDOC ## check_root() ### Description Verify connectivity and compatibility with the remote server. Sends a `GET /` request to the server's root endpoint, checks that the client and server ixmp4 versions match, and validates that the manager URL configured on the server matches the one used by the client (when `ManagerAuth` is in use). ### Method GET ### Endpoint / ### Response #### Success Response (200) - None #### Error Response - **ImproperlyConfigured** – If the manager URLs on the client and server disagree. ``` -------------------------------- ### GET /models Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Lists models by specified criteria. The endpoint accepts optional filter parameters and returns a list of models. ```APIDOC ## GET /models ### Description Lists models by specified criteria. ### Method GET ### Endpoint /models ### Parameters #### Query Parameters - **filters** (object) - Optional - Filter parameters as specified in ModelFilter. ### Response #### Success Response (200) - **items** (array) - List of models. - **id** (integer) - The unique identifier of the model. - **name** (string) - The name of the model. - **created_at** (datetime) - The creation timestamp. - **created_by** (string) - The user who created the model. #### Response Example { "items": [ { "id": 1, "name": "model_name", "created_at": "2023-01-01T00:00:00", "created_by": "user" } ] } ``` -------------------------------- ### ixmp4 platforms list Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/cli.html List all available platforms from the local toml file and the configured manager API. ```bash ixmp4 platforms list ``` -------------------------------- ### Add a local ixmp4 database with ixmp4 platforms add Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/setup.html Run in a console to initialize a new local database. By default, an SQLite database is created. ```console ixmp4 platforms add ``` -------------------------------- ### Get optimization table by name with run.optimization.tables.get_by_name Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/optimization.html Retrieves a table by name for this run. The output shows the returned Table object. ```python run.optimization.tables.get_by_name("CostTable") #> ``` -------------------------------- ### Authenticate with IIASA Infrastructure: ixmp4 login, platforms list, and Python Platform connection Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/usage/auth.rst.txt Use the CLI to log in with your ECE Management Service account, then list accessible platforms. From Python, connect to a platform by name once you have the necessary permissions. ```bash ixmp4 login ``` ```bash ixmp4 platforms list ``` ```python import ixmp4 platform = ixmp4.Platform("") ``` -------------------------------- ### Get meta indicators with RunMetaDescriptor.__get__() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/meta.html Retrieve the meta indicators for a run object. Returns a RunMetaDictFacade that behaves like a dictionary. ```python run.meta #> {"key": "value"} ``` -------------------------------- ### ixmp4 platforms add postgres Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/cli.html Register a postgresql database. ```bash ixmp4 platforms add postgres --dsn postgresql+psycopg://user:pw@host/db ``` -------------------------------- ### Unset run as default Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/run.html Unsets the run as the default version. The example shows the call and the resulting is_default property being False. ```python run.unset_as_default() run.is_default #> False ``` -------------------------------- ### Run PostgreSQL container Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/tests.html Run a PostgreSQL container with the given environment variables and port mapping. The database is started in detached mode. ```bash docker run -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test -p 5432:5432 -d postgres ``` -------------------------------- ### ixmp4 platforms add test (sqlite) Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/cli.html Create a local sqlite platform. If --dsn is not supplied, you will be prompted to create an sqlite database at a standardized location. ```bash ixmp4 platforms add test [--dsn sqlite://my/database/file.db] ``` -------------------------------- ### GET /models/{name} Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Retrieves a model by its unique name. The endpoint requires the name as a path parameter and returns the model details. ```APIDOC ## GET /models/{name} ### Description Retrieves a model by its unique name. ### Method GET ### Endpoint /models/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The unique name of the model. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the model. - **name** (string) - The name of the model. - **created_at** (datetime) - The creation timestamp. - **created_by** (string) - The user who created the model. #### Response Example { "id": 1, "name": "model_name", "created_at": "2023-01-01T00:00:00", "created_by": "user" } ### Error Handling - **ModelNotFound** - If the model with the given name does not exist. ``` -------------------------------- ### Get an equation by name with run.optimization.equations.get_by_name Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/optimization.html Retrieves an equation by name for the current run. The displayed output shows the returned `Equation` object. ```python run.optimization.equations.get_by_name("Balance") #> ``` -------------------------------- ### List scenarios with platform.scenarios.list() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/scenario.html Lists scenarios by specified criteria. Accepts filter parameters as specified in ScenarioFilter. Returns a list of scenarios. ```python platform.scenarios.list() #> [] ``` -------------------------------- ### ManagerPlatforms Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/usage/configuration.html Platform connection registry backed by the manager service API. Provides methods to list and get platforms from the manager service. ```APIDOC ## ManagerPlatforms ### Description Platform connection registry backed by the manager service API. ### Constructor ManagerPlatforms(manager_client: ManagerClient) ### Methods #### list_platforms Return all platforms visible from the manager service. Signature: list_platforms() -> list[Ixmp4Instance] #### get_platform Return one platform from the manager service registry by slug. Signature: get_platform(name: str) -> Ixmp4Instance Parameters: - **name** (str) - Required - Platform slug to search for. Raises: - **PlatformNotFound** - If the platform with name does not exist. ``` -------------------------------- ### Build Docker image with optional POETRY_OPTS Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/development/docker.rst.txt Build the Docker image from the root folder using the Dockerfile. The first command creates the default image tagged ixmp4:latest. The second optionally supplies POETRY_OPTS to include docs and dev dependencies, producing the ixmp4-docs:latest tag. ```bash docker build -t ixmp4:latest . ``` ```bash docker build --build-arg POETRY_OPTS="--with docs,dev" -t ixmp4-docs:latest . ``` -------------------------------- ### Get a scenario by name with platform.scenarios.get_by_name() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/scenario.html Retrieves a scenario by its unique name. Raises ScenarioNotFound if the scenario does not exist. Returns the retrieved scenario. ```python platform.scenarios.get_by_name("Scenario") #> ``` -------------------------------- ### Run tests with ixmp4 CLI Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/tests.html Run the test suite with the ixmp4 CLI. The optional flags enable backend and benchmark tests. ```bash ixmp4 test [--with-backend] [--with-benchmarks] ``` -------------------------------- ### List models with platform.models.list() Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/model.html Returns a list of models matching the optional filter criteria. The example shows a list with one model. ```python platform.models.list() #> [] ``` -------------------------------- ### List parameters with run.optimization.parameters.list Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/core/optimization.html Lists all parameters for the run. The output shows a list containing the existing Parameter object. ```python run.optimization.parameters.list() #> [] ``` -------------------------------- ### Build Docker image with POETRY_OPTS Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/development/docker.html Builds the Docker image with additional Poetry options, including docs and dev dependencies, and tags it as ixmp4-docs:latest. ```docker docker build --build-arg POETRY_OPTS="--with docs,dev" -t ixmp4-docs:latest . ``` -------------------------------- ### GET /models/{id} Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/data/common.html Retrieves a model by its unique integer id. The endpoint requires the id as a path parameter and returns the model details. ```APIDOC ## GET /models/{id} ### Description Retrieves a model by its unique integer id. ### Method GET ### Endpoint /models/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The integer id of the model. ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the model. - **name** (string) - The name of the model. - **created_at** (datetime) - The creation timestamp. - **created_by** (string) - The user who created the model. #### Response Example { "id": 1, "name": "model_name", "created_at": "2023-01-01T00:00:00", "created_by": "user" } ### Error Handling - **ModelNotFound** - If the model with the given id does not exist. ``` -------------------------------- ### Add a local sqlite platform Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/usage/cli.rst.txt Creates a local sqlite platform. If the --dsn flag is omitted, the user is prompted to create the database at a standardized location. ```bash ixmp4 platforms add test [--dsn sqlite://my/database/file.db] ``` -------------------------------- ### Enable local server authentication with secret_hs256 and connect via ClientSettings Source: https://docs.ece.iiasa.ac.at/projects/ixmp4/en/latest/_sources/usage/auth.rst.txt Enable authentication on a local server by setting the secret_hs256 configuration, either via ServerSettings or the IXMP4_SERVER__SECRET_HS256 environment variable. Clients must configure the same secret in ClientSettings to gain unrestricted access; anyone without it receives an "unauthorized" response. ```python from ixmp4.server import Ixmp4Server from ixmp4.conf.settings import ServerSettings server = Ixmp4Server(ServerSettings(secret_hs256="changeme")) # ... use server.asgi_app to start a server ``` ```bash IXMP4_SERVER__SECRET_HS256=changeme ixmp4 server start ``` ```python import ixmp4 from ixmp4.conf.settings import ClientSettings from ixmp4.transport import HttpxTransport transport = HttpxTransport.from_url( "http://localhost:9000/v1/test/", ClientSettings(secret_hs256="changeme"), ) platform = ixmp4.Platform(transport) ```