Skip to content

robotframework-browser: init at 19.6.2#425503

Open
tobiasBora wants to merge 1 commit intoNixOS:masterfrom
tobiasBora:add_robotframework-browser
Open

robotframework-browser: init at 19.6.2#425503
tobiasBora wants to merge 1 commit intoNixOS:masterfrom
tobiasBora:add_robotframework-browser

Conversation

@tobiasBora
Copy link
Copy Markdown
Contributor

@tobiasBora tobiasBora commented Jul 15, 2025

Things done

Fix #292321, it should work now.

  • 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/)
  • Nixpkgs 25.11 Release Notes (or backporting 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 25.05 NixOS Release notes)
    • (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, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

To test, start a shell with

(pkgs.python3.withPackages (ps: with ps; [
      robotframework robotframework-browser
    ]))

create a file test.robot:

*** Settings ***
Library   Browser

*** Test Cases ***
Example Test
    New Page    https://playwright.dev
    Get Text    h1    contains    Playwright

and run:

$ robot test.robot

all tests should pass.


Add a 👍 reaction to pull requests you find important.

@nix-owners nix-owners bot requested a review from natsukium July 15, 2025 17:01
@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from 57d9628 to 1b8895d Compare July 15, 2025 17:05
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: python Python is a high-level, general-purpose programming language. and removed 6.topic: python Python is a high-level, general-purpose programming language. labels Jul 15, 2025
@nix-owners nix-owners bot requested a review from nzhang-zh July 15, 2025 17:12
@tobiasBora tobiasBora marked this pull request as draft July 16, 2025 08:12
@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from 1b8895d to fff9229 Compare July 16, 2025 13:39
@nixpkgs-ci nixpkgs-ci bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Jul 16, 2025
@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch 2 times, most recently from 266130c to 8760277 Compare July 26, 2025 12:30
@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from 8760277 to 531859f Compare July 26, 2025 12:31
@tobiasBora tobiasBora marked this pull request as ready for review July 26, 2025 12:32
@tobiasBora
Copy link
Copy Markdown
Contributor Author

Fix #292321, it should work now.

@drupol
Copy link
Copy Markdown
Contributor

drupol commented Jul 26, 2025

In overall and even if it is totally optional, try to sort derivation attributes sorted in the natural way, similar to the majority of derivations in this repo.

@tobiasBora tobiasBora changed the title DRAFT: robotframework-browser: init at 19.6.0 robotframework-browser: init at 19.6.0 Jul 26, 2025
@tobiasBora tobiasBora changed the title robotframework-browser: init at 19.6.0 robotframework-browser: init at 19.6.2 Jul 26, 2025
@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from 2bab342 to 562a9d0 Compare July 26, 2025 13:09
@tobiasBora
Copy link
Copy Markdown
Contributor Author

@drupol I was indeed mostly trying to make this derivation work and spent little time reorganizing the sections. I did my best to have a coherent ordering, hope it is good enough.

@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from 562a9d0 to cf69cba Compare July 26, 2025 19:01
Copy link
Copy Markdown
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from cf69cba to 98fef45 Compare July 26, 2025 19:08
@tobiasBora tobiasBora requested a review from drupol July 26, 2025 19:12
Copy link
Copy Markdown
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobiasBora tobiasBora requested a review from drupol July 27, 2025 07:24
@drupol
Copy link
Copy Markdown
Contributor

drupol commented Jul 27, 2025

Please squash the commits

@tobiasBora tobiasBora force-pushed the add_robotframework-browser branch from 89c3e9d to 3dbd227 Compare July 27, 2025 11:01
@tobiasBora
Copy link
Copy Markdown
Contributor Author

@drupol I did that since I had no access to my computer and I was expecting the final merger to be able to apply the squash at the last step. Anyway, I just did it.

@drupol
Copy link
Copy Markdown
Contributor

drupol commented Jul 27, 2025

@drupol I did that since I had no access to my computer and I was expecting the final merger to be able to apply the squash at the last step. Anyway, I just did it.

We usually don't do that, the PR author need to clean his own PR and not rely on someone else to do it...

Comment on lines +107 to +114
cat >> $out/lib/python3.13/site-packages/Browser/__init__.py <<EOF
import os
if not "PLAYWRIGHT_BROWSERS_PATH" in os.environ:
os.environ["PLAYWRIGHT_BROWSERS_PATH"] = "${playwright-driver.browsers}"
if not "PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS" in os.environ:
os.environ["PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS"] = "true"
EOF
'';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this is wrong. This should be done as a patch, perhaps using replaceVars to substitute the path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I guess it should be done in patch phase indeed. But why can't I use cat instead of patch? Seems like cat is more robust than a patch since the patch will fail when the init file changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're adding a file in the Browser package. With a patch you won't need the path at all. Just patch the src and that's it.

@iwanb
Copy link
Copy Markdown
Contributor

iwanb commented Jul 31, 2025

Not sure what's the best way to handle this, but FYI upstream pins some packages like protobuf and grpcio, which means this package will break whenever these get updates in nixpkgs (or when you want to update this package but grpcio is not updated yet). They also understandably don't want to support relaxing the version checks. AFAIK the pinning is not really necessary, if we build the protobufs and run the tests it should be fine to relax it on our side, but of course it's better if we can honor it.

I also noticed they just released a new version which moves to pyproject.toml. It also updates grpcio, so that's a good example of the problem you'll get, now you have to wait for grpcio to be updated first, which will then break this merge request/package, then update to the new version to unbreak it.

# + grpc_tools_node_protoc already includes the plugin and is not runnable via npm
# since nix directly builds it from C++ sources to avoid to use pre-build binaries
# downloaded by npm
patchPhase = ''
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
patchPhase = ''
postPatch = ''

we do not want to break patches

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm implementing this now in my next update, but still curious: what's wrong with adding a patchPhase? Aren't all hooks involving patch adding stuff to postPatch already?

Comment on lines +82 to +92
runHook prePatch
substituteInPlace ./Browser/playwright.py \
--replace-fail '(installation_dir / "node_modules").is_dir()' 'True'
substituteInPlace ./tasks.py \
--replace-fail 'c.run("pip install -U pip")' 'return' \
--replace-fail 'npm run grpc_tools_node_protoc' 'grpc_tools_node_protoc' \
--replace-fail ' -- ' ' '
substituteInPlace ./package.json \
--replace-fail '"grpc-tools": "^1.13.0",' ' '
sed -i '/--plugin=protoc-gen-grpc/d' ./tasks.py
runHook postPatch
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
runHook prePatch
substituteInPlace ./Browser/playwright.py \
--replace-fail '(installation_dir / "node_modules").is_dir()' 'True'
substituteInPlace ./tasks.py \
--replace-fail 'c.run("pip install -U pip")' 'return' \
--replace-fail 'npm run grpc_tools_node_protoc' 'grpc_tools_node_protoc' \
--replace-fail ' -- ' ' '
substituteInPlace ./package.json \
--replace-fail '"grpc-tools": "^1.13.0",' ' '
sed -i '/--plugin=protoc-gen-grpc/d' ./tasks.py
runHook postPatch
substituteInPlace ./Browser/playwright.py \
--replace-fail '(installation_dir / "node_modules").is_dir()' 'True'
substituteInPlace ./tasks.py \
--replace-fail 'c.run("pip install -U pip")' 'return' \
--replace-fail 'npm run grpc_tools_node_protoc' 'grpc_tools_node_protoc' \
--replace-fail ' -- ' ' '
substituteInPlace ./package.json \
--replace-fail '"grpc-tools": "^1.13.0",' ' '
sed -i '/--plugin=protoc-gen-grpc/d' ./tasks.py

@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package request: robotframework-browserlibrary

4 participants