Reputation: 4133
For my Python project, I keep my source code in the directory src
. Thus, for my project's setup.py script:
from setuptools import setup
setup(name='pyIAST',
...
package_dir={'':'src'},
packages=[''])
so that it looks for src/IAST.py
, where my code resides. e.g. there is a function plot_isotherms()
in my IAST.py
script so the user can, after installation, call it:
import IAST
IAST.plot_isotherms()
Everything works great, but there is an annoying warning when I python setup.py install
or use pip install pyIAST
from PyPi:
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
How do I make this go away?
My project is here. I'm also a bit confused as to why I name my package pyIAST
, yet the user still types import IAST
for my package to import.
Upvotes: 2
Views: 5703
Reputation: 347
One way to clear that warning is to change your first line to:
from setuptools import setup, find_packages
and then change your packages line to:
packages=find_packages(),
The setup install will no longer generate a warning.
You can run the following two commands to see your isotherm method is now available:
import pyiast
#(<==notice this is not IAST)
dir(pyiast)
['BETIsotherm', 'InterpolatorIsotherm', 'LangmuirIsotherm', 'ModelIsotherm', 'QuadraticIsotherm', 'SipsIsotherm', '_MODELS', '_MODEL_PARAMS', '_VERSION', '__author__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'iast', 'np', 'plot_isotherm', 'print_selectivity', 'reverse_iast', 'scipy']
It can be called using pyiast.plot_isotherm()
You may need to update your setuptools. You can check what version you have with:
import setuptools; print "setup version: ", setuptools.__version__
Can update it with:
sudo pip install --upgrade setuptools
Upvotes: 3