Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In order to stage python project within our corporation I need to make an installable distribution.

This should include:

  • An egg or whl for my project
  • An egg or whl for every dependency of the project
  • (optionally) produce a requirements.txt file listing all the installable components for this release

Is there an easy plug in, (e.g. an alternative to bdist_wheel) that will not only compile one wheel but also that project's components?

Obviously I can script this, but I was hoping that there might be a short-cut that builds the package + dependencies in fewer steps.

This needs to work on Python 2.7 on Windows + Linux.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
482 views
Welcome To Ask or Share your Answers For Others

1 Answer

You will need to create a setup.py file for your package. Make sure you have the latest setuptools and pip installed. Then run the following:

python setup.py bdist_wheel

This will create a wheel file for your package. This assumes you don't have C/C++ headers, DLLs, etc. If you do, then you'll probably have a lot more work to do.

To get dependencies, you will want to create a requirements.txt file and run the following:

pip wheel -r requirements.txt

If your package isn't on PyPI, then you'll have to manually copy your package's wheel file into the wheel folder that this command creates. For more information see the following excellent article:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...