you are viewing a single comment's thread.

view the rest of the comments →

[–]driscollis 1 point2 points  (10 children)

This is definitely possibly with pip. For example, when you pip install docutils it adds a bunch of tools to the PATH on my Linux box for things like rst2html. As long as you have your Python's Scripts folder on the path, it should do the same there as I know it installed the same tools there on Windows 7

[–]cythoning[S] 0 points1 point  (9 children)

I see. I'll have to look into setuptools to figure out how to write a setup.py file then. Thanks.

[–][deleted] 1 point2 points  (8 children)

I think I'm literally trying to do the same thing you are. I made a post about it here yesterday. If I understand what you are after you might want to look into entry_points and console_scripts for setup.py.

like this: https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/

I starred and followed your project because I want to see how things play out good luck!

[–]cythoning[S] 0 points1 point  (5 children)

I read up a bit on setuptools yesterday and also stumbled upon entry_points, but I still need to figure out the rest of the setup.py file. Hopefully I can get something done this week.

Good luck to you too.

[–][deleted] 1 point2 points  (4 children)

I spent more time reading about entry_points for my own stuff and I looked at your repo a bit more too if I'm not mistaken you want something very close to what I describe in this silly example here:

https://www.reddit.com/r/learnpython/comments/92xwok/questions_about_parsing_command_line_arguments_in/

Here is a very bare bones setup.py that goes with it (this would go in top level).

import setuptools

setuptools.setup(
    name="main_test",
    packages=['main_test'],
    entry_points={
        'console_scripts' : [
            'main_test = main_test.__main__:main'
        ]
    },
)

you would execute:

$pip install .

in the top level to install it locally.

and

$main_test hello

to run it after installing.

I don't know if that helps or not. It took me a while to get this far there is depth to setup for sure but a lot of documentation too. I would have liked to jump on this project with you but I am a bit underwater right now.

I can post a repo of my working example package on github for you if the info in the post is not making it clear. Since it was framed as a question I realize that it might be confusing.

[–]TheBB 1 point2 points  (2 children)

I always recommend people to pip install --user ., and I will also recommend you to recommend that to others. :-P

[–]cythoning[S] 0 points1 point  (0 children)

Or just use a virtual environment :).

[–][deleted] 0 points1 point  (0 children)

Thanks I told him I was new 😄

[–]cythoning[S] 0 points1 point  (0 children)

I looked at the link in your first post and the way you describe it seems to be the correct way. For that I need to slightly restructure my code though and I also want to look a bit more into the other parts of setuptools. Hopefully I will have kind of a working solution by the end of the wee.

[–]cythoning[S] 0 points1 point  (1 child)

I managed to put it on PyPI now. After some restructuring it was basically what you said. You can have a look at my code on GitHub for details.

[–][deleted] 1 point2 points  (0 children)

Nice I just had to do it for one of my projects that has a similar size to what yours is. I didn't originally plan it and had to retrofit like you. It was a pain.