{"id":13733568,"url":"https://github.com/Arkq/flake8-requirements","last_synced_at":"2025-05-08T09:32:11.456Z","repository":{"id":27121532,"uuid":"112574713","full_name":"arkq/flake8-requirements","owner":"arkq","description":"Package requirements checker","archived":false,"fork":false,"pushed_at":"2025-01-14T20:14:04.000Z","size":117,"stargazers_count":37,"open_issues_count":11,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T02:52:39.482Z","etag":null,"topics":["flake8","flake8-plugin"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flake8-requirements/","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/arkq.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-11-30T06:38:37.000Z","updated_at":"2025-01-14T20:14:09.000Z","dependencies_parsed_at":"2024-01-06T09:53:44.069Z","dependency_job_id":"1b0f798e-55d9-4e73-8a2f-61e5ef73e559","html_url":"https://github.com/arkq/flake8-requirements","commit_stats":{"total_commits":75,"total_committers":19,"mean_commits":"3.9473684210526314","dds":0.36,"last_synced_commit":"9f6c01cece186ac1954f51ddb161b48521415e87"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkq%2Fflake8-requirements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkq%2Fflake8-requirements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkq%2Fflake8-requirements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkq%2Fflake8-requirements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arkq","download_url":"https://codeload.github.com/arkq/flake8-requirements/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253036622,"owners_count":21844249,"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":["flake8","flake8-plugin"],"created_at":"2024-08-03T03:00:45.483Z","updated_at":"2025-05-08T09:32:10.321Z","avatar_url":"https://github.com/arkq.png","language":"Python","funding_links":[],"categories":["Bugs"],"sub_categories":[],"readme":"Package requirements checker\n============================\n\nThis module provides a plug-in for `flake8 \u003chttp://flake8.pycqa.org\u003e`_, which checks/validates\npackage import requirements. It reports missing and/or not used project direct dependencies.\n\nThis plug-in adds new flake8 warnings:\n\n- ``I900``: Package is not listed as a requirement.\n- ``I901``: Package is required but not used. (not implemented yet)\n\nImportant notice\n----------------\n\nIn order to collect project's dependencies, this checker evaluates Python code from the\n``setup.py`` file stored in the project's root directory. Code evaluation is done with the `eval()\n\u003chttps://docs.python.org/3/library/functions.html#eval\u003e`_ function. As a fall-back method, this\nchecker also tries to load dependencies, in order, from the ``setup.cfg``, the ``pyproject.toml``\nfile from the `PEP 621 \u003chttps://peps.python.org/pep-0621/\u003e`_ project section, the ``pyproject.toml``\nfile from the `poetry \u003chttps://python-poetry.org/\u003e`_ tool section, or from the\n``requirements.txt`` text file in the project's root directory.\n\nAt this point it is very important to be aware of the consequences of the above approach. One\nmight inject malicious code into the ``setup.py`` file, which will be executed by this checker.\nHence, this checker shall NEVER be use to check code from an unknown source! However, in most\ncases, one validates code from a known source (e.g. own code) and one will run script stored in\nthe ``setup.py`` file anyway. The worst case scenario is, that this checker will execute the\nequivalent of the ``python setup.py``, which shall be idempotent (it's a horribly designed\n``setup.py`` file if it's not).\n\nIf you have noticed some side effects during the ``flake8`` check and your ``setup.py`` file is\nwritten in a standard way (e.g. `pypa-sampleproject\n\u003chttps://github.com/pypa/sampleproject/blob/master/setup.py\u003e`_), please fill out a bug report.\n\nInstallation\n------------\n\nYou can install, upgrade, or uninstall ``flake8-requirements`` with these commands::\n\n  $ pip install flake8-requirements\n  $ pip install --upgrade flake8-requirements\n  $ pip uninstall flake8-requirements\n\nCustomization\n-------------\n\nFor projects with custom (private) dependencies, one can provide mapping between project name and\nprovided modules. Such a mapping can be set on the command line during the flake8 invocation with\nthe ``--known-modules`` option or alternatively in the ``[flake8]`` section of the configuration\nfile, e.g. ``setup.cfg``. The syntax of the custom mapping looks like follows::\n\n  1st-project-name:[module1,module2,...],2nd-project-name:[moduleA,moduleB,...],...\n\nIf some local project lacks \"name\" attribute in the ``setup.py`` file (it is highly discouraged\nnot to provide the \"name\" attribute, though), one can omit the project name in the mapping and do\nas follows::\n\n  :[localmodule1,localmodule2,...],1st-local-library:[moduleA,moduleB,...],...\n\nReal life example::\n\n  $ cat setup.cfg\n  [flake8]\n  max-line-length = 100\n  known-modules = my-lib:[mylib.drm,mylib.encryption]\n\nIf you use `Flake8-pyproject \u003chttps://pypi.org/project/Flake8-pyproject/\u003e`_\n(can include for installation using ``flake8-requirements[pyproject]``),\nyou can also configure the known modules using a nicer syntax in ``pyproject.toml``::\n\n  $ cat pyproject.toml\n  ...\n  [tool.flake8]\n  max-line-length = 100\n\n  [tool.flake8.known-modules]\n  my-lib = [\"mylib.drm\", \"mylib.encryption\"]\n\nNote that if the module's name contains dots, you have to quote it in pyproject.toml (e.g.\n``\"my_namespace.my_lib\" = [...]``).\n\nIt is also possible to scan host's site-packages directory for installed packages. This feature is\ndisabled by default, but user can enable it with the ``--scan-host-site-packages`` command line\noption. Please note, however, that the location of the site-packages directory will be determined\nby the Python version used for flake8 execution.\n\nIn order to read requirements from the text file, user shall provide the location of such a file\nwith the ``--requirements-file`` option. If the given location is not an absolute path, then it\nhas to be specified as a path relative to the project's root directory.\n\nIf you use the ``-r`` flag in your requirements text file with more than one level of recursion\n(in other words, one file includes another, the included file includes yet another, and so on),\nadd the ``--requirements-max-depth`` option to flake8 (for example, ``--requirements-max-depth=3``\nto allow three levels of recursion).\n\nFAQ\n---\n\n| **Q:** Package is added to the requirements, but flake8 still reports \"I900 '\u003cNAME\u003e' not listed\n         as a requirement\".\n| **A:** It happens when the name of the package is not the same as the name of the module. In such\n         a case, you have to provide the mapping between the package name and the module name. See\n         the \"`Customization \u003c#customization\u003e`_\" section for more details. If the package for which\n         that happens is a well-known package, please fill out a bug report or add mapping to the\n         `KNOWN_3RD_PARTIES \u003csrc/flake8_requirements/modules.py#L509\u003e`_ and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FArkq%2Fflake8-requirements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FArkq%2Fflake8-requirements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FArkq%2Fflake8-requirements/lists"}