Beispiel #1
0
 def add_arguments(self, parser: argparse.ArgumentParser) -> None:
     parser.add_argument(
         "-d",
         "--dev",
         default=False,
         action="store_true",
         help="import packages into dev dependencies",
     )
     parser.add_argument(
         "-s",
         "--section",
         dest="group",
         help="(DEPRECATED) Alias of `-G/--group`",
         type=deprecated(
             "`-s/--section` is deprecated in favor of `-G/--groups` "
             "and will be removed in the next minor release."),
     )
     parser.add_argument(
         "-G",
         "--group",
         help="Specify the target dependency group to import into")
     parser.add_argument(
         "-f",
         "--format",
         choices=FORMATS.keys(),
         help="Specify the file format explicitly",
     )
     parser.add_argument("filename", help="The file name")
     parser.set_defaults(search_parent=False)
Beispiel #2
0
 def add_arguments(self, parser: argparse.ArgumentParser) -> None:
     parser.add_argument(
         "-f",
         "--format",
         choices=FORMATS.keys(),
         default="requirements",
         help="Specify the export file format",
     )
     groups_group.add_to_parser(parser)
     parser.add_argument(
         "--without-hashes",
         dest="hashes",
         action="store_false",
         default=True,
         help="Don't include artifact hashes",
     )
     parser.add_argument(
         "-o",
         "--output",
         help="Write output to the given file, or print to stdout if not given",
     )
     parser.add_argument(
         "--pyproject",
         action="store_true",
         help="Read the list of packages from pyproject.toml",
     )
Beispiel #3
0
 def add_arguments(self, parser: argparse.ArgumentParser) -> None:
     parser.add_argument(
         "-f",
         "--format",
         choices=FORMATS.keys(),
         help="Specify the file format explicitly",
     )
     parser.add_argument("filename", help="The file name")
     parser.set_defaults(project=self.project_class("."))
Beispiel #4
0
def find_importable_files(project: Project) -> Iterable[tuple[str, Path]]:
    """Find all possible files that can be imported"""
    for filename in (
            "Pipfile",
            "pyproject.toml",
            "requirements.in",
            "requirements.txt",
    ):
        project_file = project.root / filename
        if not project_file.exists():
            continue
        for key, module in FORMATS.items():
            if module.check_fingerprint(project, project_file.as_posix()):
                yield key, project_file
Beispiel #5
0
 def add_arguments(self, parser: argparse.ArgumentParser) -> None:
     parser.add_argument(
         "-d",
         "--dev",
         default=False,
         action="store_true",
         help="import packages into dev dependencies",
     )
     parser.add_argument("-s",
                         "--section",
                         help="Specify target section to import into")
     parser.add_argument(
         "-f",
         "--format",
         choices=FORMATS.keys(),
         help="Specify the file format explicitly",
     )
     parser.add_argument("filename", help="The file name")
     parser.set_defaults(search_parent=False)