def requirements(state, dev=False, dev_only=False, hash=False): from pipenv.utils.dependencies import convert_deps_to_pip lockfile = state.project.lockfile_content for i, package_index in enumerate(lockfile["_meta"]["sources"]): prefix = "-i" if i == 0 else "--extra-index-url" echo(" ".join([prefix, package_index["url"]])) deps = {} if not dev_only: deps.update(lockfile["default"]) if dev or dev_only: deps.update(lockfile["develop"]) pip_deps = convert_deps_to_pip( deps, project=None, r=False, include_index=False, include_hashes=hash, include_markers=False, ) for d in pip_deps: echo(d) sys.exit(0)
def test_convert_deps_to_pip(monkeypatch, deps, expected): with monkeypatch.context() as m: import pip_shims m.setattr(pip_shims.shims, "unpack_url", mock_unpack) if expected.startswith("Django"): expected = expected.lower() assert dependencies.convert_deps_to_pip(deps, r=False) == [expected]
def test_convert_deps_to_pip_unicode(): deps = {"django": "==1.10"} deps = dependencies.convert_deps_to_pip(deps, r=False) assert deps[0] == "django==1.10"
def test_convert_deps_to_pip_one_way(deps, expected): assert dependencies.convert_deps_to_pip(deps, r=False) == [expected.lower()]
VERSION = "1.8.1" # PEP-440 NAME = "streamlit" DESCRIPTION = "The fastest way to build data apps in Python" LONG_DESCRIPTION = ("Streamlit's open-source app framework is the easiest way " "for data scientists and machine learning engineers to " "create beautiful, performant apps in only a few hours! " "All in pure Python. All for free.") pipfile = Project(chdir=False).parsed_pipfile packages = pipfile["packages"].copy() requirements = convert_deps_to_pip(packages, r=False) class VerifyVersionCommand(install): """Custom command to verify that the git tag matches our version""" description = "verify that the git tag matches our version" def run(self): tag = os.getenv("CIRCLE_TAG") if tag != VERSION: info = "Git tag: {0} does not match the version of this app: {1}".format( tag, VERSION) sys.exit(info)