5

Please before flagging as duplicate, I have tried a bunch of solutions including one here but no luck

I have created a simple tool to do some tasks and was able to package it successfully.

When trying to install it, I get the desired effect when I use python setup.py install but pip install package_name just installs the package but no post installation script.

Here is part of my code;

setup.py

from distutils import setup
from app.scripts import *

setup(

        #Application name
        name = "my-app-name",

        version = "my-app-version",
        author = "my-name",
        author_email = "my-email",
        packages = ['app'],
        include_package_data = True,
        license = 'MIT',
        url = "https://my-url",
        description = "description",
        install_requires = ["flake8"],
        cmdclass = {
            "install":Post_install
        }
    )

scripts.py

from distutils.command.install import install
import os

class Post_install(install):

    @staticmethod
    def func():      
        return True

    def run(self):
        install.run(self)
        #Pre install actions
        if Post_install.func():
            print("Bingo")
        else:
            print("Failed")

Thanks :)

PS I run pip install after uploading the package.

Collins Abitekaniza
  • 4,496
  • 2
  • 28
  • 43

1 Answers1

1

Install the package directly from your GitHub repository:

pip install -vvv git+url/for/github/repo@my-branch

You mentioned in the chat that you'd like to add this package to your requirements.txt file. See this question for details:

-e git://github.com/path/to/project

Former answer (rejected by the OP):

I managed to recreate the issue you're having. It seems to be a matter of pip install silencing or redirecting output (as indicated by an answer to this question).

The solution is to add the option -vvv after pip install. I'm guessing the v stands for verbose.

SwiftsNamesake
  • 1,540
  • 2
  • 11
  • 25