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

python3Packages.orange3: setup direct dependencies to fetch from GitHub + bump #354279

Merged
merged 10 commits into from
Dec 30, 2024
11 changes: 8 additions & 3 deletions pkgs/development/python-modules/orange-canvas-core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
lockfile,
numpy,
pip,
trubar,
qasync,
requests-cache,
typing-extensions,
Expand All @@ -26,18 +27,19 @@
pytestCheckHook,

stdenv,
gitUpdater,
}:

buildPythonPackage rec {
pname = "orange-canvas-core";
version = "0.2.2";
version = "0.2.4";
pyproject = true;

src = fetchFromGitHub {
owner = "biolab";
repo = "orange-canvas-core";
rev = "refs/tags/${version}";
hash = "sha256-Jp3vCQmRdkFADStVkbCFPiCBqpbI0a4JiJ8qs60rpqw=";
tag = version;
hash = "sha256-tLFWOXsAhqxFV0wdlAKestO/F/rDtdFnKDd0FXPeNpg=";
};

build-system = [ setuptools ];
Expand All @@ -55,6 +57,7 @@ buildPythonPackage rec {
qasync
requests-cache
typing-extensions
trubar
];

pythonImportsCheck = [ "orangecanvas" ];
Expand Down Expand Up @@ -85,6 +88,8 @@ buildPythonPackage rec {
"test_widgettoolgrid"
];

passthru.updateScript = gitUpdater { };

disabledTestPaths = [ "orangecanvas/canvas/items/tests/test_graphicstextitem.py" ];

meta = {
Expand Down
22 changes: 15 additions & 7 deletions pkgs/development/python-modules/orange-widget-base/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
lib,
gitUpdater,
stdenv,
buildPythonPackage,
fetchPypi,
setuptools,
fetchFromGitHub,
pyqt5,
pyqtwebengine,
matplotlib,
Expand All @@ -17,15 +19,19 @@

buildPythonPackage rec {
pname = "orange-widget-base";
version = "4.24.0";
format = "setuptools";
version = "4.25.0";
pyproject = true;

src = fetchPypi {
inherit pname version;
hash = "sha256-2cBg7s4+qMrb2G4sMk5yednOzJCNheHIQ3lty4KAg18=";
src = fetchFromGitHub {
owner = "biolab";
repo = "orange-widget-base";
tag = version;
hash = "sha256-tWo8vwC8xLA2ZKeab2GqpXGdlHhaqOT9wu1efqSHZSg=";
};

propagatedBuildInputs = [
build-system = [ setuptools ];

dependencies = [
matplotlib
orange-canvas-core
pyqt5
Expand Down Expand Up @@ -53,6 +59,8 @@ buildPythonPackage rec {
"orangewidget/tests/test_widget.py"
];

passthru.updateScript = gitUpdater { };

meta = {
description = "Implementation of the base OWBaseWidget class and utilities for use in Orange Canvas workflows";
homepage = "https://github.com/biolab/orange-widget-base";
Expand Down
118 changes: 62 additions & 56 deletions pkgs/development/python-modules/orange3/default.nix
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
{
lucasew marked this conversation as resolved.
Show resolved Hide resolved
lib,
stdenv,
baycomp,
bottleneck,
buildPythonPackage,
chardet,
fetchFromGitHub,

# build-system
oldest-supported-numpy,
setuptools,

# nativeBuildInputs
copyDesktopItems,
cython,
qt5,
recommonmark,
sphinx,

# dependencies
baycomp,
bottleneck,
catboost,
xgboost,
fetchFromGitHub,
fetchurl,
chardet,
httpx,
joblib,
keyring,
keyrings-alt,
makeDesktopItem,
matplotlib,
nix-update-script,
numpy,
oldest-supported-numpy,
openpyxl,
opentsne,
orange-canvas-core,
orange-widget-base,
pandas,
pytestCheckHook,
pytest-qt,
pyqtgraph,
pip,
pyqt5,
pyqtgraph,
pyqtwebengine,
python,
python-louvain,
pythonOlder,
pyyaml,
pip,
qt5,
qtconsole,
recommonmark,
requests,
scikit-learn,
scipy,
serverfiles,
setuptools,
sphinx,
wheel,
xgboost,
xlrd,
xlsxwriter,

makeDesktopItem,

# passthru
gitUpdater,
python,
pytest-qt,
pytestCheckHook,
}:

let
Expand All @@ -55,15 +61,18 @@ let
version = "3.37.0";
pyproject = true;

disabled = pythonOlder "3.7";

src = fetchFromGitHub {
owner = "biolab";
repo = "orange3";
rev = "refs/tags/${version}";
tag = version;
hash = "sha256-3PybiHXH6oIYJb78/a7LnQA6cYUicDx4Mf65QhIhT4w=";
};

build-system = [
oldest-supported-numpy
setuptools
];

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'cython>=3.0' 'cython'
Expand All @@ -74,50 +83,47 @@ let

nativeBuildInputs = [
copyDesktopItems
oldest-supported-numpy
cython
qt5.wrapQtAppsHook
recommonmark
setuptools
sphinx
wheel
];

enableParallelBuilding = true;

pythonRelaxDeps = [ "scikit-learn" ];

propagatedBuildInputs = [
numpy
scipy
chardet
dependencies = [
baycomp
bottleneck
catboost
xgboost
chardet
httpx
joblib
keyring
keyrings-alt
matplotlib
numpy
openpyxl
opentsne
orange-canvas-core
orange-widget-base
pandas
pip
pyqt5
pyqtgraph
pyqtwebengine
python-louvain
pyyaml
qtconsole
setuptools
bottleneck
matplotlib
joblib
requests
keyring
scikit-learn
pandas
pyqtwebengine
scipy
serverfiles
orange-canvas-core
python-louvain
setuptools
xgboost
xlrd
xlsxwriter
httpx
pyqtgraph
pyqt5
orange-widget-base
keyrings-alt
pyyaml
baycomp
pip
];

# FIXME: ImportError: cannot import name '_variable' from partially initialized module 'Orange.data' (most likely due to a circular import) (/build/source/Orange/data/__init__.py)
Expand Down Expand Up @@ -165,7 +171,7 @@ let
'';

passthru = {
updateScript = nix-update-script { };
updateScript = gitUpdater { };
tests.unittests = stdenv.mkDerivation {
name = "${self.name}-tests";
inherit (self) src;
Expand All @@ -181,13 +187,13 @@ let
chmod +w -R .

substituteInPlace Orange/classification/tests/test_xgb_cls.py \
--replace test_learners mk_test_learners
--replace-fail test_learners mk_test_learners

substituteInPlace Orange/modelling/tests/test_xgb.py \
--replace test_learners mk_test_learners
--replace-fail test_learners mk_test_learners

substituteInPlace Orange/**/tests/*.py \
--replace test_filename filename_test
--replace-fail test_filename filename_test

# TODO: debug why orange is crashing on GC, may be a upstream issue
chmod +x Orange/__init__.py
Expand All @@ -196,8 +202,8 @@ let
'';

nativeBuildInputs = [
pytestCheckHook
pytest-qt
pytestCheckHook
];

postCheck = ''
Expand All @@ -211,12 +217,12 @@ let
};
};

meta = with lib; {
meta = {
description = "Data mining and visualization toolbox for novice and expert alike";
homepage = "https://orangedatamining.com/";
changelog = "https://github.com/biolab/orange3/blob/${version}/CHANGELOG.md";
license = with licenses; [ gpl3Plus ];
maintainers = with maintainers; [ lucasew ];
license = [ lib.licenses.gpl3Plus ];
maintainers = [ lib.maintainers.lucasew ];
mainProgram = "orange-canvas";
};
};
Expand Down
44 changes: 44 additions & 0 deletions pkgs/development/python-modules/trubar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
gitUpdater,
pytestCheckHook,
libcst,
pyyaml,
}:

buildPythonPackage rec {
pname = "trubar";
version = "0.3.4";
pyproject = true;

src = fetchFromGitHub {
owner = "janezd";
repo = "trubar";
tag = version;
hash = "sha256-ChKmeACEMnFcMYSdkdVlFiE3td171ihUS2A+qsP5ASk=";
};

build-system = [ setuptools ];

dependencies = [
libcst
pyyaml
];

pythonImportsCheck = [ "trubar" ];

nativeCheckInputs = [ pytestCheckHook ];

passthru.updateScript = gitUpdater { };
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not nix-update-script ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simpler, and the actual code is in nixpkgs already. BTW there is a generic updater that you can setup by just giving a command that list the versions available

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I was not aware of that. So basically it is (or should be) recommended over nix-update-script for all packages using fetchFromGit* ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anything using git should work.

If they use some kind of tag prefix such as v or sscg- then you pass it using the rev-prefix parameter and that's it.

If you want always the latest commit then you use unstableGitUpdater, and there is genericUpdater when the source is not git, you basically pass a script to list versions then it takes the latest one by comparison then change the hashes automatically. This version list is a bit clunky because the system expects you to pass a expression that takes package information as an argument, I did an example of that in #354277 tho.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok good to know ! Thank you for the explanation :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I think that specifying the updater is useless for packages under python3Packages as they all inherit an updater (nix-update-script I think) by default.

Hence, I would actually get rid of those.
Maybe @mweinelt can confirm.


meta = {
description = "Utility for translation of strings and f-strings in Python files";
homepage = "https://github.com/janezd/trubar";
changelog = "https://github.com/janezd/trubar/releases/tag/${version}";
license = [ lib.licenses.mit ];
maintainers = [ lib.maintainers.lucasew ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16415,6 +16415,8 @@ self: super: with self; {

trove-classifiers = callPackage ../development/python-modules/trove-classifiers { };

trubar = callPackage ../development/python-modules/trubar { };

trueskill = callPackage ../development/python-modules/trueskill { };

truncnorm = callPackage ../development/python-modules/truncnorm { };
Expand Down
Loading