示例#1
0
def _convert_pipfile(pipfile, dev=False):
    pipfile = Pipfile.load(pipfile).pipfile
    section_names = ["packages"]
    if dev:
        section_names.append("dev-packages")
    sources = pipfile.source

    return _convert(pipfile, sources, section_names, hashes=False)
示例#2
0
    def from_pipfile(self):
        if Pipfile is None:
            raise ImportError(
                'please, install extra requirements: install-requires[pipfile]'
            )

        project = Pipfile.load(self.path)
        requirements = []
        packages = project.get_sections()['packages'].items()
        for name, version in packages:
            req = Requirement.from_pipfile(name, version)
            requirements.append(req.as_line())
        return self._parse_requirements(requirements)
示例#3
0
 def _get_names(self, path):
     with chdir(path):
         project = Pipfile.load(path)
         for req in project.packages:
             yield req.name
示例#4
0
 def _get_names(self, path: str) -> Iterator[str]:
     with chdir(path):
         project = Pipfile.load(path)
         for req in project.packages:
             yield req.name
def _convert_pipfile(pipfile, dev=False):
    pfile = Pipfile.load(pipfile)
    requirements = pfile.dev_requirements if dev else pfile.requirements
    return [req.as_line() for req in requirements]
示例#6
0
 def _get_names(self, path):
     with chdir(path):
         project = Pipfile.load(path)
         for req in project.packages:
             yield req.name
def main(path_to_project: str) -> None:
    p: Pipfile = Pipfile.load(path_to_project)

    with open(path.join(path_to_project, 'requirements.txt'), 'w') as f:
        f.write("\n".join(req.line_instance.get_line() for req in p.requirements))