Nuitka / Nuitka-Action

Action to build with Nuitka on GitHub in your workflows
MIT License
127 stars 27 forks source link

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

Open JustRedTTG opened 1 day ago

JustRedTTG commented 1 day ago

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 commented 11 hours ago

Did you consider installing your requirements too?

JustRedTTG commented 11 hours ago

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 commented 10 hours ago

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 commented 9 hours ago

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 commented 1 hour ago

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 commented 29 minutes ago

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 commented 21 minutes ago

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 commented 20 minutes ago

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?