{"id":30623791,"url":"https://github.com/cjdoris/selfcontainedscripts.jl","last_synced_at":"2026-02-09T21:36:48.043Z","repository":{"id":310406852,"uuid":"1039729171","full_name":"cjdoris/SelfContainedScripts.jl","owner":"cjdoris","description":"Julia scripts with dependencies included","archived":false,"fork":false,"pushed_at":"2025-08-18T20:18:48.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-30T16:44:39.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjdoris.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,"zenodo":null}},"created_at":"2025-08-17T21:30:02.000Z","updated_at":"2025-08-18T20:18:51.000Z","dependencies_parsed_at":"2025-08-18T22:11:19.873Z","dependency_job_id":null,"html_url":"https://github.com/cjdoris/SelfContainedScripts.jl","commit_stats":null,"previous_names":["cjdoris/selfcontainedscripts","cjdoris/selfcontainedscripts.jl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cjdoris/SelfContainedScripts.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdoris%2FSelfContainedScripts.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdoris%2FSelfContainedScripts.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdoris%2FSelfContainedScripts.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdoris%2FSelfContainedScripts.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjdoris","download_url":"https://codeload.github.com/cjdoris/SelfContainedScripts.jl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjdoris%2FSelfContainedScripts.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29281976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T19:05:41.198Z","status":"ssl_error","status_checked_at":"2026-02-09T19:05:37.449Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2025-08-30T16:44:39.258Z","updated_at":"2026-02-09T21:36:47.976Z","avatar_url":"https://github.com/cjdoris.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SelfContainedScripts.jl\n\nSelfContainedScripts lets you write self-contained Julia scripts that declare their dependencies inline using [PEP 723–style metadata blocks](https://packaging.python.org/en/latest/specifications/inline-script-metadata/).\n\n## Installation\n\nWe recommend you (and anyone who wants to run your scripts) install SelfContainedScripts\nin their default global environment:\n```bash\njulia -e 'using Pkg; Pkg.add(url=\"https://github.com/cjdoris/SelfContainedScripts.jl.git\");'\n```\n\nOr equivalently using the Julia Pkg REPL:\n```\npkg\u003e add https://github.com/cjdoris/SelfContainedScripts.jl.git\n```\n\n## Example script\n\nHere is a working self-contained Julia script, copied from `examples/example.jl`:\n\n```julia\n# /// project\n# name = \"example\"\n# \n# [deps]\n# Example = \"7876af07-990d-54b4-ab0e-23690620f79a\"\n# ///\nusing SelfContainedScripts\nSelfContainedScripts.activate()\n\nusing Example\n@show Example.hello(\"Alice\")\n```\n\nProvided you have installed SelfContainedScripts into your default global environment,\nthis can be simply run like this:\n```bash\njulia example.jl\n```\n\n## Example workflow\n\nLet's reproduce the above example script.\n\nFirst, open Julia and run the following:\n```julia\nusing SelfContainedScripts\nSelfContainedScripts.init(\"example.jl\")\n```\n\nThis will create a stub file with this content:\n```julia\n# /// project\n# name = \"example\"\n# ///\nusing SelfContainedScripts\nSelfContainedScripts.activate()\n\n# your code here\n```\n\nAs well as creating `example.jl`, the `init()` call above created and activated an\nordinary Julia project at `~/.julia/environments/self-contained-scripts/example`. Now\nwe can modify the project using ordinary `Pkg` functions and then use `sync()` to update\nthe `project` block in the script.\n```julia\nusing Pkg\nPkg.add(\"Example\")\nSelfContainedScripts.sync()\n```\n\nNow the script contains the dependency we just added:\n```julia\n# /// project\n# name = \"example\"\n#\n# [deps]\n# Example = \"7876af07-990d-54b4-ab0e-23690620f79a\"\n# ///\nusing SelfContainedScripts\nSelfContainedScripts.activate()\n\n# your code here\n```\n\nNow edit the script to add its main functionality:\n```julia\n# /// project\n# name = \"example\"\n# \n# [deps]\n# Example = \"7876af07-990d-54b4-ab0e-23690620f79a\"\n# ///\nusing SelfContainedScripts\nSelfContainedScripts.activate()\n\nusing Example\n@show Example.hello(\"Alice\")\n```\n\nAnd you're done! You can run it directly like so:\n\n```bash\njulia example.jl\n```\n\nFinally, you can share this script with others to run themselves. All they need to do\nis install SelfContainedScripts.jl themselves in their global environment.\n\nIf you come back later to update the script and need to change the dependencies, it's\nas simple as this:\n```julia\nusing SelfContainedScripts, Pkg\n\n# Activate the project for the script.\nSelfContainedScripts.activate(\"example.jl\")\n\n# Modify the project as needed.\nPkg.add(...)\n\n# Sync the updated Project.toml into the script.\nSelfContainedScripts.sync()\n```\n\n## Existing scripts\n\nIf you have an existing Julia project containing a script you want to \"upgrade\" to be\nself-contained you can simply call\n\n```julia\nusing SelfContainedScripts, Pkg\nPkg.activate(\"your-project\")\nSelfContainedScripts.sync(\"your-script.jl\")\n```\n\nwhich will copy the current Project.toml into the given script.\n\n## API\nWe have these functions:\n- `init(script=nothing; name=nothing, activate=true, resolve=true)` creates or updates a\n  script with a project block and activation code. Activates the environment unless\n  activate=fasle.\n- `activate(script=nothing; resolve=true)` creates or updates a project from the\n  embedded project block in the script, activates and resolves it.\n- `sync(script=nothing)` copy the currently active Project.toml into the script.\n\nThe automatically created Julia project is at `~/.julia/environments/self-contained-scripts/\u003cname\u003e`\nwhere `\u003cname\u003e` is as given in the project block, or is derived from the filename if not\ngiven.\n\nBy default these functions work on `script=PROGRAM_FILE` if it is set. The `script` arg\nis remembered and reused in future calls if not given, so `init(\"foo.jl\"); sync()` is\nequivalent to `init(\"foo.jl\"); sync(\"foo.jl\")`.\n\nSee the docstrings for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjdoris%2Fselfcontainedscripts.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjdoris%2Fselfcontainedscripts.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjdoris%2Fselfcontainedscripts.jl/lists"}