def check_lacking_dependency_links(self): # type: ()->List[str] """ report vcs/url packages that are in pipfile default package but not in dependency_links :raise ValueError: if dependency_links can not be recognized """ # parse dependency_links # name: vcs, url, ref vcs_dependency_names = set() # type: Set[str] file_dependency_links = set() # type: Set[str] # raises ValueError for link in self._dependency_links: if self._is_vcs_link(link): _, _, _, name = self._parse_vcs_link(link) vcs_dependency_names.add(name) else: file_dependency_links.add(link) reports = [] for name, config in self._pipfile_packages.items(): if pipfile_parser.is_remote_package( config) and not pipfile_parser.is_pypi_package(config): if pipfile_parser.is_vcs_package(config): if name not in vcs_dependency_names: reports.append( "vcs package '%s' in pipfile but not in dependency_links" % name) elif "file" in config: assert isinstance(config, dict) if config["file"] not in file_dependency_links: reports.append( "package '%s' has a url in pipfile but not in dependency_links" % name) return reports
def _check_install_requires_conflict( self, ): # type: ()->List[Tuple[str, str, str, VersionConflict]] """ :return: A list of conflicts in the form of (package_name, setup_config, pipfile_config), empty for no conflict """ conflicts = [] # type: List[Tuple[str, str, str, VersionConflict]] for name, vr in self._install_requires_version_reqs.items(): if name in self._pipfile_packages: pipfile_config = self._pipfile_packages[name] if not pipfile_parser.is_pypi_package(pipfile_config): raise ValueError( "package '%s' in install_requires is not a pypi package in pipfile" % name) version_string = "" if isinstance(pipfile_config, str): version_string = pipfile_config else: # dict if "version" in pipfile_config: version_string = pipfile_config["version"] version_string = version_string.replace(" ", "") conflict = vr.analyze_compatibility(version_string) if conflict: conflicts.append((name, str(vr), version_string, conflict)) return conflicts
def check_lacking_install_requires(self): # type: () -> List[str] """ report pypi packages that are in pipfile default package but not in install_requires """ reports = [] for name, config in self._pipfile_packages.items(): if pipfile_parser.is_pypi_package(config): if name not in self._install_requires_package_names: reports.append( "package '%s' in pipfile but not in install_requires" % name) return reports
def check_lacking_install_requires(self): # type: () -> List[str] """ report pypi packages that are in pipfile default package but not in install_requires """ reports = [] for name, config in self._pipfile_packages.items(): # fixes https://github.com/Madoshakalaka/pipenv-setup/issues/72 # if the Pipfile has a dependency with an underscore then # it will be synced to the setup.py file with a dash # before this commit `pipenv-setup check` would check for a # dependency exactly as defined in the Pipfile # this would fail as `package_name` does not equal # `package-name` name = name.replace("_", "-") if pipfile_parser.is_pypi_package(config): if name not in self._install_requires_package_names: reports.append( "package '%s' in pipfile but not in install_requires" % name ) return reports