{"id":17787944,"url":"https://github.com/zmievsa/refaci","last_synced_at":"2025-04-02T00:27:19.511Z","repository":{"id":170466696,"uuid":"646128580","full_name":"zmievsa/refaci","owner":"zmievsa","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-28T15:29:06.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T15:45:25.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zmievsa.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}},"created_at":"2023-05-27T11:29:31.000Z","updated_at":"2023-11-01T11:14:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"44a0d37a-357d-4a8e-9749-dc18966f77bc","html_url":"https://github.com/zmievsa/refaci","commit_stats":null,"previous_names":["ovsyanka83/refi","zmievsa/refaci"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Frefaci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Frefaci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Frefaci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Frefaci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zmievsa","download_url":"https://codeload.github.com/zmievsa/refaci/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246732769,"owners_count":20824810,"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":[],"created_at":"2024-10-27T10:13:25.075Z","updated_at":"2025-04-02T00:27:19.474Z","avatar_url":"https://github.com/zmievsa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# refaci\n\nA toolbox for changing imports in enormous codebases after a large refactoring.\n\n---\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/zmievsa/refaci/actions?query=workflow%3ATests+event%3Apush+branch%3Amain\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/zmievsa/refaci/actions/workflows/test.yaml/badge.svg?branch=main\u0026event=push\" alt=\"Test\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/ovsyanka83/refaci\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/ovsyanka83/refaci?color=%2334D058\" alt=\"Coverage\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/refaci/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/refaci?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/refaci/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/refaci?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\npip install refaci\n```\n\n## Guide\n\n```python\n\nimport json\nfrom pathlib import Path\n​\nfrom refaci.refactor import ContentsRegex, FilePathRegex, refactor\n\n{\n    \"moved\": {\n        \"old_package.worker\": {\n            \"DEAD_MESSAGE_TTL\": { # Symbol that we changed\n                \"path\": \"new_package.worker\",\n                \"alias\": \"DEAD_MESSAGE_TTL\"\n            },\n            \"RETRY_TIME\": {\n                \"path\": \"new_package.worker\",\n                \"alias\": \"NEW_RETRY_TIME_NAME\"\n            }\n        },\n    },\n    \"new\": { # These imports will be added to all modules automatically\n        \"b64_decode_url_params\": \"new_package.pagination\",\n        \"PaginationToken\": \"new_package.pagination\"\n    }\n}​\n​\n​\nreplacements = {\n    FilePathRegex(r\"\"): (\n        (\"internal_config=\", \"internal_settings=\"),\n        (\"= get_logger\", \"= getLogger\"),\n    ),\n    FilePathRegex(r\"api/app.py\"): [\n        (\"LogicError\", \"BusinessLogicError\"),\n    ],\n    ContentsRegex(r\"class .+\\(.+Controller\\)\"): (\n        (\"super().get(\", \"self.client.get(\"),\n    ),\n    FilePathRegex(r\"tests/\"): [\n        [\"Response(\", \"make_response(\"],\n    ],\n}\n​\n​\nrefactor(Path(input(\"Path to your service:\")), import_replacements[\"moved\"], import_replacements[\"new\"], replacements)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmievsa%2Frefaci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmievsa%2Frefaci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmievsa%2Frefaci/lists"}