def _build_session(options, retries=None, timeout=None): session = PipSession( cache=( normalize_path(os.path.join(options.get('cache_dir'), 'http')) if options.get('cache_dir') else None ), retries=retries if retries is not None else options.get('retries'), insecure_hosts=options.get('trusted_hosts'), ) # Handle custom ca-bundles from the user if options.get('cert'): session.verify = options.get('cert') # Handle SSL client certificate if options.get('client_cert'): session.cert = options.get('client_cert') # Handle timeouts if options.get('timeout') or timeout: session.timeout = ( timeout if timeout is not None else options.get('timeout') ) # Handle configured proxies if options.get('proxy'): session.proxies = { 'http': options.get('proxy'), 'https': options.get('proxy'), } # Determine if we can prompt the user for authentication or not session.auth.prompting = not options.get('no_input') return session
def _build_session(self, options, retries=None, timeout=None): session = PipSession( cache=( normalize_path(os.path.join(options.cache_dir, "http")) if options.cache_dir else None ), retries=retries if retries is not None else options.retries, insecure_hosts=options.trusted_hosts, ) # Handle custom ca-bundles from the user if options.cert: session.verify = options.cert # Handle SSL client certificate if options.client_cert: session.cert = options.client_cert # Handle timeouts if options.timeout or timeout: session.timeout = ( timeout if timeout is not None else options.timeout ) # Handle configured proxies if options.proxy: session.proxies = { "http": options.proxy, "https": options.proxy, } # Determine if we can prompt the user for authentication or not session.auth.prompting = not options.no_input return session
setup( name='turbinia', version=turbinia.__version__, description='Automation and Scaling of Digital Forensics Tools', long_description=turbinia_description, license='Apache License, Version 2.0', url='http://turbinia.plumbing/', maintainer='Turbinia development team', maintainer_email='*****@*****.**', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Operating System :: OS Independent', 'Programming Language :: Python', ], packages=find_packages(), include_package_data=True, zip_safe=False, entry_points={ 'console_scripts': ['turbiniactl=turbinia.turbiniactl:main'] }, install_requires=[ str(req.req) for req in parse_requirements('requirements.txt', session=PipSession()) ], extras_require={ 'dev': ['mock', 'nose', 'yapf'], 'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'], 'worker': ['plaso>=20171118'] })
#!/usr/bin/env python """Setup script for Hydrus.""" from setuptools import setup, find_packages try: # for pip >= 10 from pip._internal.req import parse_requirements from pip._internal.download import PipSession except ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements from pip.download import PipSession install_requires = parse_requirements('requirements.txt', session=PipSession()) dependencies = [str(package.req) for package in install_requires] setup(name='hydrus', include_package_data=True, version='0.0.1', description='A space-based application for W3C HYDRA Draft', author='W3C HYDRA development group', author_email='*****@*****.**', url='https://github.com/HTTP-APIs/hydrus', py_modules=['cli'], python_requires='>=3', install_requires=dependencies, packages=find_packages(exclude=['contrib', 'docs', 'tests*', 'hydrus.egg-info']), package_dir={'hydrus': 'hydrus'}, entry_points=''' [console_scripts]
from setuptools import setup if tuple(map(int, pip.__version__.split('.'))) >= (10, 0, 0): # noinspection PyProtectedMember from pip._internal.download import PipSession # noinspection PyProtectedMember from pip._internal.req import parse_requirements else: # noinspection PyUnresolvedReferences from pip.download import PipSession # noinspection PyUnresolvedReferences from pip.req import parse_requirements install_requires_g = parse_requirements('requirements.txt', session=PipSession()) install_requires = [str(ir.req) for ir in install_requires_g] dev_requires_g = parse_requirements('requirements-dev.txt', session=PipSession()) dev_requires = [str(ir.req) for ir in dev_requires_g] setup( name='keep-on-giffing', version='0.1.0', # PyPI metadata author='Marti Raudsepp', author_email='*****@*****.**', url='https://github.com/intgr/topy', download_url='https://pypi.org/project/keep-on-giffing/',
def session(): return PipSession()
u'Timesketch is a web based tool for collaborative forensic timeline ' u'analysis. Using sketches you and your collaborators can easily organize ' u'timelines and analyze them all at the same time. Add meaning to ' u'your raw data with rich annotations, comments, tags and stars.') setup( name=u'timesketch', version=timesketch_version, description=u'Digital forensic timeline analysis', long_description=timesketch_description, license=u'Apache License, Version 2.0', url=u'http://www.timesketch.org/', maintainer=u'Timesketch development team', maintainer_email=u'*****@*****.**', classifiers=[ u'Development Status :: 4 - Beta', u'Environment :: Web Environment', u'Operating System :: OS Independent', u'Programming Language :: Python', ], data_files=[(u'share/timesketch', [u'timesketch.conf'])], packages=find_packages(), package_data={'timesketch.lib.experimental': ['*.cql'],}, include_package_data=True, zip_safe=False, scripts=[u'tsctl'], install_requires=[str(req.req) for req in parse_requirements( "requirements.txt", session=PipSession(), )], )
def test_incorrect_case_file_index(data): """Test PackageFinder detects latest using wrong case""" req = InstallRequirement.from_line('dinner', None) finder = PackageFinder([], [data.find_links3], session=PipSession()) link = finder.find_requirement(req, False) assert link.url.endswith("Dinner-2.0.tar.gz")
version=timesketch_version, description='Digital forensic timeline analysis', long_description=timesketch_description, license='Apache License, Version 2.0', url='http://www.timesketch.org/', maintainer='Timesketch development team', maintainer_email='*****@*****.**', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Operating System :: OS Independent', 'Programming Language :: Python', ], data_files=[ ('share/timesketch', glob.glob( os.path.join('data', '*'))), ('share/doc/timesketch', [ 'AUTHORS', 'LICENSE', 'README.md']), ], packages=find_packages(), include_package_data=True, zip_safe=False, entry_points={'console_scripts': ['tsctl=timesketch.tsctl:main']}, install_requires=[str(req.req) for req in parse_requirements( 'requirements.txt', session=PipSession(), )], tests_require=[str(req.req) for req in parse_requirements( 'test_requirements.txt', session=PipSession(), )], )
def parse_requirements_file(requirements_path): """ Parser requirements file """ install_reqs = parse_requirements(requirements_path, session=PipSession()) reqs = [str(ir.req) for ir in install_reqs] return reqs
from re import compile from ast import literal_eval from sys import argv, exit from json import dumps from setuptools import setup, find_packages, convert_path from pip._internal.req import parse_requirements from pip._internal.download import PipSession def get_reqs(reqs): return [str(ir.req) for ir in reqs] requirements = get_reqs( parse_requirements("orion-requirements.txt", session=PipSession())) if argv[-1] == "--requires": print(dumps(requirements)) exit() # Obtain version of the package _version_re = compile(r"__version__\s+=\s+(.*)") version_file = convert_path("./cubes/__init__.py") with open(version_file, "rb") as f: version = str( literal_eval(_version_re.search(f.read().decode("utf-8")).group(1))) setup( name="perses-orion", version=version,
def get_user_agent(): return PipSession().headers["User-Agent"]
def test_user_agent_user_data(monkeypatch): monkeypatch.setenv("PIP_USER_AGENT_USER_DATA", "some_string") assert "some_string" in PipSession().headers["User-Agent"]
def test_req_file_parse_no_only_binary(self, data, finder): list(parse_requirements( data.reqfiles.joinpath("supported_options2.txt"), finder, session=PipSession())) expected = FormatControl({'fred'}, {'wilma'}) assert finder.format_control == expected
from setuptools import setup, find_packages # from pip.download import PipSession # from pip.req import parse_requirements from pip._internal.download import PipSession from pip._internal.req import parse_requirements install_reqs = parse_requirements("requirements.txt", session=PipSession()) requires = [str(ir.req) for ir in install_reqs] setup( name='SGDBackend', version='0.0', description='SGDBackend', classifiers=[ "Programming Language :: Python", "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", ], author='', author_email='', url='', keywords='web pyramid pylons', packages=find_packages(), include_package_data=True, zip_safe=False, install_requires=requires, tests_require=requires, test_suite="sgdbackend", entry_points="""\ [paste.app_factory]
'processing where possible.') setup( name='turbinia', version=turbinia.__version__, description='Automation and Scaling of Digital Forensics Tools', long_description=turbinia_description, license='Apache License, Version 2.0', url='http://turbinia.plumbing/', maintainer='Turbinia development team', maintainer_email='*****@*****.**', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Operating System :: OS Independent', 'Programming Language :: Python', ], packages=find_packages(), include_package_data=True, zip_safe=False, entry_points={'console_scripts': ['turbiniactl=turbinia.turbiniactl:main']}, install_requires=[str(req.req) for req in parse_requirements( 'requirements.txt', session=PipSession()) ], extras_require={ 'dev': ['mock', 'nose', 'yapf'], 'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'], 'worker': ['plaso>=20171118', 'pyhindsight>=2.2.0'] } )
def test_finder_detects_latest_find_links(data): """Test PackageFinder detects latest using find-links""" req = InstallRequirement.from_line('simple', None) finder = PackageFinder([data.find_links], [], session=PipSession()) link = finder.find_requirement(req, False) assert link.url.endswith("simple-3.0.tar.gz")
def test_cache_defaults_off(self): session = PipSession() assert not hasattr(session.adapters["http://"], "cache") assert not hasattr(session.adapters["https://"], "cache")
import os from setuptools import setup try: # pip >= 10.0 from pip._internal.req import parse_requirements from pip._internal.download import PipSession except ImportError: # pip <= 9.0.3 from pip.req import parse_requirements from pip.download import PipSession req_file = os.path.join(os.path.dirname(__file__), 'requirements.txt') reqs = [str(r.req) for r in parse_requirements(req_file, session=PipSession())] setup( name='docker-flask-boilerplate', version='0.0.1', install_requires=reqs, packages=[], )
def test_http_cache_is_not_enabled(self, tmpdir): session = PipSession(cache=tmpdir.join("test-cache")) assert not hasattr(session.adapters["http://"], "cache")
def load_requirements(path: str) -> List[str]: install_reqs = parse_requirements(path, session=PipSession()) return [str(ir.req) for ir in install_reqs]
def test_user_agent(): PipSession().headers["User-Agent"].startswith("pip/%s" % pip.__version__)
from setuptools import setup, find_packages import os.path fullpath = os.path.abspath(os.path.dirname(__file__)) try: # for pip >= 10 from pip._internal.req import parse_requirements from pip._internal.download import PipSession except ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements from pip.download import PipSession requirements = [ str(_.req) for _ in parse_requirements( os.path.join(fullpath, "requirements.txt"), session=PipSession() ) ] with open("README.rst") as readme_file: readme = readme_file.read() with open("CHANGELOG") as changelog_file: changelog = changelog_file.read() setup_requirements = ["pytest-runner"] test_requirements = ["pytest"] setup( author="John Harrison",
# ######################################################################### import os try: # for pip >= 10 from pip._internal.req import parse_requirements from pip._internal.download import PipSession except ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements from pip.download import PipSession from distutils.core import setup from setuptools import find_packages # Parse requirements.txt to get the list of dependencies inst_req = parse_requirements('requirements.txt', session=PipSession()) REQUIREMENTS = [str(r.req) for r in inst_req] def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup( name="resilienceacademy", version="2.10.1", author="", author_email="", description="resilienceacademy, based on GeoNode", long_description=(read('README.md')), # Full list of classifiers can be found at:
from pip.req import parse_requirements from pip.download import PipSession try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup links = [] requires = [] # Compatibility with requirements.txt and setuptools bug with cryptography module if os.path.isfile('requirements.txt'): requirements = parse_requirements('requirements.txt', session=PipSession()) for item in requirements: if getattr(item, 'url', None): links.append(str(item.url)) if getattr(item, 'link', None): links.append(str(item.link)) if item.req: requires.append(str(item.req)) # run pyinstaller if sys.argv[-1] == 'pyinstaller': os.system('python build.py') sys.exit(0) # run pyinstaller on windows if sys.argv[-1] == 'windows':
def test_find_all_candidates_nothing(): """Find nothing without anything""" finder = PackageFinder([], [], session=PipSession()) assert not finder.find_all_candidates('pip')
######################################################################### import os import stat from codecs import open from distutils.core import setup from shutil import copyfile from setuptools import find_packages, setup from setuptools.command.install import install try: # for pip >= 10 from pip._internal.req import parse_requirements try: from pip._internal.download import PipSession pip_session = PipSession() except ImportError: # for pip >= 20 from pip._internal.network.session import PipSession pip_session = PipSession() except ImportError: # for pip <= 9.0.3 try: from pip.req import parse_requirements from pip.download import PipSession pip_session = PipSession() except ImportError: # backup in case of further pip changes pip_session = 'hack' # Parse requirements.txt to get the list of dependencies inst_req = parse_requirements('requirements.txt', session=pip_session) REQUIREMENTS = [str(r.req) for r in inst_req]
def test_find_all_candidates_find_links(data): finder = PackageFinder([data.find_links], [], session=PipSession()) versions = finder.find_all_candidates('simple') assert [str(v.version) for v in versions] == ['3.0', '2.0', '1.0']
version = read_version() if version.endswith(".dev"): _version = "%s%s" % (version, int(time.time())) else: _version = version try: long_description = open(os.path.join(_HERE, 'README.rst')).read() except IOError: long_description = None _packages = find_packages(where='authserver', exclude=["*.tests", "*.tests.*", "tests.*", "tests"]) pipsession = PipSession() reqs_generator = parse_requirements( os.path.join(os.path.abspath(os.path.dirname(__file__)), "requirements.txt"), session=pipsession ) # prepend setup.py's path (make no assumptions about cwd) reqs = [str(r.req) for r in reqs_generator] # on windows remove python-daemon if sys.platform == "win32": for r in reqs: if r.startswith("python-daemon"): reqs.remove(r) break _root_directory = "authserver"
def test_find_all_candidates_index(data): finder = PackageFinder([], [data.index_url('simple')], session=PipSession()) versions = finder.find_all_candidates('simple') assert [str(v.version) for v in versions] == ['1.0']
def test_find_all_candidates_find_links_and_index(data): finder = PackageFinder([data.find_links], [data.index_url('simple')], session=PipSession()) versions = finder.find_all_candidates('simple') # first the find-links versions then the page versions assert [str(v.version) for v in versions] == ['3.0', '2.0', '1.0', '1.0']
from setuptools import setup, find_packages from pip._internal.req import parse_requirements from pip._internal.download import PipSession requires_file = parse_requirements("requirements.txt", session=PipSession()) requires = [str(ir.req) for ir in requires_file] """ Full manual: https://setuptools.readthedocs.io/en/latest/setuptools.html """ setup( name="TutorialPackage", version="0.1", packages=find_packages(), # scripts=['say_hello.py'], # Project uses reStructuredText, so ensure that the docutils get # installed or upgraded on the target machine install_requires=[ 'PyYAML==5.1.2', 'scikit_learn@https://files.pythonhosted.org/packages/4d/73/7b6c17c3738de4c8fc42b626eb26e7756ef8624b0b8729d0820216932721/scikit_learn-0.21.3-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl' ], # install_requires=requires, package_data={ # If any package contains *.txt or *.rst files, include them: '': ['*.txt', '*.rst'], # And include any *.msg files found in the 'hello' package, too: 'hello': ['*.msg'], }, # metadata to display on PyPI author="Me", author_email="*****@*****.**",