Python setuptools.find_packages() Examples
The following are 30 code examples for showing how to use setuptools.find_packages(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
setuptools
, or try the search function
.
Example 1
Project: peony-twitter Author: odrling File: setup.py License: MIT License | 6 votes |
def main(): if sys.version_info < (3, 5, 3): raise RuntimeError("Peony requires Python 3.5.3+") dirname = os.path.dirname(inspect.getfile(inspect.currentframe())) # get metadata and keywords from peony/__init__.py kwargs = get_metadata(os.path.join(dirname, 'peony', '__init__.py')) # get requirements from requirements.txt kwargs.update(get_requirements(os.path.join(dirname, 'requirements.txt'))) # get extras requirements from extras_require.txt extras = os.path.join(dirname, 'extras_require.txt') extras_require = get_requirements(extras) # get long description from README.md with open('README.rst') as stream: long_description = stream.read() setup(long_description=long_description, packages=find_packages(include=["peony*"]), extras_require=extras_require, python_requires='>=3.5.3', **kwargs)
Example 2
Project: python-netsurv Author: sofia-netsurv File: config.py License: MIT License | 6 votes |
def _parse_packages(self, value): """Parses `packages` option value. :param value: :rtype: list """ find_directive = 'find:' if not value.startswith(find_directive): return self._parse_list(value) # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) from setuptools import find_packages return find_packages(**find_kwargs)
Example 3
Project: python-netsurv Author: sofia-netsurv File: config.py License: MIT License | 6 votes |
def _parse_packages(self, value): """Parses `packages` option value. :param value: :rtype: list """ find_directive = 'find:' if not value.startswith(find_directive): return self._parse_list(value) # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) from setuptools import find_packages return find_packages(**find_kwargs)
Example 4
Project: mobly Author: google File: setup.py License: Apache License 2.0 | 6 votes |
def main(): setuptools.setup( name='mobly', version='1.10', maintainer='Ang Li', maintainer_email='mobly-github@googlegroups.com', description='Automation framework for special end-to-end test cases', license='Apache2.0', url='https://github.com/google/mobly', download_url='https://github.com/google/mobly/tarball/1.10', packages=setuptools.find_packages(exclude=['tests']), include_package_data=False, scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'], tests_require=[ 'mock', # Needed for supporting Python 2 because this release stopped supporting Python 2. 'pytest<5.0.0', 'pytz', ], install_requires=install_requires, cmdclass={'test': PyTest}, )
Example 5
Project: Deep-Learning-with-TensorFlow-Second-Edition Author: PacktPublishing File: setup.py License: MIT License | 6 votes |
def main(): setup( name='tffm', version='1.0.0a1', author="Mikhail Trofimov", author_email="mikhail.trofimov@phystech.edu", url='https://github.com/geffy/tffm', description=('TensforFlow implementation of arbitrary order ' 'Factorization Machine'), classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Science/Research', 'Topic :: Scientific/Engineering', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', ], license='MIT', install_requires=[ 'scikit-learn', 'numpy', 'tqdm' ], packages=find_packages() )
Example 6
Project: fftoptionlib Author: arraystream File: setup.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def main(): setup(name='fftoptionlib', version=__version__, author='ArrayStream (Yu Zheng, Ran Fan)', author_email='team@arraystream.com', url='https://github.com/arraystream/fftoptionlib', description='FFT-based Option Pricing Method in Python', long_description='FFT-based Option Pricing Method in Python', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Topic :: Scientific/Engineering :: Mathematics', 'Intended Audience :: Financial and Insurance Industry' ], license='BSD', packages=find_packages(include=['fftoptionlib']), install_requires=['numpy', 'scipy', 'pandas', 'autograd'], platforms='any')
Example 7
Project: anpr Author: italia File: config.py License: Creative Commons Attribution 4.0 International | 6 votes |
def _parse_packages(self, value): """Parses `packages` option value. :param value: :rtype: list """ find_directive = 'find:' if not value.startswith(find_directive): return self._parse_list(value) # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) from setuptools import find_packages return find_packages(**find_kwargs)
Example 8
Project: Safejumper-for-Desktop Author: proxysh File: config.py License: GNU General Public License v2.0 | 6 votes |
def _parse_packages(self, value): """Parses `packages` option value. :param value: :rtype: list """ find_directive = 'find:' if not value.startswith(find_directive): return self._parse_list(value) # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) from setuptools import find_packages return find_packages(**find_kwargs)
Example 9
Project: pytest Author: pytest-dev File: test_doctest.py License: MIT License | 6 votes |
def test_valid_setup_py(self, testdir): """ Test to make sure that pytest ignores valid setup.py files when ran with --doctest-modules """ p = testdir.makepyfile( setup=""" from setuptools import setup, find_packages setup(name='sample', version='0.0', description='description', packages=find_packages() ) """ ) result = testdir.runpytest(p, "--doctest-modules") result.stdout.fnmatch_lines(["*collected 0 items*"])
Example 10
Project: ccs-twistedextensions Author: apple File: setup.py License: Apache License 2.0 | 6 votes |
def find_packages(): modules = [ "twisted.plugins", ] def is_package(path): return ( os.path.isdir(path) and os.path.isfile(os.path.join(path, "__init__.py")) ) for pkg in filter(is_package, os.listdir(".")): modules.extend([pkg, ] + [ "{}.{}".format(pkg, subpkg) for subpkg in setuptools_find_packages(pkg) ]) return modules
Example 11
Project: telegram-robot-rss Author: cbrgm File: config.py License: Mozilla Public License 2.0 | 6 votes |
def _parse_packages(self, value): """Parses `packages` option value. :param value: :rtype: list """ find_directive = 'find:' if not value.startswith(find_directive): return self._parse_list(value) # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) from setuptools import find_packages return find_packages(**find_kwargs)
Example 12
Project: pylti Author: mitodl File: setup.py License: BSD 2-Clause "Simplified" License | 6 votes |
def convert_path(pathname): """ Local copy of setuptools.convert_path used by find_packages (only used with distutils which is missing the find_packages feature) """ if os.sep == '/': return pathname if not pathname: return pathname if pathname[0] == '/': raise ValueError("path '%s' cannot be absolute" % pathname) if pathname[-1] == '/': raise ValueError("path '%s' cannot end with '/'" % pathname) paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return os.path.join(*paths)
Example 13
Project: pylti Author: mitodl File: setup.py License: BSD 2-Clause "Simplified" License | 6 votes |
def find_packages(where='.', exclude=()): """ Local copy of setuptools.find_packages (only used with distutils which is missing the find_packages feature) """ out = [] stack = [(convert_path(where), '')] while stack: where, prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where, name) isdir = os.path.isdir(fn) has_init = os.path.isfile(os.path.join(fn, '__init__.py')) if '.' not in name and isdir and has_init: out.append(prefix + name) stack.append((fn, prefix + name + '.')) for pat in list(exclude) + ['ez_setup', 'distribute_setup']: from fnmatch import fnmatchcase out = [item for item in out if not fnmatchcase(item, pat)] return out
Example 14
Project: hue-python-rgb-converter Author: benknight File: setup.py License: MIT License | 6 votes |
def setup_package(): # Some helper variables version = VERSION install_reqs=[], setup( name=NAME, version=version, url=URL, description=DESCRIPTION, author=AUTHOR, author_email=EMAIL, license=LICENSE, keywords='philips hue light rgb xy', packages=setuptools.find_packages(), install_requires=install_reqs )
Example 15
Project: fine-lm Author: akzaidi File: cloud_mlengine.py License: MIT License | 5 votes |
def get_setup_file(name, packages=None): if not packages: packages = [] return """ from setuptools import find_packages from setuptools import setup setup( name="{name}", version="0.1", packages=find_packages(), install_requires={pypi_packages} ) """.format(name=name, pypi_packages=str(list(packages)))
Example 16
Project: pymoo Author: msu-coinlab File: setup.py License: Apache License 2.0 | 5 votes |
def packages(): return ["pymoo"] + ["pymoo." + e for e in setuptools.find_packages(where='pymoo')]
Example 17
Project: mdentropy Author: msmbuilder File: setup.py License: MIT License | 5 votes |
def main(**kwargs): write_version_py(VERSION, ISRELEASED, 'mdentropy/version.py') setup( name=NAME, version=VERSION, platforms=("Windows", "Linux", "Mac OS-X", "Unix",), classifiers=( 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Operating System :: Unix', 'Operating System :: MacOS', 'Operating System :: Microsoft :: Windows', 'Topic :: Information Analysis', ), keywords="molecular dynamics entropy analysis", author="Carlos Xavier Hernández", author_email="cxh@stanford.edu", url='https://github.com/msmbuilder/%s' % NAME, download_url='https://github.com/msmbuilder/%s/tarball/master' % NAME, license='MIT', packages=find_packages(), include_package_data=True, package_data={ '': ['README.md', 'requirements.txt'], }, zip_safe=False, entry_points={ 'console_scripts': [ 'mdent = mdentropy.cli.main:main', ], }, **kwargs )
Example 18
Project: py Author: pytest-dev File: setup.py License: MIT License | 5 votes |
def main(): setup( name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description=open('README.rst').read(), use_scm_version={"write_to": "py/_version.py"}, setup_requires=["setuptools-scm"], url='https://py.readthedocs.io/', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', author='holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others', author_email='pytest-dev@python.org', classifiers=['Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Operating System :: MacOS :: MacOS X', 'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Libraries', 'Topic :: Utilities', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], packages=find_packages(exclude=['tasks', 'testing']), include_package_data=True, zip_safe=False, package_data={ "": ["py.typed"], }, )
Example 19
Project: Fragscapy Author: AMOSSYS File: setup.py License: MIT License | 5 votes |
def find_packages(where='.'): # os.walk -> list[(dirname, list[subdirs], list[files])] return [folder.replace("/", ".").lstrip(".") for (folder, _, fils) in os.walk(where) if "__init__.py" in fils]
Example 20
Project: feets Author: quatrope File: setup.py License: MIT License | 5 votes |
def do_setup(): setup( name=feets.NAME, version=feets.VERSION, long_description=feets.DOC, description=feets.DOC.splitlines()[0], author=feets.AUTHORS, author_email=feets.EMAIL, url=feets.URL, license=feets.LICENSE, keywords=list(feets.KEYWORDS), package_data={"feets.tests.data": ["tests/data/*.*"]}, include_package_data=True, classifiers=[ "Development Status :: 4 - Beta", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering", ], packages=[pkg for pkg in find_packages() if pkg.startswith("feets")], py_modules=["ez_setup"], install_requires=REQUIREMENTS, )
Example 21
Project: spotify-tensorflow Author: spotify File: utils.py License: Apache License 2.0 | 5 votes |
def create_setup_file(): lib_version = VersionInfo("spotify_tensorflow").version_string() contents_for_setup_file = """ import setuptools if __name__ == "__main__": setuptools.setup( name="spotify_tensorflow_dataflow", packages=setuptools.find_packages(), install_requires=[ "spotify-tensorflow=={version}" ]) """.format(version=lib_version) # noqa: W293 setup_file_path = os.path.join(tempfile.mkdtemp(), "setup.py") with open(setup_file_path, "w") as f: f.writelines(textwrap.dedent(contents_for_setup_file)) return setup_file_path
Example 22
Project: prediction-flow Author: GitHub-HongweiZhang File: setup.py License: MIT License | 5 votes |
def setup_package(): setup( name=DISTNAME, packages=find_packages(), maintainer=MAINTAINER, maintainer_email=MAINTAINER_EMAIL, description=DESCRIPTION, url=URL, version=VERSION, long_description=LONG_DESCRIPTION, long_description_content_type="text/markdown", python_requires='>=3.6', include_package_data=True, install_requires=INSTALL_REQUIRES, classifiers=( 'Development Status :: 3 - Alpha', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Intended Audience :: Science/Research', 'Intended Audience :: Developers', 'Intended Audience :: Education', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Topic :: Software Development', 'Topic :: Scientific/Engineering', ), license=LICENSE, keywords=[ 'torch', 'ctr prediction', 'deep learning', 'deepfm', 'din', 'dnn', 'deep neural network'] )
Example 23
Project: adam_qas Author: 5hirish File: setup.py License: GNU General Public License v3.0 | 5 votes |
def setup_package(): base_dir = os.path.abspath(os.path.dirname(__file__)) with chdir(base_dir): with io.open(os.path.join(base_dir, 'qas', 'about.py'), encoding='utf8') as fp: about = {} exec(fp.read(), about) with io.open(os.path.join(base_dir, 'README.rst'), encoding='utf8') as f: readme = f.read() setup(name=about['__title__'], packages=find_packages(), description=about['__summary__'], long_description=readme, version=about['__version__'], author=about['__author__'], author_email=about['__email__'], url=about['__uri__'], license=about['__license__'], # TODO change the signs from '>=' to '==' like we did on adam_qas/requirements.txt install_requires=[ "autocorrect>=0.3.0", "gensim>=3.0.1", "lxml>=4.1.0", "pandas>=0.21", "pyenchant>=2.0.0", "requests>=2.18.0", "spaCy>=2.0.3", "scikit-learn>=v0.19.1", "wikipedia>=1.4.0"] )
Example 24
Project: pledgeservice Author: MayOneUS File: test_find_packages.py License: Apache License 2.0 | 5 votes |
def test_regular_package(self): self._touch('__init__.py', self.pkg_dir) packages = find_packages(self.dist_dir) self.assertEqual(packages, ['pkg', 'pkg.subpkg'])
Example 25
Project: pledgeservice Author: MayOneUS File: test_find_packages.py License: Apache License 2.0 | 5 votes |
def test_exclude(self): self._touch('__init__.py', self.pkg_dir) packages = find_packages(self.dist_dir, exclude=('pkg.*',)) assert packages == ['pkg']
Example 26
Project: pledgeservice Author: MayOneUS File: test_find_packages.py License: Apache License 2.0 | 5 votes |
def test_include_excludes_other(self): """ If include is specified, other packages should be excluded. """ self._touch('__init__.py', self.pkg_dir) alt_dir = self._mkdir('other_pkg', self.dist_dir) self._touch('__init__.py', alt_dir) packages = find_packages(self.dist_dir, include=['other_pkg']) self.assertEqual(packages, ['other_pkg'])
Example 27
Project: pledgeservice Author: MayOneUS File: test_find_packages.py License: Apache License 2.0 | 5 votes |
def test_dir_with_dot_is_skipped(self): shutil.rmtree(os.path.join(self.dist_dir, 'pkg/subpkg/assets')) data_dir = self._mkdir('some.data', self.pkg_dir) self._touch('__init__.py', data_dir) self._touch('file.dat', data_dir) packages = find_packages(self.dist_dir) self.assertTrue('pkg.some.data' not in packages)
Example 28
Project: pledgeservice Author: MayOneUS File: test_find_packages.py License: Apache License 2.0 | 5 votes |
def test_dir_with_packages_in_subdir_is_excluded(self): """ Ensure that a package in a non-package such as build/pkg/__init__.py is excluded. """ build_dir = self._mkdir('build', self.dist_dir) build_pkg_dir = self._mkdir('pkg', build_dir) self._touch('__init__.py', build_pkg_dir) packages = find_packages(self.dist_dir) self.assertTrue('build.pkg' not in packages)
Example 29
Project: lambda-packs Author: ryfeus File: config.py License: MIT License | 5 votes |
def _parse_packages(self, value): """Parses `packages` option value. :param value: :rtype: list """ find_directives = ['find:', 'find_namespace:'] trimmed_value = value.strip() if trimmed_value not in find_directives: return self._parse_list(value) findns = trimmed_value == find_directives[1] if findns and not PY3: raise DistutilsOptionError( 'find_namespace: directive is unsupported on Python < 3.3') # Read function arguments from a dedicated section. find_kwargs = self.parse_section_packages__find( self.sections.get('packages.find', {})) if findns: from setuptools import find_namespace_packages as find_packages else: from setuptools import find_packages return find_packages(**find_kwargs)
Example 30
Project: setuptools-odoo Author: acsone File: core.py License: GNU Lesser General Public License v3.0 | 5 votes |
def _setuptools_find_packages(odoo_version_info): # setuptools.find_package() does not find namespace packages # without __init__.py, apparently, so work around that pkg = setuptools.find_packages() if odoo_version_info["addons_ns"] not in pkg: pkg.append(odoo_version_info["addons_ns"]) return pkg