<commit_before>#!/usr/bin/env python

import os
import sys
from setuptools import setup, find_packages
from setuptools.extension import Extension
import versioneer

requires = open("requirements.txt").read().strip().split("\n")
setup_requires = []
install_requires = []
extras_require = {}
for r in requires:
    if ";" in r:
        # requirements.txt conditional dependencies need to be reformatted for wheels
        # to the form: `'[extra_name]:condition' : ['requirements']`
        req, cond = r.split(";", 1)
        cond = ":" + cond
        cond_reqs = extras_require.setdefault(cond, [])
        cond_reqs.append(req)
    else:
        install_requires.append(r)

try:
    sys.argv.remove("--with-cython")
    cython = True
except ValueError:
    cython = False

ext_modules = []
if cython:
    try:
        import cython
    except ImportError:
        setup_requires.append("cython")

    cyext_modules = [
        Extension(
            "distributed.scheduler",
            sources=["distributed/scheduler.py"],
        ),
    ]
    for e in cyext_modules:
        e.cython_directives = {
            "annotation_typing": True,
            "binding": False,
            "embedsignature": True,
            "language_level": 3,<commit_msg>Provide `setup.py` option to profile Cython code (#4362)<commit_after>#!/usr/bin/env python

import os
import sys
from setuptools import setup, find_packages
from setuptools.extension import Extension
import versioneer

requires = open("requirements.txt").read().strip().split("\n")
setup_requires = []
install_requires = []
extras_require = {}
for r in requires:
    if ";" in r:
        # requirements.txt conditional dependencies need to be reformatted for wheels
        # to the form: `'[extra_name]:condition' : ['requirements']`
        req, cond = r.split(";", 1)
        cond = ":" + cond
        cond_reqs = extras_require.setdefault(cond, [])
        cond_reqs.append(req)
    else:
        install_requires.append(r)

cython_arg = None
for i in range(len(sys.argv)):
    if sys.argv[i].startswith("--with-cython"):
        cython_arg = sys.argv[i]
        del sys.argv[i]
        break

ext_modules = []
if cython_arg:
    try:
        import cython  # noqa: F401
    except ImportError:
        setup_requires.append("cython")

    profile = False
    try:
        _, param = cython_arg.split("=")
        profile = param == "profile"
    except ValueError:
        pass

    cyext_modules = [
        Extension(
            "distributed.scheduler",
            sources=["distributed/scheduler.py"],
        ),
    ]
    for e in cyext_modules:
        e.cython_directives = {
            "annotation_typing": True,
            "binding": False,
            "embedsignature": True,
            "language_level": 3,
            "profile": profile,
{'fraction_non_alphanumeric': 0.11988616150836001, 'fraction_numerical': 0.003913198150124511, 'mean_word_length': 2.48451053283767, 'pattern_counts': {'":': 11, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3119132', 'n_tokens_mistral': 869, 'n_tokens_neox': 836, 'n_words': 202}