MCPcopy Index your code
hub / github.com/serverless/serverless / getRequirements

Function getRequirements

packages/serverless/lib/plugins/python/lib/pip.js:622–636  ·  view source on GitHub ↗

* get requirements from requirements.txt * @param {string} source * @return {string[]}

(source)

Source from the content-addressed store, hash-verified

620 * @return {string[]}
621 */
622function getRequirements(source) {
623 const requirements = fse
624 .readFileSync(source, { encoding: 'utf-8' })
625 .replace(/\\\n/g, ' ')
626 .split(/\r?\n/)
627
628 return requirements.reduce((acc, req) => {
629 req = req.trim()
630 if (!req.startsWith('-r')) {
631 return [...acc, req]
632 }
633 source = path.join(path.dirname(source), req.replace(/^-r\s+/, ''))
634 return [...acc, ...getRequirements(source)]
635 }, [])
636}
637
638/** create a filtered requirements.txt without anything from noDeploy
639 * then remove all comments and empty lines, and sort the list which

Callers 2

filterRequirementsFileFunction · 0.85

Calls 1

readFileSyncMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…