3

I created a python package looking like the following. The package is primarily used to run stages in a jenkins pipeline inside a docker container. So I created a repository in github and created a dockerfile with a step where the repository is cloned and performed pip install on that package. Then I built the docker image.

jenkins_pipeline_pkg/
| - jenkins_pipeline_pkg/
    | - __init__.py
| - config/
    | - config.yaml
| - scripts/
    | - pre_build.py
    | - build.py
| - setup.py

I performed pip install on the package inside the docker container I created using the dockerfile. The setup.py looks like the following.

#!/usr/bin/env python

from setuptools import setup

setup(name='jenkins_pipeline_pkg',
      version='0.1',
      description='Scripts for jenkins pipeline',
      url='<private repo url>',
      author='<name>',
      author_email='<email>',
      packages=['jenkins_pipeline_pkg'],
      zip_safe=False,
      entry_points={
          'console_scripts': [
              'pre-build = jenkins_pipeline_pkg.pre_build:main',
              'build = jenkins_pipeline_pkg.build:main',],
      }
)

I ran pip install on the package. It installed the executable mentioned in the entry_points in ~/.local/bin. Then I tried to execute the executable from anywhere else by not changing into the directory ~/.local/bin (just say I executed from /home/user). And also bash auto complete doesnt show the pre-build command. I dont know what I'm missing here.

4
  • Try either creating link for executable in /use/bin or include ~/.local/bin in $PATH. Hope this will help Commented Feb 21, 2019 at 20:07
  • Added export PATH=~/.local/bin:$PATH. It worked. Thank you. Commented Feb 21, 2019 at 20:10
  • Great. You are welcome. I will copy paste same as answer. Commented Feb 21, 2019 at 20:11
  • Is there a way to automate this for every user who pip installs the script? Commented Sep 19, 2020 at 9:54

1 Answer 1

4

Try either creating link for executable in /use/bin or include ~/.local/bin in $PATH.

Edit: export PATH=~/.local/bin:$PATH

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.