{"id":16018387,"url":"https://github.com/jupe/py-lockable","last_synced_at":"2025-10-10T22:13:25.261Z","repository":{"id":37903768,"uuid":"299509240","full_name":"jupe/py-lockable","owner":"jupe","description":"py-lockable, python resource locking/reservation/allocation  library","archived":false,"fork":false,"pushed_at":"2025-09-08T09:20:42.000Z","size":177,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-08T10:36:12.206Z","etag":null,"topics":["allocation","allocator","hardware","lockable","locker","locking","python","resource"],"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/jupe.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-09-29T05:02:36.000Z","updated_at":"2025-09-08T09:13:36.000Z","dependencies_parsed_at":"2024-10-27T15:14:21.156Z","dependency_job_id":"23302807-1932-40bf-8493-628c5983b207","html_url":"https://github.com/jupe/py-lockable","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/jupe/py-lockable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupe%2Fpy-lockable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupe%2Fpy-lockable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupe%2Fpy-lockable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupe%2Fpy-lockable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jupe","download_url":"https://codeload.github.com/jupe/py-lockable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupe%2Fpy-lockable/sbom","scorecard":{"id":543045,"data":{"date":"2025-08-11","repo":{"name":"github.com/jupe/py-lockable","commit":"50550cc0bba47366bca4831b6db311c08ad4a26d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.9,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Code-Review","score":6,"reason":"Found 6/9 approved changesets -- score normalized to 6","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":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"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":"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":"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":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/jupe/py-lockable/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/jupe/py-lockable/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/jupe/py-lockable/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/jupe/py-lockable/codeql-analysis.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction 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":"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: 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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T08:43:15.248Z","repository_id":37903768,"created_at":"2025-08-20T08:43:15.249Z","updated_at":"2025-08-20T08:43:15.249Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005464,"owners_count":26083900,"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-10T02:00:06.843Z","response_time":62,"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":["allocation","allocator","hardware","lockable","locker","locking","python","resource"],"created_at":"2024-10-08T16:42:23.152Z","updated_at":"2025-10-10T22:13:25.254Z","avatar_url":"https://github.com/jupe.png","language":"Python","readme":"# lockable\n\n[![CI](https://github.com/jupe/py-lockable/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jupe/py-lockable/actions/workflows/ci.yml?query=branch%3Amaster)\n[![PyPI version](https://badge.fury.io/py/lockable.svg)](https://pypi.org/project/lockable/)\n[![Coverage Status](https://coveralls.io/repos/github/jupe/pytest-lockable/badge.svg)](https://coveralls.io/github/jupe/py-lockable)\n\nResource locking module for python.\n\nOriginally designed for following projects:\n* [pytest-lockable](https://github.com/jupe/pytest-lockable)\n* [robot-lockable](https://github.com/jupe/robot-lockable)\n\n\nModule provides python API and simple CLI interface.\n\nResource is released in following cases:\n* process ends\n* when context ends when `lockable.auto_lock(..)` is used\n* allocation.unlock() is called\n* lockable.unlock(\u003callocation\u003e) is called\n\nResources data provider support following mechanisms:\n* `resources.json` file in file system\n* python list of dictionaries\n* http uri which points to API and is used with HTTP GET method. API should provide `resources.json` data as json object.\n\n# CLI interface\n\n```\n% lockable --help\nusage: lockable [-h] [--validate-only] [--lock-folder LOCK_FOLDER] [--resources RESOURCES]\n                [--timeout TIMEOUT] [--hostname HOSTNAME]\n                [--requirements REQUIREMENTS]\n                [command [command ...]]\n\nrun given command while suitable resource is allocated.\nUsage example: lockable --requirements {\"online\":true} echo using resource: $ID\n\npositional arguments:\n  command               Command to be execute during device allocation\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --validate-only       Only validate resources.json\n  --lock-folder LOCK_FOLDER\n                        lock folder\n  --resources RESOURCES\n                        Resources file (utf-8) or http uri\n  --timeout TIMEOUT     Timeout for trying allocate suitable resource\n  --hostname HOSTNAME   Hostname\n  --requirements REQUIREMENTS\n                        requirements as json string\n\n```\n\n# API's\n\nConstructor\n```python\nlockable = Lockable([hostname], [resource_list_file], [resource_list], [lock_folder])\n```\n\nAllocation\n```python\nallocation_context = lockable.lock(requirements, [timeout_s])\nprint(allocation_context.resource_info)\nprint(allocation_context.resource_id)\nallocation_context.unlock()\n# or using resource info\nlockable.unlock(allocation_context)\n```\n\nAllocation context contains following API:\n* `requirements: dict` Original requirements for allocation\n* `resource_info: dict` Allocated resource information\n* `unlock(): func`  release resource lock function\n* `allocation_queue_time: timedelta` How long waited before allocation\n* `allocation_start_time: datetime` when allocation was started\n* `release_time: datetime` when allocation was ended\n* `alloc_id: str` allocation id\n* `allocation_durations: timedelta` how long time allocation takes\n\nor using context manager which unlock automatically\n```python\nwith lockable.auto_lock(requirements, [timeout_s]) as allocation:\n    print(allocation.resource_info)\n```\n\nResource requirements are evaluated using\n[mongoquery](https://github.com/reuben/mongoquery/), so MongoDB-style\noperators like `$in` and `$gt` are supported when selecting resources.\n\n**Tips:**\n\nYou can allocate also offline devices by set requirements `\"online\": None` .\nYou can ignore also `hostname` same same way by  setting it to  None`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupe%2Fpy-lockable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjupe%2Fpy-lockable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupe%2Fpy-lockable/lists"}