2

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.

2
  • Did you try giving it a valid package name? Commented Oct 4, 2015 at 20:31
  • @IgnacioVazquez-Abrams setuptools.setup comes from distutils.core.setup. distutils docs show that '' is a valid package. I guess the setuptools extention breaks this though. docs.python.org/2/distutils/… Commented Jan 24, 2016 at 13:20

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.