Skip to content

Sample case showing how to distribute a python package with fortran f90 libraries in conda.

License

Notifications You must be signed in to change notification settings

uibcdf/TestConda_withF90Libs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setting up and uploading a python package with f90 library to Anaconda.

The purpose of this repo is to show how a python package with a f90 fortran library is setup and distributed via anaconda.

A simple setup file setup.py includes the necessary declarations to compile the fortran code through numpy (f2py).

Any comment is appreciated.

Instructions

Manually testing the package

The fortran code can be compiled manually with f2py and the package locally invoked to run a first test:

cd extra
python f2py_compiling.py
cd ..
python

Once the python interpreter is opened you can already check that the fortran library is usable with the piece of python code in the 'Finnal test' subsection.

Building and uploading the package to your anaconda channel

Find the conda recipe and steps description in devtools/conda-recipe.

Finnal test:

conda install -c YOUR_ANACONDA_CHANNEL vector_normalization

import numpy as np
from vector_normalization import normalize_vector()

vect=np.array([1.0,1.0,1.0])
normalize_vector(vect)
print(vect)