Unverified Commit 1a1da0c8 authored by Pavol Rusnak's avatar Pavol Rusnak Committed by GitHub
Browse files

python3Packages.{bpycv,zcs,boxx,fn}: remove (#380443)

parents 58b96258 1320c069
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -290,6 +290,8 @@

- The behavior of the `networking.nat.externalIP` and `networking.nat.externalIPv6` options has been changed. `networking.nat.forwardPorts` now only forwards packets destined for the specified IP addresses.

- `python3Packages.bpycv` has been removed due to being incompatible with Blender 4 and unmaintained.

- `python3Packages.jaeger-client` was removed because it was deprecated upstream. [OpenTelemetry](https://opentelemetry.io) is the recommended replacement.

- `nodePackages.meshcommander` has been removed, as the package was deprecated by Intel.
+0 −44
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  imageio,
  matplotlib,
  numpy,
  pandas,
  pyopengl,
  scikit-image,
  seaborn,
  snakeviz,
}:

buildPythonPackage rec {
  pname = "boxx";
  version = "0.10.14";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-unGnmPksEuqFXHTWJkj9Gv2G/qPDgT6AZXYiG2gtkEA=";
  };

  propagatedBuildInputs = [
    imageio
    matplotlib
    numpy
    pandas
    pyopengl
    scikit-image
    seaborn
    snakeviz
  ];

  pythonImportsCheck = [ "boxx" ];

  meta = with lib; {
    description = "Tool-box for efficient build and debug for Scientific Computing and Computer Vision";
    homepage = "https://github.com/DIYer22/boxx";
    license = licenses.mit;
    maintainers = with maintainers; [ lucasew ];
  };
}
+0 −80
Original line number Diff line number Diff line
# based on https://github.com/DIYer22/bpycv/blob/c576e01622d87eb3534f73bf1a5686bd2463de97/example/ycb_demo.py
import bpy
import bpycv

import os
import glob
import random
from pathlib import Path

example_data_dir = os.environ['BPY_EXAMPLE_DATA']
out_dir = Path(os.environ['out'])
out_dir.mkdir(parents=True, exist_ok=True)

models = sorted(glob.glob(os.path.join(example_data_dir, "model", "*", "*.obj")))
cat_id_to_model_path = dict(enumerate(sorted(models), 1))

distractors = sorted(glob.glob(os.path.join(example_data_dir, "distractor", "*.obj")))

bpycv.clear_all()
bpy.context.scene.frame_set(1)
bpy.context.scene.render.engine = "CYCLES"
bpy.context.scene.cycles.samples = 32
bpy.context.scene.render.resolution_y = 1024
bpy.context.scene.render.resolution_x = 1024
bpy.context.view_layer.cycles.denoising_store_passes = False

# A transparency stage for holding rigid body
stage = bpycv.add_stage(transparency=True)

bpycv.set_cam_pose(cam_radius=1, cam_deg=45)

hdri_dir = os.path.join(example_data_dir, "background_and_light")
hdri_manager = bpycv.HdriManager(
    hdri_dir=hdri_dir, download=False
)  # if download is True, will auto download .hdr file from HDRI Haven
hdri_path = hdri_manager.sample()
bpycv.load_hdri_world(hdri_path, random_rotate_z=True)

# load 5 objects
for index in range(5):
    cat_id = random.choice(list(cat_id_to_model_path))
    model_path = cat_id_to_model_path[cat_id]
    obj = bpycv.load_obj(model_path)
    obj.location = (
        random.uniform(-0.2, 0.2),
        random.uniform(-0.2, 0.2),
        random.uniform(0.1, 0.3),
    )
    obj.rotation_euler = [random.uniform(-3.1415, 3.1415) for _ in range(3)]
    # set each instance a unique inst_id, which is used to generate instance annotation.
    obj["inst_id"] = cat_id * 1000 + index
    with bpycv.activate_obj(obj):
        bpy.ops.rigidbody.object_add()

# load 6 distractors
for index in range(6):
    distractor_path = random.choice(distractors)
    target_size = random.uniform(0.1, 0.3)
    distractor = bpycv.load_distractor(distractor_path, target_size=target_size)
    distractor.location = (
        random.uniform(-0.2, 0.2),
        random.uniform(-0.2, 0.2),
        random.uniform(0.1, 0.3),
    )
    distractor.rotation_euler = [random.uniform(-3.1415, 3.1415) for _ in range(3)]
    with bpycv.activate_obj(distractor):
        bpy.ops.rigidbody.object_add()

# run pyhsic engine for 20 frames
for i in range(20):
    bpy.context.scene.frame_set(bpy.context.scene.frame_current + 1)

# render image, instance annoatation and depth in one line code
result = bpycv.render_data()


result.save(dataset_dir=str(out_dir.resolve()), fname="0", save_blend=True)
print(f'Save to "{out_dir}"')
print(f'Open "{out_dir}/vis/" to see visualize result.')
+0 −62
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  beautifulsoup4,
  blender,
  boxx,
  buildPythonPackage,
  fetchFromGitHub,
  fetchPypi,
  minexr,
  opencv-python,
  requests,
  runCommand,
  zcs,
}:

buildPythonPackage rec {
  pname = "bpycv";
  version = "0.4.0";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-qqNGemDB0aagCXjrECuh6kLksf+KujPejpnXVqFG8GY=";
  };

  propagatedBuildInputs = [
    beautifulsoup4
    minexr
    zcs
    requests
    opencv-python
    boxx
  ];

  # pythonImportsCheck = [ "bpycv" ]; # this import depends on bpy that is only available inside blender
  doCheck = false;

  passthru.tests = {
    render =
      runCommand "bpycv-render-test"
        {
          BPY_EXAMPLE_DATA = fetchFromGitHub {
            owner = "DIYer22";
            repo = "bpycv_example_data";
            hash = "sha256-dGb6KvbXTGTu5f4AqhA+i4AwTqBoR5SdXk0vsMEcD3Q=";
            rev = "6ce0e65c107d572011394da16ffdf851e988dbb4";
          };
        }
        ''
          ${blender.withPackages (ps: [ ps.bpycv ])}/bin/blender-wrapped -b -P ${./bpycv-test.py}
        '';
  };

  meta = with lib; {
    description = "Computer vision utils for Blender";
    homepage = "https://github.com/DIYer22/bpycv";
    license = licenses.mit;
    maintainers = [ maintainers.lucasew ];
    inherit (blender.meta) platforms;
  };
}
+0 −39
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchpatch,
  fetchPypi,
  pythonAtLeast,
}:

buildPythonPackage rec {
  pname = "fn";
  version = "0.4.3";
  format = "setuptools";

  # Python 3.11 changed the API of the `inspect` module and fn was never
  # updated to adapt; last commit was in 2014.
  disabled = pythonAtLeast "3.11";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1nmsjmn8jb4gp22ksx0j0hhdf4y0zm8rjykyy2i6flzimg6q1kgq";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/kachayev/fn.py/commit/a54fc0bd8aeae277de2db726131d249ce607c0c2.patch";
      hash = "sha256-I0ZISOgVibsc1k7gwSfeW6qV9PspQqdaHlRLr/IusQ8=";
      excludes = [ "fn/monad.py" ];
    })
  ];

  meta = with lib; {
    description = ''
      Functional programming in Python: implementation of missing
      features to enjoy FP
    '';
    homepage = "https://github.com/kachayev/fn.py";
    license = licenses.asl20;
  };
}
Loading