def from_pipenv(): if os.path.exists(os.path.join(project_root, 'Pipfile')): from pipenv.project import Project from pipenv.utils import convert_deps_to_pip 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) return requirements, test_requirements else: return [], []
def _get_pipfile_requirements(tmpdir=None): try: from pipenv.utils import convert_deps_to_pip, prepare_pip_source_args except ImportError: raise ImportError('You need pipenv installed to deploy with Pipfile') try: with open('Pipfile.lock') as f: pipefile = json.load(f) deps = pipefile['default'] sources_list = prepare_pip_source_args( pipefile['_meta']['sources']) sources = ' '.join(sources_list) except IOError: raise ShubException('Please lock your Pipfile before deploying') # We must remove any hash from the pipfile before converting to play nice # with vcs packages for k, v in deps.items(): if 'hash' in v: del v['hash'] if 'hashes' in v: del v['hashes'] # Scrapy Cloud also doesn't support editable packages if 'editable' in v: del v['editable'] return open( _add_sources(convert_deps_to_pip(deps), _sources=sources.encode(), tmpdir=tmpdir), 'rb')
def rebuild(): os.system('pipenv lock') packages = Project().parsed_pipfile.get('packages', {}) deps = convert_deps_to_pip(packages, r=False) with open('requirements.txt', 'w') as f: print(deps) f.write('\n'.join(sorted(deps)))
def requirements_from_pipfile_lock(pipfile_lock): from pipenv.utils import convert_deps_to_pip with open(pipfile_lock) as f: deps = json.load(f)['default'] # remove local project it will be handled later for k, v in list(deps.items()): if v.get('path') == '.': del (deps[k]) return convert_deps_to_pip(deps)
def get_requirements(remove_links=True): """ lists the requirements to install. """ requirements = [] 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) if remove_links: for requirement in requirements: # git repository url if requirement.startswith("git+"): requirements.remove(requirement) # subversion repository url. if requirement.startswith("svn+"): requirements.remove(requirement) # mercurial repository url. if requirement.startswith("hg+"): requirements.remove(requirement) return requirements
def _get_pipfile_requirements(): try: from pipenv.utils import convert_deps_to_pip except ImportError: raise ImportError('You need pipenv installed to deploy with Pipfile') try: with open('Pipfile.lock') as f: deps = json.load(f)['default'] except IOError: raise ShubException('Please lock your Pipfile before deploying') return convert_deps_to_pip(deps)
def run(): # https://github.com/pypa/pipenv/issues/1593 import json from pipenv.utils import convert_deps_to_pip with open('Pipfile.lock') as f: deps = json.load(f)['default'] # remove local project which wouldn't have a hash for k, v in list(deps.items()): if v.get('path') == '.': del (deps[k]) path_to_requirements_file_with_hashes = convert_deps_to_pip(deps) with open('requirements.txt', 'w') as reqf, \ open(path_to_requirements_file_with_hashes) as hashf: reqs = hashf.read() reqf.write(reqs) sys.exit()
def _get_pipfile_requirements(): try: from pipenv.utils import convert_deps_to_pip except ImportError: raise ImportError('You need pipenv installed to deploy with Pipfile') try: with open('Pipfile.lock') as f: deps = json.load(f)['default'] except IOError: raise ShubException('Please lock your Pipfile before deploying') # We must remove any hash from the pipfile before converting to play nice # with vcs packages for k, v in deps.items(): if 'hash' in v: del v['hash'] if 'hashes' in v: del v['hashes'] # Scrapy Cloud also doesn't support editable packages if 'editable' in v: del v['editable'] return open(convert_deps_to_pip(deps), 'rb')
def _get_pipfile_requirements(): try: from pipenv.utils import convert_deps_to_pip except ImportError: raise ImportError('You need pipenv installed to deploy with Pipfile') try: with open('Pipfile.lock') as f: deps = json.load(f)['default'] except IOError: raise ShubException('Please lock your Pipfile before deploying') # We must remove any hash from the pipfile before converting to play nice # with vcs packages for k, v in deps.items(): if 'hash' in v: del v['hash'] if 'hashes' in v: del v['hashes'] # Scrapy Cloud also doesn't support editable packages if 'editable' in v: del v['editable'] return convert_deps_to_pip(deps)
import setuptools import gamelib.Constants as Constants try: from pipenv.project import Project from pipenv.utils import convert_deps_to_pip except ImportError: print("Please install pipenv first. See: https://github.com/pypa/pipenv") with open("README.md", "r") as fh: long_description = fh.read() # Compatibility layer between Pipenv and Pip requirements.txt # See https://github.com/pypa/pipenv/issues/209 pipfile = Project(chdir=False).parsed_pipfile requirements_path = convert_deps_to_pip(pipfile['packages']) INSTALL_PACKAGES = open(requirements_path).read().splitlines() setuptools.setup( name="hac-game-lib", version=Constants.HAC_GAME_LIB_VERSION, author="Arnaud Dupuis", author_email="*****@*****.**", description="A small game development framework for teaching \ programming to young kids.", long_description=long_description, long_description_content_type="text/markdown", install_requires=['colorama >= 0.3.8'], url="https://astro.hyrul.es", packages=setuptools.find_packages(),
from pipenv.project import Project from pipenv.utils import convert_deps_to_pip from setuptools import setup import meican with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() setup( name="meican", version=meican.__version__, description="UNOFFICIAL meican command line / sdk", long_description=long_description, long_description_content_type="text/markdown", author="Lirian Su", author_email="*****@*****.**", url="https://github.com/LKI/meican", license="MIT License", entry_points={"console_scripts": ["meican = meican.cmdline:execute"]}, packages=["meican"], install_requires=convert_deps_to_pip(Project(chdir=False).parsed_pipfile["packages"], r=False), )
import os from setuptools import setup, find_packages install_reqs = list() # Use pipenv for dependencies, setuptools otherwise. # This makes the installation for the packages easier (no pipenv needed) try: from pipenv.project import Project from pipenv.utils import convert_deps_to_pip pfile = Project(chdir=False).parsed_pipfile install_reqs = convert_deps_to_pip(pfile['packages'], r=False) except ImportError: try: from pip.req import parse_requirements except ImportError: from pip._internal.req import parse_requirements install_reqs = [str(ir.req) for ir in parse_requirements( './requirements.txt', session=False)] def exists(fname): return os.path.exists(os.path.join(os.path.dirname(__file__), fname)) # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path.join(os.path.dirname(__file__), fname),
import os from pipenv.project import Project from pipenv.utils import convert_deps_to_pip from setuptools import setup, find_packages pipfile = Project().parsed_pipfile requirements = convert_deps_to_pip(pipfile["packages"], r=False) if os.environ.get("USER", "") == "vagrant": del os.link DESCRIPTION = "Simple git based wiki" with open("README.md") as f: LONG_DESCRIPTION = f.read() __version__ = None exec(open("realms3/version.py").read()) CLASSIFIERS = [ "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", ] setup( name="realms3", version=__version__, packages=find_packages(),
def run(self): """Run tests.""" self.run_command("test_rust") import subprocess subprocess.check_call(["pytest", "tests"]) setup_requires = ["setuptools-rust>=0.10.1", "wheel"] install_requires: typing.List[str] = [] # tests_require = install_requires + ["pytest", "pytest-benchmark"] pfile = Project(chdir=False).parsed_pipfile # install_requires = convert_deps_to_pip(pfile["packages"], r=False) tests_require = convert_deps_to_pip(pfile["dev-packages"], r=False) setuptools.setup( name="pip-crev", version="0.1.0", classifiers=[ "License :: OSI Approved :: MIT License", "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Rust", "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", ], packages=["pip_crev", "crev"], rust_extensions=[
VERSION = "0.78.0" # 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)
def requirements(): pipfile = Project(chdir=False).parsed_pipfile return convert_deps_to_pip(pipfile['packages'], r=False)
from setuptools import setup from pipenv.project import Project from pipenv.utils import convert_deps_to_pip import os def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() pipfile = Project(chdir=False).parsed_pipfile setup(name="maglev", version="2.0.0", author="Jeremy Potter", author_email="*****@*****.**", description=("PHP-like Async/IO web framework"), long_description=read("README.md"), long_description_content_type="text/markdown", license="GNU", keywords="web framework mako async asyncio", url="https://github.com/jwinnie/Maglev", install_requires=convert_deps_to_pip(pipfile["packages"], r=False), packages=["server"], scripts=["maglev"])
from setuptools import setup, find_packages from pipenv.project import Project from pipenv.utils import convert_deps_to_pip 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) setup( name="burnysc2", packages=find_packages(exclude=["examples*", "examples"]), version="4.11.11", description="A StarCraft II API Client for Python 3", license="MIT", author="BurnySc2", author_email="*****@*****.**", url="https://github.com/Burnysc2/python-sc2", keywords=["StarCraft", "StarCraft 2", "StarCraft II", "AI", "Bot"], setup_requires=["pipenv"], install_requires=requirements, classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "Topic :: Games/Entertainment", "Topic :: Games/Entertainment :: Real Time Strategy", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "License :: OSI Approved :: MIT License",
import os from pipenv.project import Project from pipenv.utils import convert_deps_to_pip from setuptools import setup, find_packages pipfile = Project().parsed_pipfile requirements = convert_deps_to_pip(pipfile['packages'], r=False) if os.environ.get('USER', '') == 'vagrant': del os.link DESCRIPTION = "Simple git based wiki" with open('README.md') as f: LONG_DESCRIPTION = f.read() __version__ = None exec(open('realms/version.py').read()) CLASSIFIERS = [ 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content'] setup(name='realms-wiki', version=__version__, packages=find_packages(), install_requires=requirements, entry_points={
def get_requirements(): pfile = Project(chdir=False).parsed_pipfile requirements = convert_deps_to_pip(pfile["packages"], r=False) return requirements
from pipenv.utils import convert_deps_to_pip pfile = Project(chdir=False).parsed_pipfile # Package meta-data. NAME = 'ubee_router_reset' DESCRIPTION = 'Reset ubee router automatically by checking if internet is up then'\ 'restoring backup settings automatically using selenium.' URL = 'https://github.com/aaronsewall/ubee_router_reset' EMAIL = '*****@*****.**' AUTHOR = 'Aaron Sewall' REQUIRES_PYTHON = '>=3.0' VERSION = None # What packages are required for this module to be executed? REQUIRED = convert_deps_to_pip(pfile['packages'], r=False) # What packages are optional? EXTRAS = { 'dev': convert_deps_to_pip(pfile['dev-packages'], r=False), } # The rest you shouldn't have to touch too much :) # ------------------------------------------------ # Except, perhaps the License and Trove Classifiers! # If you do change the License, remember to change the Trove Classifier for that! here = os.path.abspath(os.path.dirname(__file__)) # Import the README and use it as the long-description. # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
from setuptools import setup, find_packages from codecs import open from os import path from pipenv.project import Project from pipenv.utils import convert_deps_to_pip 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) here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name='sucks', version='0.8.1', description='a library for controlling certain robot vacuums', long_description=long_description, url='https://github.com/wpietri/sucks', # Author details author='William Pietri', author_email='*****@*****.**',
#!/usr/bin/env python # based on https://github.com/pypa/pipenv/issues/245 from pipenv.project import Project from pipenv.utils import convert_deps_to_pip # Create pip-compatible dependency list packages = Project().parsed_pipfile.get('packages', {}) deps = convert_deps_to_pip(packages, r=False) with open('requirements.txt', 'w') as f: f.write('\n'.join(deps))
def get_packages_from_Pipfile(): pipfile = Project(chdir=False).parsed_pipfile return convert_deps_to_pip(pipfile['packages'], r=False)
from pipenv.project import Project from pipenv.utils import convert_deps_to_pip from setuptools import find_packages, setup __build__ = 0 __version__ = f'2.0.0.{__build__}' pfile = Project(chdir=False).parsed_pipfile setup(name='geostream', author='Donna Okazaki', author_email='*****@*****.**', version=__version__, python_requires='~=3.6', package_data={'geostream': ['py.typed']}, packages=find_packages(exclude=['tests', 'tests.*']), install_requires=convert_deps_to_pip(pfile['packages'], r=False), tests_require=convert_deps_to_pip(pfile['dev-packages'], r=False), entry_points=dict(console_scripts=['unpack_gjz = geostream.cli:cli']))
import os from setuptools import setup, find_packages install_reqs = list() # Use pipenv for dependencies, setuptools otherwise. # This makes the installation for the packages easier (no pipenv needed) try: from pipenv.project import Project from pipenv.utils import convert_deps_to_pip pfile = Project(chdir=False).parsed_pipfile install_reqs = convert_deps_to_pip(pfile['packages'], r=False) except ImportError: try: from pip.req import parse_requirements except ImportError: from pip._internal.req import parse_requirements install_reqs = [ str(ir.req) for ir in parse_requirements('./requirements.txt', session=False) ] def exists(fname): return os.path.exists(os.path.join(os.path.dirname(__file__), fname)) # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ...
from setuptools import setup try: import pipenv except ImportError: print('pipenv not installed for current python') print('using vendored version in ./.vendor/') import sys sys.path.append('.vendor') finally: from pipenv.project import Project from pipenv.utils import convert_deps_to_pip # get requirements from Pipfile pfile = Project(chdir=False).parsed_pipfile default = convert_deps_to_pip(pfile['packages'], r=False) development = convert_deps_to_pip(pfile['dev-packages'], r=False) setup( install_requires=default, tests_require=development, extras_require={ 'dev': development, 'development': development, 'test': development, 'testing': development, }, entry_points={ 'console_scripts': ['run=run:main', 'python_boilerplate=python_boilerplate.cli:main'] },
from setuptools import setup, find_packages from pipenv.project import Project from pipenv.utils import convert_deps_to_pip 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) setup(name="sc2", packages=find_packages(), version="0.10.9", description="A StarCraft II API Client for Python 3", license="MIT", author="Hannes Karppila", author_email="*****@*****.**", url="https://github.com/Dentosal/python-sc2", keywords=["StarCraft", "StarCraft 2", "StarCraft II", "AI", "Bot"], setup_requires=["pipenv"], install_requires=requirements, classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Science/Research", "Topic :: Games/Entertainment", "Topic :: Games/Entertainment :: Real Time Strategy", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3",
#!/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',
def list_dependencies(pipfile): return convert_deps_to_pip(pipfile['packages'], r=False)
# overwrites requirements/{install,dev}_requirements.txt without asking! from pipenv.project import Project from pipenv.utils import convert_deps_to_pip pfile = Project(chdir=False).parsed_pipfile requirements = sorted(convert_deps_to_pip(pfile['packages'], r=False)) dev_requirements = sorted(convert_deps_to_pip(pfile['dev-packages'], r=False)) with open("generated_requirements/install_requirements.txt", "w") as wf: for line in requirements: wf.write(line + "\n") with open("generated_requirements/dev_requirements.txt", "w") as wf: for line in dev_requirements: if not line.startswith("-e ."): wf.write(line + "\n")