Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation reports should be documented and part of examples (was Nuitka not including any packages) #62

Open
JustRedTTG opened this issue Oct 17, 2024 · 12 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@JustRedTTG
Copy link

My action

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ windows-latest, ubuntu-latest, macos-latest ]
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.9'
          cache: 'pip'
          cache-dependency-path: requirements-${{ runner.os }}.txt

      - name: Build
        uses: Nuitka/Nuitka-Action@main
        with:
          nuitka-version: main
          script-name: run_gui.py
          standalone: true
          onefile: true
          disable-console: ${{ github.ref == 'refs/heads/main' }}
          macos-create-app-bundle: true
          deployment: ${{ github.ref == 'refs/heads/main' }}
          include-data-dir: |
            assets=assets
          include-data-files: |
            LICENSE=LICENSE

My requirements-Windows.txt

pygameextra==2.0.0a82

My action finished with an executable 5mb (I have other heavy packages too) (PyInstaller for ref is 90+mb)
As expected, exe doesn't work

Traceback (most recent call last):
  File "C:\Users\Lenovo\AppData\Local\Temp\ONEFIL~1\run_gui.py", line 1, in <module>
  File "C:\Users\Lenovo\AppData\Local\Temp\ONEFIL~1\gui\__init__.py", line 1, in <module gui>
  File "C:\Users\Lenovo\AppData\Local\Temp\ONEFIL~1\gui\gui.py", line 6, in <module gui.gui>
ModuleNotFoundError: No module named 'pygameextra'
@kayhayen
Copy link
Member

Did you consider installing your requirements too?

@kayhayen kayhayen self-assigned this Oct 19, 2024
@JustRedTTG
Copy link
Author

Did you consider installing your requirements too?

Notice the setup python which has the specific requirements.txt specified
In the case of windows it is requirements-Windows.txt

The log shows installation of packages
Including cache

Nuitka even mentions in it's logs that it will include extra data for a package, yet the executable is 5mb, it hasn't included anything at all!

@kayhayen
Copy link
Member

In that case, the output of added Nuitka compilation-report: compilation-report.xml would be helpful. I think, we need to also update the docs to use it in the examples, as it can explain those things best.

@JustRedTTG
Copy link
Author

In that case, the output of added Nuitka compilation-report: compilation-report.xml would be helpful. I think, we need to also update the docs to use it in the examples, as it can explain those things best.

I can fetch the compilation-report sure. Just tell me how

@kayhayen
Copy link
Member

If you can't figure it out from what I wrote, you will have to wait until I told you I updated the docs, which is sort of delayed, as I will work on Nuitka and 3.13 mainly now.

@JustRedTTG
Copy link
Author

I forgot that you do not like people wasting your time with stupid questions. Of course though, here's the report I extracted from the action: https://pastebin.com/rsV8Wf1G

@kayhayen
Copy link
Member

So, it says this e.g.

  <module name="gui.aspect_ratio" kind="CompiledPythonModule" usage="import" reason="Instructed by user to follow to all modules." source_path="${cwd}\gui\aspect_ratio.py">
    <optimization-time pass="1" time="0.01" micro_passes="5" max_branch_merge="141" merged_total="369" />
    <optimization-time pass="2" time="0.00" micro_passes="1" max_branch_merge="2" merged_total="7" />
    <module_usages>
      <module_usage name="pygameextra" finding="not-found" line="1" />
    </module_usages>
  </module>

I am not extremely familar with GitHub Actions, but I believe that your setup step does NOT install any package via PIP, and only says where it would cache and by which key, you are lacking a - run: pip install -r requirements.txt kind of line, adapted to your case.

I think that renders the report itself invalid, however, I will keep it open to track the addition of the compilation report update.

@kayhayen
Copy link
Member

The docs use this:

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
          architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
          cache: 'pip'
          cache-dependency-path: |
            **/requirements*.txt

      - name: Install Dependencies
        run: |
          pip install -r requirements.txt -r requirements-dev.txt

Seems you didn't use it?

@kayhayen kayhayen changed the title Nuitka not including any packages Compilation reports should be documented and part of examples (was Nuitka not including any packages) Oct 19, 2024
@kayhayen kayhayen added enhancement New feature or request help wanted Extra attention is needed labels Oct 19, 2024
@JustRedTTG
Copy link
Author

That was it, I removed that thinking setup action was installing stuff. My mistake, thanks for pointing it out, I am quite sleep deprived lol.

@kayhayen
Copy link
Member

Keeping it open to track the thing that interests me about this

@kayhayen kayhayen reopened this Oct 21, 2024
@JustRedTTG
Copy link
Author

I think nuitka should in general maybe have an option to fail if packages aren't found, maybe one global option, or exclusions in case there are certain modules that can in some cases not be installed, or something like that idk, or a warning, I think would be a nice idea, idk how good in practice but yeah

@kayhayen
Copy link
Member

I recall a time where it was a warning. I didn't have any good experience with that. People couldn't handle that either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants