{"id":14156548,"url":"https://github.com/random-python/nspawn","last_synced_at":"2026-04-22T06:11:20.345Z","repository":{"id":57447095,"uuid":"184904641","full_name":"random-python/nspawn","owner":"random-python","description":"Containers with systemd-nspawn","archived":false,"fork":false,"pushed_at":"2025-03-12T18:24:26.000Z","size":125,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-28T19:29:21.615Z","etag":null,"topics":["container-management","nspawn","python","systemd","systemd-nspawn"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/nspawn","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/random-python.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}},"created_at":"2019-05-04T14:23:01.000Z","updated_at":"2025-03-12T18:24:29.000Z","dependencies_parsed_at":"2024-01-29T06:01:13.096Z","dependency_job_id":"2b98d048-3de8-4845-ba97-1f343562f101","html_url":"https://github.com/random-python/nspawn","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"9dd3926f1d1a3a0648f6ec14199cbf4069af1c98"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/random-python/nspawn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-python%2Fnspawn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-python%2Fnspawn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-python%2Fnspawn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-python%2Fnspawn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/random-python","download_url":"https://codeload.github.com/random-python/nspawn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-python%2Fnspawn/sbom","scorecard":{"id":761372,"data":{"date":"2025-08-11","repo":{"name":"github.com/random-python/nspawn","commit":"305268430526a17ce8e3e96e5f2f501cecdb6d92"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: pipCommand not pinned by hash: tool/provision_env.sh:16","Warn: pipCommand not pinned by hash: tool/provision_env.sh:18","Warn: pipCommand not pinned by hash: tool/provision_env.sh:19","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: licence:0","Info: FSF or OSI recognized license: Apache License 2.0: licence:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T23:35:01.985Z","repository_id":57447095,"created_at":"2025-08-22T23:35:01.985Z","updated_at":"2025-08-22T23:35:01.985Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32123672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"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":["container-management","nspawn","python","systemd","systemd-nspawn"],"created_at":"2024-08-17T08:06:16.757Z","updated_at":"2026-04-22T06:11:20.331Z","avatar_url":"https://github.com/random-python.png","language":"Python","readme":"\n## nspawn\n\n[![Package Version][pypi_icon]][pypi_link]\n[![Python Versions][python_icon]][python_link]\n\nContainers with [`systemd-nspawn`](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html)\n\nFeatures:\n* differential image [overlays](https://en.wikipedia.org/wiki/OverlayFS)\n* supports multiple inheritance for images\n* provides [dsl](https://en.wikipedia.org/wiki/Domain-specific_language)\n  for image `build` and machine `setup`\n* machine is\n  [completely represented](https://github.com/random-python/nspawn/tree/master/src/main/nspawn/template)\n  by generated\n  [machine.service unit file](https://www.freedesktop.org/software/systemd/man/systemd.unit.html)\n\n### Install\n\nTo install python package:\n\n```\nsudo pip install nspawn\n```\n\n### Build Script\n\nTo build an image, provide and invoke executable `build.py` script, for example:\n* alpine: https://github.com/random-python/nspawn/blob/master/demo/alpine/base/build.py\n* archux: https://github.com/random-python/nspawn/blob/master/demo/archux/base/build.py\n* ubuntu: https://github.com/random-python/nspawn/blob/master/demo/ubuntu/base/build.py\n\nFor available build options run `./build.py --help`\n\n### Setup Script\n\nTo setup a machine, provide and invoke executable `setup.py` script, for example:\n* alpine: https://github.com/random-python/nspawn/blob/master/demo/alpine/base/setup.py\n* archux: https://github.com/random-python/nspawn/blob/master/demo/archux/base/setup.py\n* ubuntu: https://github.com/random-python/nspawn/blob/master/demo/ubuntu/base/setup.py\n\nFor available setup options run `./setup.py --help`\n\n### Machine Service\n\nTo review provisioned, generated and running machine service, run:\n```\nmachinectl\nsystemctl status \u003cmachine\u003e\ncat /etc/systemd/system/\u003cmachine\u003e.service\n```\nfor example, demo generated services:\n* alpine: https://github.com/random-python/nspawn/blob/master/demo/alpine-base.service\n* archux: https://github.com/random-python/nspawn/blob/master/demo/archux-base.service\n* ubuntu: https://github.com/random-python/nspawn/blob/master/demo/ubuntu-base.service\n\n### Machine Resources\n\nLocation of machine files and folders:\n```\n/etc/systemd/system/\u003cmachine\u003e.service\n/var/lib/machines/\u003cmachine\u003e\n/var/lib/nspawn/runtime/\u003cmachine\u003e\n```\n\n### Machine Management\n\nTo interact with live machine:\n* for machines registered with `machinectl`\n* for machines with `systemd` `init`, such as `archlinux`\n```\n# start interactive shell:\nsudo machinectl shell \u003cmachine\u003e \n```\n```\n# invoke command with args:\nsudo machinectl shell \u003cmachine\u003e /bin/command arg1 arg2 ... \n```\n* for machines not registered with `machinectl`\n* for machines without `systemd` `init`, such as `alpine linux`\n```\n# start interactive shell:\n./setup.py --action=nsenter \n```\n* alternatively, use package-provided `nspawn-enter` command:\n```\n# start interactive shell:\nnspawn-enter \u003cmachine\u003e \n```\n```\n# invoke command with args:\nnspawn-enter \u003cmachine\u003e \"command arg1 arg2 ...\" \n```\n\n### Configuration\n\nAvailable configuration options are described in\n[config.ini](https://github.com/random-python/nspawn/blob/master/src/main/nspawn/config.ini) \nfile.\n\nUse `config/path_list` option to control configuration override file list.\n\n### Image Server\n\nPackage comes with provisioning command `nspawn-hatch`\nwhich can build and setup local http/https image server.\n```\n# review available services:\nnspawn-hatch list\n```\n```\n# provision image server service:\nnspawn-hatch update image-server\n```\n```\n# verify image server machine status:\nmachinectl\n```\n\nImage server settings:\n* https://github.com/random-python/nspawn/tree/master/src/main/nspawn/app/hatcher/service/image-server\n\nImage syncer settings (replicate to Amazon AWS S3):\n* https://github.com/random-python/nspawn/tree/master/src/main/nspawn/app/hatcher/service/image-syncer\n\n### Build DSL\n\nBuild DSL is used in `build.py`, is activated by `from nspawn.build import *` and provides keywords:\n```\n    'TOOL',\n    'IMAGE',\n    'PULL',\n    'EXEC',\n    'WITH',\n    'FETCH',\n    'COPY',\n    'CAST',\n    'RUN',\n    'SH',\n    'PUSH',\n```\n\n### Setup DSL\n\nSetup DSL is used in `setup.py`, is activated by `from nspawn.setup import *` and provides keywords:\n```\n    'TOOL',\n    'IMAGE',\n    'MACHINE',\n    'WITH',\n    'EXEC',\n    'COPY',\n    'CAST',\n    'RUN',\n    'SH',\n```\n\n### DSL Syntax\n\n#### `TOOL`\n\nExpose build/setup utility functions:\n* https://github.com/random-python/nspawn/tree/master/src/main/nspawn/tool\n```\nTOOL.\u003cfunction\u003e(...)\n```\n\n#### `IMAGE()`\n\nDeclare image identity:\n```\nIMAGE(\"http://host/path/package.tar.gz\")\nIMAGE(url=\"http://host/path/package.tar.gz\")\n```\n\n#### `PULL()`\n\nProvision dependency image:\n```\nPULL(\"http://host/path/package.tar.gz\")\nPULL(url=\"http://host/path/package.tar.gz\")\n```\n\n#### `EXEC()`\n\nDeclare image entry point executable i.e. `COMMAND [ARGS...]`:\n* https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html\n```\nEXEC(['/usr/bin/env', 'sh', '-c', 'echo \"hello-kitty\"'])\nEXEC(command=['/usr/bin/env', 'sh', '-c', 'echo \"hello-kitty\"'])\n```\n\n#### `WITH()`\n\nCustomize machine features using nspawn container settings:\n* https://www.freedesktop.org/software/systemd/man/systemd.nspawn.html\n```\nWITH(\n    SettingName1='setting 1 value a',\n    SettingName2='setting 2 value b',\n    ...,\n)\n```\n\n#### `COPY()`\n\nCopy local resources:\n* when used in `build.py`: target is in the image\n* when used in `setup.py`: target is on the host\n```\nCOPY(\"/etc\")\nCOPY(path=\"/etc\")\nCOPY(source=\"/root/input.md\", target=\"/root/output.md\")\n```\n\n#### `CAST()`\n\nTemplate local resources:\n* when used in `build.py`: target is in the image\n* when used in `setup.py`: target is on the host\n```\nCAST(\"/root/readme.md\", variable=\"template varialbe\", ...)\nCAST(path=\"/root/readme.md\", variable=\"template varialbe\", ...)\nCAST(source=\"/root/input.md\", target=\"/root/output.md\", variable=\"template varialbe\", ...)\n```\n\nTemplate uses [python/jinja](https://jinja.palletsprojects.com/en/2.10.x/)\nformat, i.e:\n```\nthis template variable will be substituted: {{variable}}\n```\n\n#### `FETCH()`\n\nDownload and extract remote resource:\n```\nFETCH( # use when source and target are the same\n   url=\"http://server/package.tar.gz\", # url for remote resource\n   path=\"/common-path\", # path inside the package source and image target\n)\nFETCH( # use when source and target are different\n   url=\"http://server/package.tar.gz\", # url for remote resource\n   source=\"/package-path\", # path inside the package extract\n   target=\"/opt/resource\", # path inside the build image target\n)\n```\n\n#### `RUN()`\n\nInvoke command, with target depending on the context:\n* when used in `build.py`: invoke inside the image\n* when used in `setup.py`: invoke on the host\n```\nRUN(['/usr/bin/env', 'ls', '-las'])\nRUN(command=['/usr/bin/env', 'ls', '-las'])\n```\n\n#### `SH()`\n\nInvoke shell script, with target depending on the context:\n* when used in `build.py`: invoke inside the image\n* when used in `setup.py`: invoke on the host\n```\nSH(\"ls -las\")\nSH(script=\"ls -las\")\n```\nNote:\n* `SH(script)` is equivalent to `RUN(command=['/usr/bin/env', 'sh', '-c', script])`\n\n#### `PUSH()`\n\nPublish image result to the declared url:\n```\nPUSH()\n```\n\n#### `MACHINE()`\n\nDeclare machine service:\n```\nMACHINE('machine-name')\nMACHINE(name='machine-name')\nMACHINE(name='machine-name', template='/path/to/service/template/machine.service')\n```\n\nProvide inline service unit changes:\n```\nMACHINE(\n    name='machine-name',\n    # extra entries for [Unit] section\n    unit_conf=[\n        \"Description=hello-world\",  # override description\n    ],\n    # extra entries for [Service] section\n    service_conf=[\n        \"CPUQuota=10%\",  # throttle processor usage\n    ],\n    # extra entries for [Install] section\n    install_conf=[\n        \"WantedBy=machines.target\",  # inject unit dependency\n    ],\n)\n```\n\nDesign custom service templates based on package-provided defaults, for example:\n* https://github.com/random-python/nspawn/tree/master/src/main/nspawn/template\n\n\n\n\n[travis_icon]: https://travis-ci.org/random-python/nspawn.svg?branch=master\n[travis_link]: https://travis-ci.org/random-python/nspawn/builds\n\n[appvey_icon]: https://ci.appveyor.com/api/projects/status/fbjgg6ana9kkww6p?svg=true\n[appvey_link]: https://ci.appveyor.com/project/Andrei-Pozolotin/nspawn/history \n\n[pypi_icon]: https://badge.fury.io/py/nspawn.svg\n[pypi_link]: https://pypi.python.org/pypi/nspawn\n\n[python_icon]: https://img.shields.io/pypi/pyversions/nspawn.svg\n[python_link]: https://pypi.python.org/pypi/nspawn\n\n[tokei_icon]: https://tokei.rs/b1/github/random-python/nspawn\n[tokei_link]: https://github.com/random-python/nspawn/tree/master/src\n","funding_links":[],"categories":["python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandom-python%2Fnspawn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandom-python%2Fnspawn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandom-python%2Fnspawn/lists"}