[Tutor] Need some help with setuptools for my project.
Anubhav Yadav
anubhav1691 at gmail.com
Tue Apr 7 13:00:43 CEST 2015
>
> On your GitHub repository, you have a single file, scorer.py. I think that
> this is a better approach in this instance than the multiple file approach
> you have now taken (see below).
>
I am sorry I linked the master repository. See the structureCode branch[1].
>
> > setuptools says that my script is installed but I don't know how to run
> it?
>
> setuptools will have installed your module to site-packages so that other
> developers can import it to use in writing their own code. However, your
> code doesn’t provide anything for developers e.g. new functions, classes
> etc. so this isn’t really want you want. Rather, your code should be run by
> the end user, the cricket fan. From the first link I gave:
>
> “Python modules...are usually not run by themselves but imported by
> scripts. Scripts are files containing Python source code, intended to be
> started from the command line"
>
> The latter sounds much more like your situation, so I recommend you do it
> that way. Scripts like this should be single files, hence my recommendation
> to use one file.
>
> Hope that helps,
>
This certainly helps, if you see the new link that I have given this time,
you will notice that I have an app.py in my project dir, and it has the
main() function. I have called the main function in __main__.py. This[2]
blog post tells me that you can run your app using ``python -m scorer``
from the root directory of the project, and indeed I am able to run my
scorer app like this.
Now my question is how can I use setup tools so that users can just run
"scorer" from the command line and the my script(which was installed before
by setuptools) will start?
[1] https://github.com/neo1691/scorer.py/tree/structureCode
[2] http://blog.habnab.it/blog/2013/07/21/python-packages-and-you/
--
Regards,
Anubhav Yadav
KPIT Technologies,
Pune.
More information about the Tutor
mailing list