Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_convert_deps_to_pip_unicode():
deps = {u"django": u"==1.10"}
deps = pipenv.utils.convert_deps_to_pip(deps, r=False)
assert deps[0] == "django==1.10"
deps,
sources=project.sources,
verbose=verbose,
python=python_version(
which('python') if project.required_python_version else None
)
)
# Add default dependencies to lockfile.
for dep in results:
lockfile['default'].update({dep['name']: {'version': '=={0}'.format(dep['version'])}})
lockfile['default'][dep['name']]['hashes'] = dep['hashes']
# Add refs for VCS installs.
# TODO: be smarter about this.
vcs_deps = convert_deps_to_pip(project.vcs_packages, r=False)
pip_freeze = delegator.run('{0} freeze'.format(which_pip())).out
for dep in vcs_deps:
for line in pip_freeze.strip().split('\n'):
try:
installed = convert_deps_from_pip(line)
name = list(installed.keys())[0]
if is_vcs(installed[name]):
lockfile['default'].update(installed)
except IndexError:
pass
# Run the PEP 508 checker in the virtualenv, add it to the lockfile.
cmd = '"{0}" {1}'.format(which('python'), shellquote(pep508checker.__file__.rstrip('cdo')))
c = delegator.run(cmd)
# Install default dependencies, always.
deps.update(lockfile['default'] if not only else {})
vcs_deps.update(lockfile.get('default-vcs', {}))
if ignore_hashes:
# Remove hashes from generated requirements.
for k, v in deps.items():
if 'hash' in v:
del v['hash']
# Convert the deps to pip-compatible arguments.
deps_list = [(d, ignore_hashes) for d in convert_deps_to_pip(deps, r=False)]
failed_deps_list = []
if len(vcs_deps):
deps_list.extend((d, True) for d in convert_deps_to_pip(vcs_deps, r=False))
# --requirements was passed.
if requirements:
click.echo('\n'.join(d[0] for d in deps_list))
sys.exit(0)
# pip install:
for dep, ignore_hash in progress.bar(deps_list, label=INSTALL_LABEL if os.name != 'nt' else ''):
# Install the module.
c = pip_install(
dep,
ignore_hashes=ignore_hash,
allow_global=allow_global,
no_deps=no_deps,
verbose=verbose
if dev:
deps.update(lockfile['develop'])
vcs_deps.update(lockfile.get('develop-vcs', {}))
# Install default dependencies, always.
deps.update(lockfile['default'] if not only else {})
vcs_deps.update(lockfile.get('default-vcs', {}))
if ignore_hashes:
# Remove hashes from generated requirements.
for k, v in deps.items():
if 'hash' in v:
del v['hash']
# Convert the deps to pip-compatible arguments.
deps_list = [(d, ignore_hashes) for d in convert_deps_to_pip(deps, r=False)]
failed_deps_list = []
if len(vcs_deps):
deps_list.extend((d, True) for d in convert_deps_to_pip(vcs_deps, r=False))
# --requirements was passed.
if requirements:
click.echo('\n'.join(d[0] for d in deps_list))
sys.exit(0)
# pip install:
for dep, ignore_hash in progress.bar(deps_list, label=INSTALL_LABEL if os.name != 'nt' else ''):
# Install the module.
c = pip_install(
dep,
deps,
sources=project.sources,
verbose=verbose,
python=python_version(
which('python') if project.required_python_version else None
)
)
# Add develop dependencies to lockfile.
for dep in results:
lockfile['develop'].update({dep['name']: {'version': '=={0}'.format(dep['version'])}})
lockfile['develop'][dep['name']]['hashes'] = dep['hashes']
# Add refs for VCS installs.
# TODO: be smarter about this.
vcs_deps = convert_deps_to_pip(project.vcs_dev_packages, r=False)
pip_freeze = delegator.run('{0} freeze'.format(which_pip())).out
for dep in vcs_deps:
for line in pip_freeze.strip().split('\n'):
try:
installed = convert_deps_from_pip(line)
name = list(installed.keys())[0]
if is_vcs(installed[name]):
lockfile['develop'].update(installed)
except IndexError:
pass
# Alert the user of progress.
click.echo(
u'{0} {1} {2}'.format(
def get_packages_from_Pipfile():
pipfile = Project(chdir=False).parsed_pipfile
return convert_deps_to_pip(pipfile['packages'], r=False)
#!/usr/bin/env python
# coding: utf-8
import os
import re
from setuptools import setup, find_packages
from pipenv.project import Project
from pipenv.utils import convert_deps_to_pip
here = os.path.abspath(os.path.dirname(__file__))
pfile = Project(chdir=False).parsed_pipfile
requirements = convert_deps_to_pip(pfile["packages"], r=False)
test_requirements = convert_deps_to_pip(pfile["dev-packages"], r=False)
def load_readme():
with open(os.path.join(here, "README.md")) as f:
return f.read()
target_files = []
for root, dirs, files in os.walk(f"{here}/jumeaux/sample"):
targets = [os.path.join(root, f) for f in files]
target_files.extend(targets)
setup(
name="jumeaux",
version=re.search(