{"id":24708367,"url":"https://github.com/surface-security/compile-requirements","last_synced_at":"2025-10-15T16:32:22.323Z","repository":{"id":43048235,"uuid":"472232921","full_name":"surface-security/compile-requirements","owner":"surface-security","description":"Merge all nested requirements.txt files into a single requirements file","archived":false,"fork":false,"pushed_at":"2023-02-15T18:50:18.000Z","size":8,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T06:34:37.797Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surface-security.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-21T07:41:34.000Z","updated_at":"2022-03-21T08:00:11.000Z","dependencies_parsed_at":"2025-01-27T06:41:55.627Z","dependency_job_id":null,"html_url":"https://github.com/surface-security/compile-requirements","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fcompile-requirements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fcompile-requirements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fcompile-requirements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fcompile-requirements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surface-security","download_url":"https://codeload.github.com/surface-security/compile-requirements/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244913329,"owners_count":20530817,"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":"2025-01-27T06:31:39.895Z","updated_at":"2025-10-15T16:32:17.288Z","avatar_url":"https://github.com/surface-security.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# compile-requirements\n\nHelper to validate and merge all nested requirements.txt files into a single requirements file.\n\n`requirements.txt` supports nesting other files by using `-r other_requirements.txt`\n\nThis is particularly useful when a project includes multiple packages that can easily be removed, so the requirements from each package is specified within its directory.\n\nWhen building docker images and using [multi stage builds](https://docs.docker.com/develop/develop-images/multistage-build/) this is an issue as it would require adding the whole context to the wheels building stage. That would invalidate the cache of that stage on every context change, even if all the requirements files remained the same.\n\nOne option was to duplicate the list of requirement files (already in the main file) to the Dockerfile, so only those were part of the cache. Other option was to flatten the requirements.txt, so the Dockerfile only had to copy one single `requirements.txt`.\n\n*compile-requirements* aims to help with the second approach.\n\n## Usage\n\nChecks performed:\n  - (Warning) package version is not pinned\n  - (Fatal) package is duplicated with different versions\n  - (Fatal) specific app requirements file missing from main file\n\nErrors are printed to stderr; final requirement file is printed to stdout.  \nExit code not zero means at least a fatal check failed.\n\nThe script is built specifically for Python 3 \u0026 pip 20.1 (or higher) however the output can be used with any Python/pip version.\n\nUsage example:\n\n```\ndocker run --rm -v $(pwd)/:/app/:ro \\\n                   ghcr.io/surface-security//compile-requirements \\\n                   surface/requirements.txt \u003e requirements_full.txt\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurface-security%2Fcompile-requirements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurface-security%2Fcompile-requirements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurface-security%2Fcompile-requirements/lists"}