{"id":24658566,"url":"https://github.com/pyroll-project/pyroll-from-dict","last_synced_at":"2026-02-27T18:11:35.031Z","repository":{"id":187687744,"uuid":"676857864","full_name":"pyroll-project/pyroll-from-dict","owner":"pyroll-project","description":"Extension for PyRolL providing function to create PyRolL data structure from dictionaries.","archived":false,"fork":false,"pushed_at":"2024-11-11T08:49:19.000Z","size":187,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-16T23:34:18.745Z","etag":null,"topics":["groove-rolling","materials","metal-forming","pyroll","python","rolling","simulation"],"latest_commit_sha":null,"homepage":"https://pyroll.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyroll-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-08-10T07:08:39.000Z","updated_at":"2024-11-11T08:49:23.000Z","dependencies_parsed_at":"2024-11-11T09:26:42.533Z","dependency_job_id":"28ffa3ba-7355-4500-abee-ae66cae70950","html_url":"https://github.com/pyroll-project/pyroll-from-dict","commit_stats":null,"previous_names":["pyroll-project/pyroll-from-dict"],"tags_count":0,"template":false,"template_full_name":"pyroll-project/pyroll-plugin-template","purl":"pkg:github/pyroll-project/pyroll-from-dict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyroll-project%2Fpyroll-from-dict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyroll-project%2Fpyroll-from-dict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyroll-project%2Fpyroll-from-dict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyroll-project%2Fpyroll-from-dict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyroll-project","download_url":"https://codeload.github.com/pyroll-project/pyroll-from-dict/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyroll-project%2Fpyroll-from-dict/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278840378,"owners_count":26055113,"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-10-07T02:00:06.786Z","response_time":59,"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":["groove-rolling","materials","metal-forming","pyroll","python","rolling","simulation"],"created_at":"2025-01-26T01:38:07.092Z","updated_at":"2025-10-07T20:30:57.462Z","avatar_url":"https://github.com/pyroll-project.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyRoll From Dict Extension\n\nThis extension is meant to create PyRolL objects from plain `dict` structures.\n\n## Import PyRolL Objects\n\nFor example to create a `RollPass` instance with the related `Roll` and `Groove` objects use the following:\n\n```python\nfrom pyroll.from_dict import from_dict\n\nroll_pass = from_dict({\n    '__ctor__': 'RollPass',\n    'gap': 0.001,\n    'roll': {\n        '__ctor__': 'Roll',\n        'nominal_radius': 0.1,\n        'rotational_frequency': 1,\n        'groove': {\n            '__ctor__': 'CircularOvalGroove',\n            'r1': 0.002,\n            'r2': 0.02,\n            'depth': 0.002\n        }\n    }\n}, {})\n```\n\nThe class resp. factory function can be given with the `__ctor__` key.\nBy default, class and object names therein are resolved in the `pyroll.core` namespace.\nThe key can be changed with the `pyroll.from_dict.Config.FACTORY_KEY` config parameter.\nThe second argument to `from_dict` is a dict of namespaces to use additionally for resolving constructor names.\nThe key must be than used as prefix to the object name in dot notation like in the following example (although you may\nresolve `RollPass` without prefix, because it is in the `pyroll.core` namespace).\n\n```python\nfrom pyroll.from_dict import from_dict\n\nroll_pass = from_dict({\n    '__ctor__': 'pr.RollPass',\n    ...\n}, {\"pr\": \"pyroll.core\"})\n```\n\n## Import Whole Input Sets\n\nThe second main function of this package is `dict_input`.\nIt reads from a larger dict structure containing an incoming profile, a pass sequence and namespace definitions.\nIt returns a tuple of in profile and pass sequence.\n\n```python\nfrom pyroll.from_dict import dict_input\n\nin_profile, sequence = dict_input({\n    'namespaces': {'pr': 'pyroll.core', 'np': 'numpy'},\n    'in_profile': {\n        '__ctor__': 'Profile.round',\n        'diameter': 0.01,\n        'strain': 0,\n        'temperature': 1273.15,\n        'density': 'func: 7.85 / (1 + 3 * 3.5e-3 * (self.temperature - 273.15))'\n    },\n    'unit': [\n        {\n            '__ctor__': 'RollPass',\n            'gap': 0.001,\n            'roll': {\n                '__ctor__': 'Roll',\n                'nominal_radius': 0.1,\n                'rotational_frequency': 1,\n                'groove': {\n                    '__ctor__': 'CircularOvalGroove',\n                    'r1': 0.002,\n                    'r2': 0.02,\n                    'depth': 0.002\n                }\n            }\n        }\n    ]\n})\n```\n\nThe namespaces are used in resolving all specified objects.\nThe keys for namespaces, in profile and unit/sequence can be configured\nwith `pyroll.from_dict.Config.NAMESPACES_KEY`, `pyroll.from_dict.Config.IN_PROFILE_KEY`\nand `pyroll.from_dict.Config.UNIT_KEY`.\nThe value of the unit can be a single unit definition or a list.\nThe list will be automatically converted into an instance of `PassSequence`.\n\nAs you can see in the `density` field of the in profile, you may give explicit hook functions by providing a string of\nthe structure `\"func: \u003csome expression\u003e` similar to a lambda function.\nWhitespace in this string is ignored.\nThe only argument to this function is `self`, the reference to the respective instance.\nThe function expression will be compiled and executed using `eval()`.\nYou may use all modules defined in the namespaces from within the function (so for example you may use `np` for `numpy`\nhere.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyroll-project%2Fpyroll-from-dict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyroll-project%2Fpyroll-from-dict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyroll-project%2Fpyroll-from-dict/lists"}