{"id":34041823,"url":"https://github.com/jamesderlin/python-spawneditor","last_synced_at":"2026-04-05T01:31:38.291Z","repository":{"id":57469670,"uuid":"374081569","full_name":"jamesderlin/python-spawneditor","owner":"jamesderlin","description":"A Python module that attempts to provide a common interface for opening an editor at a specified line in a file.","archived":false,"fork":false,"pushed_at":"2022-09-23T05:36:27.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-02T11:57:42.302Z","etag":null,"topics":["library","python","python-library"],"latest_commit_sha":null,"homepage":"","language":"Python","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/jamesderlin.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}},"created_at":"2021-06-05T10:10:54.000Z","updated_at":"2022-03-28T08:39:51.000Z","dependencies_parsed_at":"2022-09-19T10:12:19.789Z","dependency_job_id":null,"html_url":"https://github.com/jamesderlin/python-spawneditor","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jamesderlin/python-spawneditor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesderlin%2Fpython-spawneditor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesderlin%2Fpython-spawneditor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesderlin%2Fpython-spawneditor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesderlin%2Fpython-spawneditor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesderlin","download_url":"https://codeload.github.com/jamesderlin/python-spawneditor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesderlin%2Fpython-spawneditor/sbom","scorecard":{"id":503739,"data":{"date":"2025-08-11","repo":{"name":"github.com/jamesderlin/python-spawneditor","commit":"9835d6eca2ec467ccd0bb68bf53ff591def772e5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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/30 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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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-19T22:43:45.478Z","repository_id":57469670,"created_at":"2025-08-19T22:43:45.478Z","updated_at":"2025-08-19T22:43:45.478Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31421869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["library","python","python-library"],"created_at":"2025-12-13T22:06:35.832Z","updated_at":"2026-04-05T01:31:38.268Z","avatar_url":"https://github.com/jamesderlin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spawneditor\n\nA Python module that attempts to provide a common interface for opening an\neditor at a specified line in a file.\n\nThe launched editor will be chosen from, in order:\n\n1. The explicitly specified editor.\n2. The `VISUAL` environment variable, if `DISPLAY` is available.\n3. The `EDITOR` environment variable.\n4. Hard-coded paths to common editors.\n\n\n## Installation\n\n```shell\npip install --user spawneditor\n```\n\nAlternatively clone the Git repository as a Git submodule named `spawneditor`.\n\n\n## Examples\n\n```python\nimport spawneditor\n\n# Open an existing file in the default editor.\nspawneditor.edit_file(\"path/to/file.txt\")\n\n# A line number may be specified.\nspawneditor.edit_file(\"path/to/file.txt\", line_number=123)\n\n# Edits a blank temporary file.\nedited_lines = spawneditor.edit_temporary()  \n\n# Edits a temporary file with specified content.  Unlike `edit_file`,\n# `edit_temporary` returns the contents of the edited file.\ninstructions = [\n    \"Instructions:\",\n    \"Enter some text below the line.\",\n    \"----\",\n]\nnew_contents = spawneditor.edit_temporary(instructions,\n                                          line_number=(len(instructions) + 1))\n\n# ... or, if you prefer a single string with newlines:\nnew_contents = spawneditor.edit_temporary(\n    sss[\"Instructions:\\nEnter some text below the line.\\n----\"],\n    line_number=4,\n)\n\nfor line in new_contents:\n    print(line, end=\"\")\n```\n\n\n## FAQ\n\n### Q: How does `spawneditor` know how to invoke the editor at a specified line number? \n\n`spawneditor` is hard-coded to recognize and invoke some common editors based on\nthe name of the executed binary.\n\n\n### Q: What is considered a \"common editor\"?\n\nSee the `editor_syntax_table` in [`spawneditor.py`].\n\n\n### Q: What if my editor isn't supported?\n\nOther editors should still work.  At worst, the specified file should be opened\nin the default editor, just not at the specified line.\n\nIf your editor isn't supported, I also encourage filing an issue or pull request\nto add support.\n\n\n### Q: Why not provide some mechanism for end-users to specify the syntax for their editor?\n\nIt's tempting to support using, say, a configuration file to allow users to\nspecify how to invoke arbitrary editors.  I currently prefer not to because:\n* It adds code complexity and incurs a penalty for what is likely to be a rare\n  situation.\n* It reduces incentives to make `spawneditor` support other editors directly.\n* The fallback behavior still should open the file in the default editor, just\n  not at the specified line number.  I think that's pretty acceptable.\n\nOne pathological situation where an override would be necessary is if an editor\nuses the same executable name as one of the recognized editors *and* uses a\ndifferent command-line syntax for specifying the line number.  However, that\nalso should be a very rare situation.\n\nOne compelling reason might be to allow people to set their default editor to a\nwrapper script that invokes their actual editor.  I'm sympathetic to that, but\nin the meantime, the wrapper script could be given the same name as the actual\neditor.\n\n\n### Q: Why does `VISUAL` depend on `DISPLAY`?\n\nTechnically `VISUAL` should refer to a full-screen editor, not necessarily a\ngraphical editor.  In practice, however, I think that the graphical vs.\ntext-mode distinction is far more relevant and important than the distinction\nbetween full-screen and line-based editors.\n\n\n### Q: Why does `spawneditor.edit_file` immediately return when spawning a multi-document editor (e.g. Visual Studio Code, Sublime Text)?\n\nMulti-document editors are typically also *single-instance*: when the editor is\ninvoked, a new process will be spawned, but that process then will forward the\nrequest to an existing, primary process.  The new, secondary process then will\nimmediately exit and cause `spawneditor.edit_file` to return.  Such editors\ntypically provide a command-line option (e.g. `--wait` for Visual Studio Code\nand Sublime Text) to keep the secondary process alive until the file is closed\nby the primary process.  Consult the documentation to your editor.\n\n\n### Q: Aren't there already Python packages that do this?\n\nYes.  The [`editor`] and [`python-editor`] packages are alternatives that also\ninvoke the default editor.  Currently neither one supports opening a file to a\nspecified line number.  Were I aware of them when I wrote `spawneditor`, and\npossibly I would have tried contributing to them instead.  However,\n`spawneditor` is implemented rather differently than either one, and I'm not\nsure that either project would have appreciated drastic changes.  There likely\nis room for cross-pollination.\n\n---\n\nCopyright © 2020-2022 James D. Lin.\n\n[`spawneditor.py`]: https://github.com/jamesderlin/python-spawneditor/blob/master/spawneditor.py\n[`editor`]: https://pypi.org/project/editor/\n[`python-editor`]: https://pypi.org/project/python-editor/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesderlin%2Fpython-spawneditor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesderlin%2Fpython-spawneditor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesderlin%2Fpython-spawneditor/lists"}