<commit_before>---
title:  "Working with the CLASS python wrapper"
date:   2016-09-12 19:26:00
categories: [class]
tags: [class]
---

Getting the Python wrapper to work with [CLASS][classcode] takes a little off roading, but it's an easy adventure. After downloading the code, I used `make all` to produce all of the library files. However, because I'm using Anaconda on Linux, the math library `m` is not automatically linked. In setup.py, I had the following block:

```python
setup(
    name='classy',
    version=VERSION,
    description='Python interface to the Cosmological Boltzmann code CLASS',
    url='http://www.class-code.net',
    cmdclass={'build_ext': build_ext},
    ext_modules=[Extension("classy", ["classy.pyx"],
                           include_dirs=[nm.get_include(), "../include"],
                           libraries=["class", "m"],
                           library_dirs=["../", GCCPATH],
                           extra_link_args=['-lgomp'],
                           )],
    data_files=(('bbn', ['../bbn/sBBN.dat']),)
)<commit_msg>post update#<commit_after>---
title:  "Working with the CLASS python wrapper"
date:   2016-09-12 19:26:00
categories: [class]
tags: [class]
---
**Update:** *After testing this on my office computer, it looks my problems were unique to my laptop's Python configuration. It shouldn't happen for most users.*

Getting the Python wrapper to work with [CLASS][classcode] takes a little off roading, but it's an easy adventure. After downloading the code, I used `make all` to produce all of the library files. However, because I'm using Anaconda on Linux, the math library `m` is not automatically linked. In setup.py, I had the following block:

```python
setup(
    name='classy',
    version=VERSION,
    description='Python interface to the Cosmological Boltzmann code CLASS',
    url='http://www.class-code.net',
    cmdclass={'build_ext': build_ext},
    ext_modules=[Extension("classy", ["classy.pyx"],
                           include_dirs=[nm.get_include(), "../include"],
                           libraries=["class", "m"],
                           library_dirs=["../", GCCPATH],
                           extra_link_args=['-lgomp'],
                           )],
    data_files=(('bbn', ['../bbn/sBBN.dat']),)
)
{'fraction_non_alphanumeric': 0.13423699169217315, 'fraction_numerical': 0.012243113248797552, 'mean_word_length': 2.6725521669341896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7589298', 'n_tokens_mistral': 675, 'n_tokens_neox': 631, 'n_words': 218}