How to use the pyperformance.__version__ function in pyperformance

To help you get started, we’ve selected a few pyperformance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python / pyperformance / pyperformance / cli_run.py View on Github external
def cmd_run(parser, options):
    logging.basicConfig(level=logging.INFO)

    print("Python benchmark suite %s" % pyperformance.__version__)
    print()

    if options.output and os.path.exists(options.output):
        print("ERROR: the output file %s already exists!" % options.output)
        sys.exit(1)

    if hasattr(options, 'python'):
        executable = options.python
    else:
        executable = sys.executable
    if not os.path.isabs(executable):
        print("ERROR: \"%s\" is not an absolute path" % executable)
        sys.exit(1)
    bench_funcs, bench_groups, should_run = get_benchmarks_to_run(options)
    cmd_prefix = [executable]
    suite, errors = run_benchmarks(bench_funcs, should_run, cmd_prefix, options)
github python / pyperformance / pyperformance / venv.py View on Github external
implementation = sys.implementation.name.lower()

            if not isinstance(data, bytes):
                data = data.encode('utf-8')
            with open(requirements, 'rb') as fp:
                data += fp.read()
            sha1 = hashlib.sha1(data).hexdigest()

            name = ('%s%s.%s-%s'
                    % (implementation, pyver.major, pyver.minor, sha1[:12]))
            print(name)
        """)

        requirements = os.path.join(PERFORMANCE_ROOT, 'requirements.txt')
        cmd = (self.python, '-c', script,
               pyperformance.__version__, requirements)
        proc = subprocess.Popen(cmd,
                                stdout=subprocess.PIPE,
                                universal_newlines=True)
        stdout = proc.communicate()[0]
        if proc.returncode:
            print("ERROR: failed to create the name of the virtual environment")
            sys.exit(1)

        venv_name = stdout.rstrip()
        self._venv_path = venv_path = os.path.join('venv', venv_name)
        return venv_path
github python / pyperformance / pyperformance / venv.py View on Github external
self.run_cmd(cmd)

        # install optional requirements
        for req in requirements.optional:
            cmd = pip_program + ['install', '-U', req]
            exitcode = self.run_cmd_nocheck(cmd)
            if exitcode:
                print("WARNING: failed to install %s" % req)
                print()

        # install pyperformance inside the virtual environment
        if is_build_dir():
            root_dir = os.path.dirname(PERFORMANCE_ROOT)
            cmd = pip_program + ['install', '-e', root_dir]
        else:
            version = pyperformance.__version__
            cmd = pip_program + ['install', 'pyperformance==%s' % version]
        self.run_cmd(cmd)

        # Display the pip version
        cmd = pip_program + ['--version']
        self.run_cmd(cmd)

        # Dump the package list and their versions: pip freeze
        cmd = pip_program + ['freeze']
        self.run_cmd(cmd)
github python / pyperformance / pyperformance / run.py View on Github external
def add_bench(dest_suite, obj):
            if isinstance(obj, pyperf.BenchmarkSuite):
                benchmarks = obj
            else:
                benchmarks = (obj,)

            version = pyperformance.__version__
            for bench in benchmarks:
                bench.update_metadata({'performance_version': version})

                if dest_suite is not None:
                    dest_suite.add_benchmark(bench)
                else:
                    dest_suite = pyperf.BenchmarkSuite([bench])

            return dest_suite
github python / pyperformance / setup.py View on Github external
#  - git tag VERSION
#  - git push --tags
#  - Remove untracked files/dirs: git clean -fdx
#  - python3 setup.py sdist bdist_wheel
#  - twine upload dist/*
#
# After the release:
#
#  - set version to n+1: pyperformance/__init__.py and doc/conf.py
#  - git commit -a -m "post-release"
#  - git push

# Import just to get the version
import pyperformance

VERSION = pyperformance.__version__

DESCRIPTION = 'Python benchmark suite'
CLASSIFIERS = [
    'Development Status :: 5 - Production/Stable',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
    'Natural Language :: English',
    'Operating System :: OS Independent',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python',
]


# put most of the code inside main() to be able to import setup.py in
# unit tests
def main():
github python / pyperformance / pyperformance / compile.py View on Github external
def install_performance(self):
        cmd = [self.program, '-u', '-m', 'pip', 'install']

        if is_build_dir():
            root_dir = os.path.dirname(PERFORMANCE_ROOT)
            cmd.extend(('-e', root_dir))
        else:
            version = pyperformance.__version__
            cmd.append('pyperformance==%s' % version)

        self.run(*cmd)