{"id":21158372,"url":"https://github.com/toilal/python-chmod-monkey","last_synced_at":"2025-07-09T12:34:00.607Z","repository":{"id":62562047,"uuid":"262859012","full_name":"Toilal/python-chmod-monkey","owner":"Toilal","description":"Add support for `os.chmod('script.sh', 'ug+x')` syntax style.","archived":false,"fork":false,"pushed_at":"2020-05-12T21:55:06.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2024-11-13T00:13:09.273Z","etag":null,"topics":["chmod","monkeypatch","python","str","string"],"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/Toilal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-05-10T19:20:37.000Z","updated_at":"2022-03-17T20:21:58.000Z","dependencies_parsed_at":"2022-11-03T15:30:26.424Z","dependency_job_id":null,"html_url":"https://github.com/Toilal/python-chmod-monkey","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toilal%2Fpython-chmod-monkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toilal%2Fpython-chmod-monkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toilal%2Fpython-chmod-monkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Toilal%2Fpython-chmod-monkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Toilal","download_url":"https://codeload.github.com/Toilal/python-chmod-monkey/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225551889,"owners_count":17487281,"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","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":["chmod","monkeypatch","python","str","string"],"created_at":"2024-11-20T12:22:06.881Z","updated_at":"2024-11-20T12:22:07.378Z","avatar_url":"https://github.com/Toilal.png","language":"Python","readme":"# python-chmod-monkey\n\n[![PyPI](https://img.shields.io/pypi/v/chmod-monkey)](https://pypi.org/project/chmod-monkey/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chmod-monkey)\n![PyPI - License](https://img.shields.io/pypi/l/chmod-monkey)\n[![Build Status](https://img.shields.io/travis/Toilal/python-chmod-monkey.svg)](https://travis-ci.org/Toilal/python-chmod-monkey)\n[![Code coverage](https://img.shields.io/coveralls/github/Toilal/python-chmod-monkey)](https://coveralls.io/github/Toilal/python-chmod-monkey)\n\nAdd support for `os.chmod('script.sh', 'ug+x')` syntax style.\n\nAlmost any expression supported by [GNU Coreutils chmod](https://linux.die.net/man/1/chmod) should be supported by this module.\n\n**`[ugoa]*([-+=]([rwx]*|[ugo]))+|[-+=][0-7]+`**\n\n`Xst` flags are not supported though.\n\n## Install\n\n```\npip install chmod-monkey\n```\n\n## Usage\n\nThere are two ways to use `chmod-monkey`.\n\n### Using os.chmod MonkeyPatch\n\n```python\nimport os\n\nimport chmod_monkey\nchmod_monkey.install()  # Install monkeypatch because we are evil !\n\nos.chmod('script.sh', 'ug+x')  # Magic :)\n```\n\n### Using to_mode converter\n\n```python\nimport os\n\nfrom chmod_monkey import to_mode\n\nos.chmod('script.sh', to_mode('script.sh', 'ug+x'))  # For serious people.\n```\n\n## Other features\n\n### Context manager\n\nYou may use the following syntax to temporary change a file mode.\n\n```python\nfrom chmod_monkey import tmp_chmod\n\nwith tmp_chmod('script.sh', \"+w\"):\n    pass # File permissions are modified in this block only\n# File permissions are restored here\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoilal%2Fpython-chmod-monkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoilal%2Fpython-chmod-monkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoilal%2Fpython-chmod-monkey/lists"}