{"id":19315447,"url":"https://github.com/fylein/flake8-restrict-imports","last_synced_at":"2025-04-23T04:49:52.512Z","repository":{"id":216142848,"uuid":"740546527","full_name":"fylein/flake8-restrict-imports","owner":"fylein","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-10T05:59:11.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-15T16:56:59.217Z","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/fylein.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-08T15:09:24.000Z","updated_at":"2025-04-10T05:59:15.000Z","dependencies_parsed_at":"2024-01-08T17:31:15.912Z","dependency_job_id":"f1f4f3df-470e-4531-a4a5-f55101eed9d4","html_url":"https://github.com/fylein/flake8-restrict-imports","commit_stats":null,"previous_names":["fylein/flake8-restrict-imports"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fylein%2Fflake8-restrict-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fylein%2Fflake8-restrict-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fylein%2Fflake8-restrict-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fylein%2Fflake8-restrict-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fylein","download_url":"https://codeload.github.com/fylein/flake8-restrict-imports/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372945,"owners_count":21419722,"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-11-10T01:07:02.131Z","updated_at":"2025-04-23T04:49:52.496Z","avatar_url":"https://github.com/fylein.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Flake8 Restrict Imports Plugin\n==============================\n\nOverview\n--------\n\nThis Flake8 plugin provides a mechanism to restrict imports based on a specified configuration. The plugin allows you to define sets of denied and allowed imports, helping you enforce coding standards and maintain a clean codebase.\n\n### Features\n\n-   Denied Imports: Specify a configuration that defines imports to be denied for specific modules/packages.\n-   Allowed Imports: Specify a configuration that defines allowed imports for specific modules/packages.\n\nInstallation\n------------\n\nInstall the plugin using `pip`:\n\n\n`pip install flake8-restrict-imports`\n\nUsage\n-----\n\nOnce the plugin is installed, you can run Flake8 with the plugin enabled:\n\n\n`flake8 your_project_directory`\n\n### Configuration\n\nYou need to configure the plugin in your Flake8 configuration file (e.g., `.flake8`):\n\n\n```[flake8]\ndenied_imports_config = {'libs': ['db', 'tests'],'db': ['libs', 'tests']}\nallowed_imports_config = {'api.tests.utils': ['db', 'libs'], 'db': ['tests']}\n```\n\nAdjust the configurations based on your project's needs.\n\n### Example\n\nConsider the following code snippet:\n\n\n```\n# your_module.py\n\n# Denied import\nfrom core import some_module  # This import is denied according to the configuration\n\n# Allowed import\nfrom api.tests.event_utils import some_function  # This import is allowed according to the configuration\n```\n\n# Denied import\n`from core import some_module` This import is denied according to the configuration\n\n# Allowed import\n`from api.tests.event_utils import some_function` This import is allowed according to the configuration`\n\nWhen Flake8 is run, it will raise a warning for the denied import and ensure compliance with your defined import restrictions.\n\nContribution\n------------\n\nFeel free to contribute to the development of this Flake8 plugin. Fork the repository, make your changes, and submit a pull request.\n\nLicense\n-------\n\nThis Flake8 plugin is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffylein%2Fflake8-restrict-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffylein%2Fflake8-restrict-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffylein%2Fflake8-restrict-imports/lists"}