Add external resources into final snap

Hello guys,
I have a small Python project in a local folder and I want to use with snapcraft builder, the problem is that it does not use the file and inside the folder there are several python files and other documentation files.

What I would like to understand is:
How do I place my project files in the final snap?

Thank you all

I recommend adding a, but assuming that’s not an option, you can do what you ask by using two parts: a part to pull in python (and pip dependencies, if necessary), and a part to dump your python files where they need to go. That would look something like this:

# [...]

  # Pull down python as well as any dependencies of the project
    plugin: python
    python-version: python2
    python-packages: [pip-dependency-1, pip-dependency-2]

  # Dump the project's python files into the snap
    plugin: dump
    source: .
1 Like

Hello Kyrofa. Thanks for your reply.
I’ve tried to build it with as you suggested and i’ve built it as sudo snapcraft prime but the prime/bin folder is emply and i receive the error:

[Error 21] Is a directory: “directory path in prime folder of my app”

Should “prime/bin” have the “python” and “my app” folders with needed files inside, right?

Any chance your project is public? It’s difficult to know what’s happening without looking at it.

(side note: you should very rarely need to use sudo with snapcraft).

Thanks again Kyrofa. You have right.
I setup a simple test project based on httpstat tutorial example:
without the file. It give me the same error as my app.

Tested on Xubuntu 16.04.2 LST xenial

Tell me if you can replicate my error.

Well, i found the issue with my snapcraft.yaml.
Basically the command path should contain the name and extension of the python file and in the source keyword need to add the project folder. If someone is interested I updated the github test example.