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

WIP: python312Packages.nicegui: update postPatch to fit to changed pyproject.toml #383925

Closed
wants to merge 4 commits into from

Conversation

belamu
Copy link

@belamu belamu commented Feb 21, 2025

The postPatch phase creates an error, documented in #383920 due to a change in the pyproject.toml upstream. This commit fits the replace string to the existing one.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

The postPatch phase creates an error, documented in NixOS#383920 due to a change in the pyproject.toml upstream.
This commit fits the replace string to the existing one.
@belamu
Copy link
Author

belamu commented Feb 21, 2025

@fabaff

I won't have time in the next few days to check if that change works and is sufficiant to fix the build but you are welcome to use this first step.
Next week I would probably try it out.

@belamu
Copy link
Author

belamu commented Feb 21, 2025

(Maybe this is a good time to stop and think about if the postPatch phase is still necessary. I have no clue.)

@nix-owners nix-owners bot requested a review from fabaff February 21, 2025 12:54
@belamu belamu changed the base branch from nixos-unstable to master February 21, 2025 22:48
@fabaff
Copy link
Member

fabaff commented Feb 22, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 383925


x86_64-linux

✅ 8 packages built:
  • python312Packages.nicegui
  • python312Packages.nicegui-highcharts
  • python312Packages.nicegui-highcharts.dist
  • python312Packages.nicegui.dist
  • python313Packages.nicegui
  • python313Packages.nicegui-highcharts
  • python313Packages.nicegui-highcharts.dist
  • python313Packages.nicegui.dist

@belamu
Copy link
Author

belamu commented Feb 23, 2025

I was able to use this version in a nix-shell but unfortunately upon starting nicegui, I get *.css not found. The static files are missing.

To reproduce, use the python file niceguiminimal.py

import nicegui
print(nicegui.__version__)
nicegui.ui.label("Hello World")
nicegui.ui.run()

the nix-shell

let
  pkgs = import (builtins.fetchGit
    url = "https://github.com/belamu/nixpkgs";
    ref = "patch-1";
  }) {};
in pkgs.mkShell {
    packages = with pkgs; [
      (python312.withPackages (python-pkgs: with python-pkgs; [
        nicegui
      ]))];}

and run python niceguiminimal.py. Then the output is

2.11.0.dev0
2.11.0.dev0
NiceGUI ready to go on http://localhost:8080, and http://172.20.30.202:8080
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/nicegui.css not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/quasar.prod.css not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/es-module-shims.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/socket.io.min.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/tailwindcss.min.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/fonts.css not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/nicegui.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/lang/en-US.umd.prod.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/vue.global.prod.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/quasar.umd.prod.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/tailwindcss.min.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/vue.global.prod.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/quasar.umd.prod.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/nicegui.js not found
http://127.0.0.1:8080/_nicegui/2.11.0.dev0/static/lang/en-US.umd.prod.js not found

And the web ui shows
Connection lost. Trying to reconnect...

Is the version string boggling it up?
It does not fit to the version you've set in the nix-file.
When I start the niceguiminimal.py via venv and pip install, I get version 2.11.1 and no error.

For some reason, the v2.11.1 tag code from nicegui has version 2.11.0-dev specified in the pyproject.toml. Either someone forgot to update it, or that's how it should work. Don't know how they "fixed" it in the mypy version.

@belamu
Copy link
Author

belamu commented Feb 23, 2025

Indeed: in the publish workflow in. github/workflows, the version is replaced by the tag name:

  - name: set up Poetry
        uses: abatilo/actions-poetry@v4
      - name: get version
        run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
      - name: Set version
        run: poetry version ${{ env.VERSION }}

One solution could be to use this postPatch to change the pyproject as it was done until your change with the setuptools line. Maybe there is also something poetry-specific possible.

this patching is also done in the github workflow for publishing
nicegui on pypy. Failing to patch it results in wrong directory names
for static files
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 1, 2025
@belamu
Copy link
Author

belamu commented Mar 1, 2025

I've added a postPatch line that fixes the version in the pyproject.toml line. This actually changes the directory of the static files but unfortunately does not avoid the error.
Running the nix-shell mentioned above, I get the same error:

nix-shell shell-patched-minimal.nix 
this derivation will be built:
  /nix/store/hyqxpkxjnbcw1g6xwlvlgglldr6kq2hs-python3-3.12.8-env.drv
building '/nix/store/hyqxpkxjnbcw1g6xwlvlgglldr6kq2hs-python3-3.12.8-env.drv'...
created 384 symlinks in user environment

[nix-shell:~/Documents/Computer/Programmierprojekte/flinventory-gui]$ python
Python 3.12.8 (main, Dec  3 2024, 18:42:41) [GCC 14.2.1 20241116] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nicegui
>>> nicegui.ui.run()
disabling auto-reloading because is is only supported when running from a file
NiceGUI ready to go on http://localhost:8080, and http://192.168.178.128:8080
http://127.0.0.1:8080/_nicegui/2.11.1/static/nicegui.css not found
http://127.0.0.1:8080/_nicegui/2.11.1/static/fonts.css not found
http://127.0.0.1:8080/_nicegui/2.11.1/static/quasar.prod.css not found
[........]

@belamu
Copy link
Author

belamu commented Mar 1, 2025

The version update and removal of the postPatch is already done on master in MR #385669

Hence the merge conflicts shown here in the github GUI.

@belamu
Copy link
Author

belamu commented Mar 1, 2025

Changes not relevant anymore. Some part of the changes is tracked in #386199

The problems described above are currently still relevant and needed to understand #386199

@belamu belamu closed this Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants