2

I currently have a package that I would like to publish to pypi, which requires another package (https://github.com/CrisisTextLine/scrubadub) that is a fork of the original scrubadub package. I am trying to vendor the scrubadub fork, but I haven't found any resource on how to vendor packages in python.

I'd like to support python2 and python3 for the package I distribute. My concerns include:

  • where to place the vendorized packages
  • how to get the packages themselves - should I simply place the source into this vendor folder
  • how to manage dependencies of the vendored packages - should I add their dependencies in my dependency list in setup.py?

How would I go about this?

2 Answers 2

2

As of 2022, if you are about to use a tool to ease the vendoring process instead of DIY (manually), I would recommend https://pypi.org/project/vendoring/ because that is used actively by pip itself.

There were other projects but I checked them and they do not seem to be actively maintained.

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

1 Comment

It would be nice if the repo, didn't have a big warning label on the box. Also, the method of patching the imports, and also throwing warning when including *.so files, is a bit of a higher bar.
1

If you are redistributing

  • check if the license is compatible
  • Copy the code into your modules folder
  • Update all the import statements until all the imports resolve again
  • Include licenses for vendorized
  • Yes, you'll need to either vendorize dependencies, or at least add them to your own dependency list in setup.py.

Consider using something like python-vendorize to automate and make the workflow less ad hoc.

If you are not redistributing, then the vendor folder acts sort of like a manual virtual environment folder or extra site-packages folder.

  • add a folder, e.g. /vendor/
  • copy all vendorized modules there.
  • You don't have to update namespaces
  • You could pip install . -e them, or add their dependencies to your dependency files (requirements.txt, Pipfile, etc)
  • Update PYTHONPATH to include the /vendor/ folder.

Consider using something like Vendy to automate this and make the workflow less ad hoc.

2 Comments

Sadly none of the two mentioned utilities seems to be actively maintained, I guess we are better off DIY.
Or you could vendorize them, eh?

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.