{"id":17062611,"url":"https://github.com/wardbrian/experimental-cmdstan-parsing","last_synced_at":"2025-08-08T01:05:16.341Z","repository":{"id":110280396,"uuid":"439393219","full_name":"WardBrian/experimental-cmdstan-parsing","owner":"WardBrian","description":"A working repository for trying Pydantic with the current output of the CmdStan interface","archived":true,"fork":false,"pushed_at":"2023-04-17T16:40:04.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T08:42:02.346Z","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/WardBrian.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":"2021-12-17T16:23:32.000Z","updated_at":"2025-02-10T15:11:07.000Z","dependencies_parsed_at":"2025-03-23T08:41:18.045Z","dependency_job_id":"2c6b66c6-7eed-4996-9048-f7b192af6dad","html_url":"https://github.com/WardBrian/experimental-cmdstan-parsing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WardBrian/experimental-cmdstan-parsing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardBrian%2Fexperimental-cmdstan-parsing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardBrian%2Fexperimental-cmdstan-parsing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardBrian%2Fexperimental-cmdstan-parsing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardBrian%2Fexperimental-cmdstan-parsing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WardBrian","download_url":"https://codeload.github.com/WardBrian/experimental-cmdstan-parsing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WardBrian%2Fexperimental-cmdstan-parsing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269348345,"owners_count":24401945,"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","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-14T10:50:20.543Z","updated_at":"2025-08-08T01:05:16.306Z","avatar_url":"https://github.com/WardBrian.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CmdStan CSV Parsing Testing\n\nThis is exploring the potential of using [Pydantic](https://pydantic-docs.helpmanual.io/usage/models/) to\nparse the header comments of CSV files. Pydantic primarily works with loading and validating JSON, so this also serves\nas a look to the future.\n\n## Overview\n\n- `parse.py` contains a simple recursive function that walks the CSV header and returns a nested dictionary of the\n  information. It makes no assumptions about what it might find in the file, meaning it doesn't look for any particular\n  string or values. It stops at the first line which does not start with a `#`, which for CmdStan is the column header line.\n\n  It's good to note that this means it *isn't* parsing draws or adaptation information.\n- `cmdstanconfig.py` and the other files contain Pydantic model definitions. They're based on the information from\n  the [CmdStan guide](https://mc-stan.org/docs/2_28/cmdstan-guide/command-line-interface-overview.html).\n\n- `examples/` contains the first 50 lines for a few different output.csv files\n- `main.py` builds up an object from one of the examples and prints it. It also produces `cmdstan.schema.json`.\n  The CSV is given structure using the code in `parse.py`, and then turned into a fully validated python object\n  by the Pydantic library. The key idea of this approach is that both parts of this are very simple: parsing doesn't\n  validate anything, and the Pydantic code exactly mirrors the spec from CmdStan.\n\n  Run this with `python main.py`\n\nThe hope is that this will be a valuable area to explore for CmdStanPy, especially if we believe this configuration information will be available in JSON in the future.\n\n\n## Future hopes\n\n- User provided arguments are actually a subset of this data. It's concievable we could use the same object to both handle the\n  args for a method and the outputs of that method with a ton of code sharing there, but some things would be messy.\n- The errors provided by Pydantic are pretty good, but because we separate parsing and validation there is no line number for the\n  original file. I personally think this is fine, but it would be good if we could get it back\n- How this gets wired up and used in CmdStanPy is still yet to be seen.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwardbrian%2Fexperimental-cmdstan-parsing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwardbrian%2Fexperimental-cmdstan-parsing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwardbrian%2Fexperimental-cmdstan-parsing/lists"}