eastern-cyan
eastern-cyan16mo ago

common actor code

Hello, do you have any suggestions on how to share code between actors without using public repositories like pypi or github, instead only using apify platform/web IDE? Some crazy idea: import from key value store apify internal pypi
3 Replies
Mantisus
Mantisus16mo ago
Hey @rome
Some crazy idea: import from key value store apify internal pypi
This is a pretty good idea, just create a package in wheel format from the code you want to share. Here is an example for a requests package
pip install https://api.apify.com/v2/key-value-stores/t14j75uYTb6a9sD9p/records/requests-2.32.2-py3-none-any.whl
pip install https://api.apify.com/v2/key-value-stores/t14j75uYTb6a9sD9p/records/requests-2.32.2-py3-none-any.whl
Which I have placed in my key-value store. Now I can just install it inside a docker container that I'll host on Apify. You can do the same with your code that you want to share between actors. sample with custom package
pip install https://api.apify.com/v2/key-value-stores/t14j75uYTb6a9sD9p/records/best_apify_package-1.0.0-py3-none-any.whl
pip install https://api.apify.com/v2/key-value-stores/t14j75uYTb6a9sD9p/records/best_apify_package-1.0.0-py3-none-any.whl
import best_apify_package
import best_apify_package
eastern-cyan
eastern-cyanOP16mo ago
@Mantisus thx for your inputs. And you did not have to provide any api key?
Mantisus
Mantisus16mo ago
@rome use your Apify API key when upload a package in the key-value if you do it for example from the Web IDE terminal But you don't need any keys to download a package from Apify key-value. You can run the examples I've given you to see this

Did you find this page helpful?