pyapp icon indicating copy to clipboard operation
pyapp copied to clipboard

How to declare folder dependencies

Open NevermindNilas opened this issue 1 year ago • 6 comments

Hi,

I have this file system / folder system setup

main_folder/ ├─ src/ │ ├─ utils/ │ ├─ script.py │ ├─ script2.py │ ├─ script3.py ├─ main.py

What flag should be used in order to tell pyapp that the subfolder src is also needed when packaging? I am using the following setup to create the .exe

@echo off
set PYAPP_PROJECT_DEPENDENCY_FILE=G:\TheAnimeScripter\requirements-windows.txt
set PYAPP_EXEC_SCRIPT=G:\TheAnimeScripter\main.py
set PYAPP_PYTHON_VERSION=3.11
set PYAPP_PROJECT_NAME=tas
set PYAPP_PROJECT_VERSION=1.9.1
set PYAPP_EXPOSE_ALL_COMMANDS=true
set PYAPP_EXE_NAME=TheAnimeScripter


cargo build --release

And I get the following import errors

G:\pyapp-v0.22.0\target\release  .\pyapp.exe
Traceback (most recent call last):
  File "C:\Users\nilas\AppData\Local\pyapp\cache\scripts\327278503990150853\main.py", line 30, in <module>
    from src.argumentsChecker import argumentChecker
ModuleNotFoundError: No module named 'src'

NevermindNilas avatar Jul 29 '24 17:07 NevermindNilas

same as me

michael-liumh avatar Jan 12 '25 16:01 michael-liumh

+1 not sure if people are only using this with 1-file scripts!

ammmir avatar Apr 09 '25 12:04 ammmir

" You should turn your directory into a package and then you can embed that "

This is the response I got over discord, I would presume this implies adding __init__.py to all your directories so that pyapp can detect them as a typical package.

NevermindNilas avatar Apr 09 '25 13:04 NevermindNilas

" You should turn your directory into a package and then you can embed that "

This is the response I got over discord, I would presume this implies adding __init__.py to all your directories so that pyapp can detect them as a typical package.

I am wondering whether you figured out a way. Thanks in advance.

xies4 avatar Apr 29 '25 15:04 xies4

" You should turn your directory into a package and then you can embed that " This is the response I got over discord, I would presume this implies adding __init__.py to all your directories so that pyapp can detect them as a typical package.

I am wondering whether you figured out a way. Thanks in advance.

I honestly didn't due to Rust bitching about the compilation of pyapp, I just went down the route of using a portable python and pip installing the requirements during runtime. I like it more than relying on 3rd party libraries handling everything. As an added bonus, I should no longer worry about false positives from Windows Defender.

NevermindNilas avatar May 03 '25 15:05 NevermindNilas

" You should turn your directory into a package and then you can embed that " This is the response I got over discord, I would presume this implies adding __init__.py to all your directories so that pyapp can detect them as a typical package.

I am wondering whether you figured out a way. Thanks in advance.

I honestly didn't due to Rust bitching about the compilation of pyapp, I just went down the route of using a portable python and pip installing the requirements during runtime. I like it more than relying on 3rd party libraries handling everything. As an added bonus, I should no longer worry about false positives from Windows Defender.

Thank you!

xies4 avatar May 05 '25 14:05 xies4