{"id":20837782,"url":"https://github.com/astrazeneca/qsuse","last_synced_at":"2025-07-24T02:31:24.850Z","repository":{"id":238723340,"uuid":"797289466","full_name":"AstraZeneca/qsuse","owner":"AstraZeneca","description":"R library that provides an import mechanism like python to import local source files. It is not meant to replace library(), or doublecolon:: prefixing","archived":false,"fork":false,"pushed_at":"2024-05-07T15:54:51.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T09:44:00.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","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/AstraZeneca.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":"2024-05-07T14:54:33.000Z","updated_at":"2024-05-07T16:35:29.000Z","dependencies_parsed_at":"2024-05-07T18:53:58.085Z","dependency_job_id":"19815915-24d8-484b-bffe-bd54e4f67142","html_url":"https://github.com/AstraZeneca/qsuse","commit_stats":null,"previous_names":["astrazeneca/qsuse"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AstraZeneca/qsuse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstraZeneca%2Fqsuse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstraZeneca%2Fqsuse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstraZeneca%2Fqsuse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstraZeneca%2Fqsuse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AstraZeneca","download_url":"https://codeload.github.com/AstraZeneca/qsuse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AstraZeneca%2Fqsuse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266785441,"owners_count":23983821,"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-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-11-18T01:08:34.226Z","updated_at":"2025-07-24T02:31:24.830Z","avatar_url":"https://github.com/AstraZeneca.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qsuse\n\nR library that provides an import mechanism like python to import local source files.\nIt is not meant to replace library(), or doublecolon:: prefixing. It is meant to guarantee\nthat a large codebase can achieve the following goals:\n\n- explicitly describe what a given .R file actually needs, by moving the import\n  process from the main file to each individual subfile.\n- import symbols (functions, global variables) into separate environments so\n  that there is no risk of collision between symbols with the same name in two\n  R files of the same project.\n- manage already imported modules so that no double execution occurs.\n\n# Usage\n\nImagine you have files organised as follows:\n```\nbasedir/module.R\nbasedir/module2.R\nbasedir/module2/hello.R\nbasedir/module3/submodule/whatever.R\nbasedir/app.R\n```\n\nYou use qsuse in e.g. `app.R` by first defining the search path\n\n```\nprepend_search_path(\"/path/to/basedir\")\n```\n\nYou can get this path via various methods, e.g. with here::here()\n\nThen, you can import module as\n\n```\nmodule \u003c- qsuse::use(\"module\")\n```\n\n\nFunctions and variables that are defined in module will be accessible as\n\n```\nmodule$myfunc()\n```\n\nNothing forces you to use the same name for the variable. This is allowed:\n\n```\nmod \u003c- qsuse::use(\"module\")\nmod$myfunc()\n```\n\nYou can also import a specific function with useonly()\n\n```\nmyfunc \u003c- qsuse::use(\"module\", \"myfunc\")\n```\n\nIf a module is too long, you can shorten it by using prefixes\n\n```\nsubmodule \u003c- qsuse::prefix(\"module3/submodule\")\nwhatever \u003c- qsuse::use(submodule(\"whatever\"))\n```\n\nNote that if you have a directory and a file named exactly as that directory, the content of the files will be imported too. For example,\n\n```\n# Imports the contents of module2.R\nmodule2 \u003c- qsuse::use(\"module2\")\n# Imports the content of hello.R (under the hood, also imports module2.R but you are not\n# seeing that module here)\nhello \u003c- qsuse::use(\"module2/hello\")\n```\n\nEach of the returned variables are separated environments. This namespaces each file and prevents accidental collisions.\n\n## Why not box?\n\nBox does not perform static symbol binding. The result is that lintr cannot\ndetect the added symbols during static analysis. We also have more control of\nwhat kind of environment is returned.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrazeneca%2Fqsuse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastrazeneca%2Fqsuse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastrazeneca%2Fqsuse/lists"}