code: def compile_pythranfile(file_path, output_file=None, module_name=None,
                          cpponly=False, pyonly=False, **kwargs):
      
      if not output_file:
          # derive module name from input file name
          _, basename = os.path.split(file_path)
          module_name = module_name or os.path.splitext(basename)[0]
  
      else:
          # derive module name from destination output_file name
          _, basename = os.path.split(output_file)
          module_name = module_name or basename.split(".", 1)[0]
  
      module_dir = os.path.dirname(file_path)
  
      # Look for an extra spec file
      spec_file = os.path.splitext(file_path)[0] + '.pythran'
      if os.path.isfile(spec_file):
          specs = load_specfile(open(spec_file).read())
          kwargs.setdefault('specs', specs)
  
      output_file = compile_pythrancode(module_name, open(file_path).read(),
                                        output_file=output_file,
                                        cpponly=cpponly, pyonly=pyonly,
                                        module_dir=module_dir,
                                        **kwargs)
  
      return output_file
docs: Pythran file -> c++ file -> native module.
  
      Returns the generated .so (or .cpp if `cpponly` is set to true).
  
      Usage without an existing spec file
  
      >>> with open('pythran_test.py', 'w') as fd:
      ...    _ = fd.write('def foo(i): return i ** 2')
      >>> cpp_path = compile_pythranfile('pythran_test.py', cpponly=True)
  
      Usage with an existing spec file:
  
      >>> with open('pythran_test.pythran', 'w') as fd:
      ...    _ = fd.write('export foo(int)')
      >>> so_path = compile_pythranfile('pythran_test.py')
  
      Specify the output file:
  
      >>> import sysconfig
      >>> ext = sysconfig.get_config_vars()["SO"]
      >>> so_path = compile_pythranfile('pythran_test.py', output_file='foo'+ext)