-
-
Notifications
You must be signed in to change notification settings - Fork 19k
optiland: init at 0.6.0 #509199
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
Merged
Merged
optiland: init at 0.6.0 #509199
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { | ||
| lib, | ||
| stdenvNoCC, | ||
| python3Packages, | ||
| qt6, | ||
| }: | ||
|
|
||
| stdenvNoCC.mkDerivation (finalAttrs: { | ||
| pname = "optiland-python-env"; | ||
| # Inheriting src too, to hint nix-update | ||
| inherit (python3Packages.optiland) version src; | ||
| strictDeps = true; | ||
| __structuredAttrs = true; | ||
|
|
||
| nativeBuildInputs = [ | ||
| qt6.wrapQtAppsHook | ||
| ]; | ||
| buildInputs = [ | ||
| qt6.qtbase | ||
| ]; | ||
|
|
||
| dontUnpack = true; | ||
| dontConfigure = true; | ||
|
|
||
| passthru = { | ||
| pythonPaths = python3Packages.requiredPythonModules ( | ||
| [ | ||
| python3Packages.optiland | ||
| python3Packages.python | ||
| ] | ||
| ++ python3Packages.optiland.passthru.optional-dependencies.gui | ||
| ++ python3Packages.optiland.passthru.optional-dependencies.torch | ||
| ); | ||
| pythonPath = | ||
| lib.makeSearchPathOutput "out" python3Packages.python.sitePackages | ||
| finalAttrs.finalPackage.passthru.pythonPaths; | ||
| makeWrapperArgs = [ | ||
| # leaving here room for potential additional arguments | ||
| ]; | ||
| }; | ||
|
|
||
| # Modelded after `python.buildEnv`'s postBuild, but we don't link paths at | ||
| # all, only create $out/bin/optiland (and potentially more) executable(s). | ||
| buildPhase = '' | ||
| mkdir -p $out/bin | ||
| cd ${python3Packages.optiland}/bin | ||
| for prg in *; do | ||
| if [ -f "$prg" ] && [ -x "$prg" ]; then | ||
| makeWrapper "${python3Packages.optiland}/bin/$prg" "$out/bin/$prg" \ | ||
| --set NIX_PYTHONPREFIX "$out" \ | ||
| --set NIX_PYTHONEXECUTABLE "${placeholder "out"}/bin/${python3Packages.python.executable}" \ | ||
| --set NIX_PYTHONPATH ${finalAttrs.finalPackage.passthru.pythonPath} \ | ||
| --set PYTHONNOUSERSITE "true" \ | ||
| ${lib.concatStringsSep " " finalAttrs.finalPackage.passthru.makeWrapperArgs} | ||
| fi | ||
| done | ||
| ''; | ||
|
|
||
| dontInstall = true; | ||
|
|
||
| meta = python3Packages.optiland.meta // { | ||
| description = python3Packages.optiland.meta.description + "; The GUI"; | ||
| mainProgram = "optiland"; | ||
| }; | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| { | ||
| lib, | ||
| buildPythonPackage, | ||
| fetchFromGitHub, | ||
| fetchpatch, | ||
|
|
||
| # build-system | ||
| hatchling, | ||
|
|
||
| # dependencies | ||
| matplotlib, | ||
| numba, | ||
| numpy, | ||
| pandas, | ||
| pyyaml, | ||
| requests, | ||
| scipy, | ||
| seaborn, | ||
| tabulate, | ||
| typing-extensions, | ||
| vtk, | ||
|
|
||
| # tests | ||
| pytestCheckHook, | ||
|
|
||
| # optional-dependencies | ||
| pyside6, | ||
| qtconsole, | ||
| torch, | ||
| }: | ||
|
|
||
| buildPythonPackage (finalAttrs: { | ||
| pname = "optiland"; | ||
| version = "0.6.0"; | ||
| pyproject = true; | ||
| __structuredAttrs = true; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "HarrisonKramer"; | ||
| repo = "optiland"; | ||
| tag = "v${finalAttrs.version}"; | ||
| hash = "sha256-s+EFsfj+3VIgpqhBv8f6IblyxfxXHWnO/i1lO3bEke4="; | ||
| }; | ||
|
|
||
| patches = [ | ||
| # wayland is not supported, see: | ||
| # https://github.com/optiland/optiland/issues/556 | ||
| (fetchpatch { | ||
| url = "https://github.com/optiland/optiland/commit/9644df6e06bd24c5a3a7cf36c8df9dd83050bccc.patch"; | ||
| hash = "sha256-a74Z7rp3ji3+9lM8Q/RttMIzwlRBki1N2Y0YtBiVaEA="; | ||
| }) | ||
| # A fixup for the above, see: | ||
| # | ||
| # - https://github.com/optiland/optiland/pull/564#discussion_r3106831922 | ||
| # - https://github.com/optiland/optiland/pull/568 | ||
| (fetchpatch { | ||
| url = "https://github.com/optiland/optiland/commit/652922bce5e1854f1d067e292422d95dee129a46.patch"; | ||
| hash = "sha256-9O+DNbqBDDSAaRkwCy3o76lwy5MJ7WHQqzfcN1fcmnE="; | ||
| }) | ||
| ]; | ||
|
|
||
| build-system = [ | ||
| hatchling | ||
| ]; | ||
|
|
||
| dependencies = [ | ||
| matplotlib | ||
| numba | ||
| numpy | ||
| pandas | ||
| pyyaml | ||
| requests | ||
| scipy | ||
| seaborn | ||
| tabulate | ||
| typing-extensions | ||
| vtk | ||
| ]; | ||
|
|
||
| passthru = { | ||
| optional-dependencies = { | ||
| gui = [ | ||
| pyside6 | ||
| qtconsole | ||
| ]; | ||
| torch = [ | ||
| torch | ||
| ]; | ||
| }; | ||
| }; | ||
|
|
||
| nativeCheckInputs = [ | ||
| pytestCheckHook | ||
| ] | ||
| # No need for optional-dependencies.gui, as the relevant tests requiring the | ||
| # gui dependencies are disabled below. | ||
| ++ finalAttrs.finalPackage.passthru.optional-dependencies.torch; | ||
|
|
||
| disabledTestPaths = [ | ||
| # From some reason, importing pyside6 during tests causes a core dump of the | ||
| # python interpreter, so we disable all GUI tests. | ||
| "tests/gui/" | ||
| ]; | ||
|
|
||
| pythonImportsCheck = [ | ||
| "optiland" | ||
| ]; | ||
|
|
||
| meta = { | ||
| description = "Comprehensive optical design, optimization, and analysis in Python, including GPU-accelerated and differentiable ray tracing via PyTorch"; | ||
| homepage = "https://github.com/HarrisonKramer/optiland"; | ||
| license = lib.licenses.mit; | ||
| maintainers = with lib.maintainers; [ doronbehar ]; | ||
| # Intentionally not setting optiland meta.mainProgram, as it is not | ||
| # functional without additional qt6 and python libraries available. See | ||
| # pkgs/by-name/op/optiland/package.nix for a derivation with a working GUI. | ||
| }; | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.