{"id":21006234,"url":"https://github.com/derlin/qmasm-docker","last_synced_at":"2026-04-28T13:03:09.356Z","repository":{"id":151664441,"uuid":"148821418","full_name":"derlin/qmasm-docker","owner":"derlin","description":"QMASM available as a REST service running inside a docker container","archived":false,"fork":false,"pushed_at":"2018-10-16T16:02:33.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T10:31:01.111Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derlin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-14T17:31:05.000Z","updated_at":"2024-06-22T02:46:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f6c2c74-85be-4a8b-b3a4-1c5e12adc428","html_url":"https://github.com/derlin/qmasm-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derlin%2Fqmasm-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derlin%2Fqmasm-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derlin%2Fqmasm-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derlin%2Fqmasm-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derlin","download_url":"https://codeload.github.com/derlin/qmasm-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428421,"owners_count":20289315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T08:50:01.318Z","updated_at":"2025-12-29T13:27:16.239Z","avatar_url":"https://github.com/derlin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QMASM Docker\n\nThis repo hosts a dockerised version of the excellent [QMASM](https://github.com/lanl/qmasm) Quantum Macro Assembler from Scott Pakin.\n\n## Setup and run\n\nGiven that docker is installed and that you are at the root of the cloned repo:\n\n```bash\n# build the image\ndocker build -t qmasm-rest --rm .\n# run the image, listening to port 80 on the host\ndocker run -d -p 80:80 --name qmasm-rest qmasm-rest\n```\n\nOr using the scripts:\n```bash\n./build_image.sh\n./run_image.sh\n```\n\n## Usage\n\nThe server has a unique endpoint. It accepts POST requests with a `.qmasm` file content in the body. By default, the server will run `qmasm` with the following arguments:\n\n```bash\nqmasm --format=\"qbsolv\" --values=\"ints\" \"\u003cQMASM BODY\u003e\"\n```\n\nTo pass other arguments to QMASM, simply specify them as _query parameters_. \n\n__Important__: \n\n* options with no values (for example `--run`) should have a trailing `=` (for example `run=`);\n* omit the slashes before the options, they will be added automatically.\n\n### Examples using CURL\n\n```bash\n# run \"qmasm --help\"\ncurl \"http://localhost?help\"\n\n# run \"qmasm -q --run somefile.qmasm\"\ncurl -H 'Content-Type: text/plain' \\\n     --data-binary \"@somefile.qmasm\" \\\n     \"http://localhost/?run=\u0026q=\" \u003e somefile.qmasm.out\n\n# run \"qmasm --format=qubist --run somefile.qmasm\"\ncurl -H 'Content-Type: text/plain' \\\n     --data-binary \"@somefile.qmasm\" \\\n     \"http://localhost/?format=qubist\u0026run=\" \u003e somefile.qmasm.out\n\n# translate the qmasm file into a qbsolv (.qubo) format \"qmasm --format=qbsolv\"\ncurl -H 'Content-Type: text/plain' \\\n      --data-binary \"@somefile.qmasm\" \\\n      \"http://localhost/?format=qbsolv\" \u003e somefile.qubo\n```\n\n### Examples using Python3\n\nHere, we use the [requests](http://docs.python-requests.org/en/master/) library to make HTTP calls.\n\n```python3\n\ndef call_qmasm(qmasm_input: str, host='http://localhost', **params) -\u003e str:\n    \"\"\"\n    run qmasm in \"qbsolv\" mode.\n    :param qmasm_input: the input for qmasm\n    :param params: options to pass to qmasm\n    :return: the output of qmasm\n    \"\"\"\n    default_params = dict(run='')\n    default_params.update(params)\n    resp = requests.post(host, qmasm_input, params=default_params)\n    output = resp.text\n    if resp.status_code != 200:\n        raise Exception(\"qmasm failed: %s\" % output)\n    return output\n\nwith open('somefile.qmasm') as f:\n    qmasm_input = f.read()\n\n# run qmasm --format=qbsolv --values=int --run \"somefile.qmasm\"\noutput = call_qmasm(qmasm_input)\n\n# run qmasm --format=qubist --values=int -q --run \"somefile.qmasm\"\n# note the q='', this is how you encode options with no values\noutput = call_qmasm(qmasm_input, format=qubist, q='')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderlin%2Fqmasm-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderlin%2Fqmasm-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderlin%2Fqmasm-docker/lists"}