How to use the requirements.txt function in requirements

To help you get started, we’ve selected a few requirements examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / now / packages / now-python / src / index.ts View on Github external
const convertCmd = join(tempDir, 'bin', 'pipfile2req');
    await pipenvConvert(convertCmd, pipfileLockDir);
  }

  fsFiles = await glob('**', workPath);
  const requirementsTxt = join(entryDirectory, 'requirements.txt');

  if (fsFiles[requirementsTxt]) {
    debug('Found local "requirements.txt"');
    const requirementsTxtPath = fsFiles[requirementsTxt].fsPath;
    await installRequirementsFile({
      filePath: requirementsTxtPath,
      workPath,
      meta,
    });
  } else if (fsFiles['requirements.txt']) {
    debug('Found global "requirements.txt"');
    const requirementsTxtPath = fsFiles['requirements.txt'].fsPath;
    await installRequirementsFile({
      filePath: requirementsTxtPath,
      workPath,
      meta,
    });
  }

  const originalPyPath = join(__dirname, '..', 'now_init.py');
  const originalNowHandlerPyContents = await readFile(originalPyPath, 'utf8');

  // will be used on `from $here import handler`
  // for example, `from api.users import handler`
  debug('Entrypoint is', entrypoint);
  const userHandlerFilePath = entrypoint
github zeit / now / packages / now-python / src / index.ts View on Github external
}

  fsFiles = await glob('**', workPath);
  const requirementsTxt = join(entryDirectory, 'requirements.txt');

  if (fsFiles[requirementsTxt]) {
    debug('Found local "requirements.txt"');
    const requirementsTxtPath = fsFiles[requirementsTxt].fsPath;
    await installRequirementsFile({
      filePath: requirementsTxtPath,
      workPath,
      meta,
    });
  } else if (fsFiles['requirements.txt']) {
    debug('Found global "requirements.txt"');
    const requirementsTxtPath = fsFiles['requirements.txt'].fsPath;
    await installRequirementsFile({
      filePath: requirementsTxtPath,
      workPath,
      meta,
    });
  }

  const originalPyPath = join(__dirname, '..', 'now_init.py');
  const originalNowHandlerPyContents = await readFile(originalPyPath, 'utf8');

  // will be used on `from $here import handler`
  // for example, `from api.users import handler`
  debug('Entrypoint is', entrypoint);
  const userHandlerFilePath = entrypoint
    .replace(/\//g, '.')
    .replace(/\.py$/, '');
github depscloud / depscloud / extractor / src / extractors / RequirementsTxtExtractor.ts View on Github external
public async extract(url: string, files: { [p: string]: ExtractorFile }): Promise {
        const dependencies: Array = [];

        const contents = files["requirements.txt"].raw();
        const lines = contents.split("\n");

        lines.forEach((line) => {
            const commentIndex = line.indexOf("#");
            if (commentIndex > -1) {
                line = line.substring(0, commentIndex);
            }

            line = line.trim()

            if (!line || line[0] === "-") {
                return
            }

            let l = line.length;
            for (const operator of operators) {
github nadav96 / rocketsam / src / actions / build / hash_util.js View on Github external
dirsum.digest(dir, 'sha1', function(err, hashes) {
		var requirementsHash = undefined
		var totalHash = ""

		if (hashes && hashes["files"] != undefined) {
			requirementsHash = hashes["files"]["requirements.txt"]
			if(requirementsHash == undefined) {
				requirementsHash = hashes["files"]["package.json"]
			}
			totalHash = hashes.hash
		}

		deferred.resolve({
			requirements: requirementsHash,
			total: totalHash
		})
	})

requirements

[![npm](https://img.shields.io/npm/v/requirements?style=flat-square)](https://www.npmjs.com/package/requirements) [![coveralls](https://img.shields.io/coveralls/chimurai/requirements.svg?style=flat-square)](https://coveralls.io/r/chimurai/requirements) [!

MIT
Latest version published 23 days ago

Package Health Score

70 / 100
Full package analysis

Popular requirements functions