[RepaintBoundary]Cannot take Screenshot of Platform Views

Steps to Reproduce

Execute flutter run on the code sample
Press icon button to take screenshot from camera preview.

Expected results: Screenshot should contain camera preview picture.
Actual results: Screenshot doesn't include camera view.
I tested it on Samsung S9, Samsung S20 using Flutter 2.10.5 and 2.13.0-0.2.pre.
Same issue happen on iOS, tested on iPhone 12 Pro Max, iOS 15.2.1, Flutter 2.10.5.
I'm aware of existing issues like https://github.com/flutter/flutter/issues/25306 which all point to resolved https://github.com/flutter/flutter/issues/83856#issuecomment-1072896951.
However I can't confirm that this feature works.

Code sample
import 'dart:typed_data';
import 'dart:ui';

import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final cameras = await availableCameras();
  final firstCamera = cameras.first;

  runApp(
    MaterialApp(
      theme: ThemeData.dark(),
      home: TakePictureScreen(
        camera: firstCamera,
      ),
    ),
  );
}

//
class TakePictureScreen extends StatefulWidget {
  const TakePictureScreen({
    Key? key,
    required this.camera,
  }) : super(key: key);

  final CameraDescription camera;

  @override
  TakePictureScreenState createState() => TakePictureScreenState();
}

class TakePictureScreenState extends State<TakePictureScreen> {
  static GlobalKey boundaryKey = GlobalKey();
  late CameraController _controller;
  late Future<void> _initializeControllerFuture;

  @override
  void initState() {
    super.initState();
    _controller = CameraController(
      widget.camera,
      ResolutionPreset.veryHigh,
    );
    _initializeControllerFuture = _controller.initialize();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return RepaintBoundary(
        key: boundaryKey,
        child: Scaffold(
          appBar: AppBar(title: const Text('Take a Screenshot')),
          body: FutureBuilder<void>(
            future: _initializeControllerFuture,
            builder: (context, snapshot) {
              if (snapshot.connectionState == ConnectionState.done) {
                return CameraPreview(_controller);
              } else {
                return const Center(child: CircularProgressIndicator());
              }
            },
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: () async {
              await _initializeControllerFuture;

              RenderRepaintBoundary? boundary =
                  boundaryKey.currentContext!.findRenderObject() as RenderRepaintBoundary?;
              var image = await boundary!.toImage();
              var byteData = await image.toByteData(format: ImageByteFormat.png);
              var pngBytes = byteData!.buffer.asUint8List();
              await Navigator.of(context).push(
                MaterialPageRoute(
                  builder: (context) => DisplayPictureScreen(
                    imageData: pngBytes,
                  ),
                ),
              );
            },
            child: const Icon(Icons.camera_alt),
          ),
        ));
  }
}

//
class DisplayPictureScreen extends StatelessWidget {
  final Uint8List imageData;

  const DisplayPictureScreen({Key? key, required this.imageData}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Display the Picture')),
      body: Image.memory(imageData),
    );
  }
}

pubspec.yaml
name: screenshot_test
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  camera: ^0.9.4+21

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true

flutter doctor -v
[√] Flutter (Channel beta, 2.13.0-0.2.pre, on Microsoft Windows [Version 10.0.19042.1288], locale ru-RU)
    • Flutter version 2.13.0-0.2.pre at e:\Programs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8662e22bac (10 days ago), 2022-04-20 08:21:52 -0700
    • Engine revision 24a02fa5ee
    • Dart version 2.17.0 (build 2.17.0-266.5.beta)
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Alexey\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.5.5)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.5.30104.148
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] VS Code (version 1.64.2)
    • VS Code at C:\Users\Alexey\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.1288]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 100.0.4896.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 87.0.664.66

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

D:\Work\Cars\Tests\Flutter\screenshot_test>flutter doctor -v
[√] Flutter (Channel beta, 2.13.0-0.2.pre, on Microsoft Windows [Version 10.0.19042.1288], locale ru-RU)
    • Flutter version 2.13.0-0.2.pre at e:\Programs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8662e22bac (10 days ago), 2022-04-20 08:21:52 -0700
    • Engine revision 24a02fa5ee
    • Dart version 2.17.0 (build 2.17.0-266.5.beta)
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Alexey\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.5.5)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.5.30104.148
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 2021.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] VS Code (version 1.64.2)
    • VS Code at C:\Users\Alexey\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.1288]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 100.0.4896.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 87.0.664.66

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Screenshots
Camera surface view:

Screenshot result:

Hi @xlyashuk, Thanks for filing the issue. I am able to reproduce the issue on stable and the master channel. On Taking the screenshot error is thrown and a blank image is displayed. The Screenshot can be taken without the CameraPreview  (Platformview).

flutter doctor -v (mac)
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3 21E230 darwin-arm, locale en-IN)
    • Flutter version 2.10.5 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (12 hours ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 61.2.4
    • Dart plugin version 212.5080.8

[✓] VS Code (version 1.65.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.39.20220405

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • <IP_ADDRESS>:55555                    • android-arm64  • Android 11 (API 30)
    • iPhone 12 Pro (mobile) • 535317A4-921C-488F-B234-C2CC6D4AE5A1 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.3 21E230 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 100.0.4896.88

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

[✓] Flutter (Channel master, 2.13.0-0.0.pre.808, on macOS 12.3 21E230 darwin-arm, locale en-IN)
    • Flutter version 2.13.0-0.0.pre.808 at /Users/mahesh/Documents/flutter_master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2eed8cbf93 (3 days ago), 2022-04-28 22:29:06 -0400
    • Engine revision dfdfe0b3b0
    • Dart version 2.18.0 (build 2.18.0-66.0.dev)
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-32, build-tools 31.0.0
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! CocoaPods 1.10.2 out of date (1.11.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 61.2.4
    • Dart plugin version 212.5080.8

[✓] VS Code (version 1.66.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.39.20220405

[✓] Connected device (3 available)
    • Redmi K20 Pro (mobile) • <IP_ADDRESS>:5553 • android-arm64  • Android 11 (API 30)
    • macOS (desktop)        • macos            • darwin-arm64   • macOS 12.3 21E230 darwin-arm
    • Chrome (web)           • chrome           • web-javascript • Google Chrome 100.0.4896.127

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

logs
Launching lib/main.dart on Redmi K20 Pro in debug mode...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
 Defaulting to yuv420
E/libc    ( 4528): Access denied finding property "persist.vendor.camera.privapp.list"
W/.example.newapp( 4528): type=1400 audit(0.0:1469750): avc: denied { read } for name="u:object_r:vendor_persist_camera_prop:s0" dev="tmpfs" ino=28877 scontext=u:r:untrusted_app:s0:c61,c260,c512,c768 tcontext=u:object_r:vendor_persist_camera_prop:s0 tclass=file permissive=0 app=com.example.newapp
I/Camera  ( 4528): startPreview
I/.example.newap( 4528): ProcessProfilingInfo new_methods=1281 is saved saved_to_disk=1 resolve_classes_delay=8000
W/BpBinder( 4528): PerfMonitor binderTransact :  time=649ms interface=android.hardware.camera2.ICameraDeviceUser code=6
I/Camera  ( 4528): CameraCaptureSession onConfigured
I/Camera  ( 4528): Updating builder settings
D/Camera  ( 4528): Updating builder with feature: ExposureLockFeature
D/Camera  ( 4528): Updating builder with feature: ExposurePointFeature
D/Camera  ( 4528): Updating builder with feature: ZoomLevelFeature
D/Camera  ( 4528): Updating builder with feature: AutoFocusFeature
D/Camera  ( 4528): Updating builder with feature: NoiseReductionFeature
I/Camera  ( 4528): updateNoiseReduction | currentSetting: fast
D/Camera  ( 4528): Updating builder with feature: FocusPointFeature
D/Camera  ( 4528): Updating builder with feature: ResolutionFeature
D/Camera  ( 4528): Updating builder with feature: SensorOrientationFeature
D/Camera  ( 4528): Updating builder with feature: FlashFeature
D/Camera  ( 4528): Updating builder with feature: ExposureOffsetFeature
D/Camera  ( 4528): Updating builder with feature: FpsRangeFeature
I/Camera  ( 4528): refreshPreviewCaptureSession
W/MirrorManager( 4528): this model don't Support
E/flutter ( 4528): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: 'package:flutter/src/rendering/proxy_box.dart': Failed assertion: line 3158 pos 12: '!debugNeedsPaint': is not true.
E/flutter ( 4528): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 4528): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 4528): #2      RenderRepaintBoundary.toImage
E/flutter ( 4528): #3      TakePictureScreenState.build.<anonymous closure>
E/flutter ( 4528): <asynchronous suspension>
E/flutter ( 4528):

I also have the same problem. Is there a solution for this yet?

Have the same problem.

This is the same issue as https://github.com/flutter/flutter/issues/25306, but it's not solved. Instead, https://github.com/flutter/flutter/issues/83856 turn this into a test issue, then https://github.com/flutter/flutter/issues/97853 turn this into a test coverage issue. I think @blasten has already done some good work but the scope is not correct at present. We should definitely support this in the runtime, not only for tests.

Steps to Reproduce

Execute flutter run on the code sample
Press icon button to take screenshot from camera preview.

Expected results: Screenshot should contain camera preview picture.
Actual results: Screenshot doesn't include camera view.
I tested it on Samsung S9, Samsung S20 using Flutter 2.10.5 and 2.13.0-0.2.pre. Same issue happen on iOS, tested on iPhone 12 Pro Max, iOS 15.2.1, Flutter 2.10.5.
I'm aware of existing issues like #25306 which all point to resolved #83856 (comment). However I can't confirm that this feature works.
Code sample
pubspec.yaml
flutter doctor -v
Screenshots Camera surface view:
Screenshot result:

you can use https://pub.dev/packages/ff_native_screenshot to get screenshot by native

I have same problem when taking screenshot from Qr Code Scanner

Cannot capturing widget using https://pub.dev/packages/screenshot after upgrade to flutter 3.3.2 but working fine on 2.8.1

Still having the same issue

Is there even any beta/master channel work on this? It seems a rudimentary feature.
Please convert the test functionality into runtime.

Hey Flutter-Team,
is there any update on this issue?

It still hasn't been fixed yet after 2 years.

Doesn anyone have solution?

There is workaround available here - https://pub.dev/packages/ff_native_screenshot

There is workaround available here - https://pub.dev/packages/ff_native_screenshot

@ycv005 will it take the full screenshot or can we take capture only a the widgets we need

Any workaround how I could combine the https://pub.dev/packages/ff_native_screenshot with some flutter widget screenshot from the RepaintBoundary?
I might also need web support. Any idea?

Any workaround how I could combine the https://pub.dev/packages/ff_native_screenshot with some flutter widget screenshot from the RepaintBoundary?
I might also need web support. Any idea?

take a full screenshot using f f_native_screenshot.
get the desired widget rect.
crop the full screenshot.

isn't it doable?

Closing this issue, because this is as-designed in the compositor.


Ampli CLI code Generation

Expected Behavior
cli status should tell me if I at least triggered once every events
Current Behavior
It is not able to track 1 of the 4 implemented.
Steps to Reproduce

Implement 2 events in the same file
Only 1 of them is detected.

Environment

JS SDK Version:

"amplitude-js": "8.18.3"
"@amplitude/ampli": "1.10.0"
"@types/amplitude-js": "8.16.1"

Installation Method: npm
Browser and Version: Irrelevant

Not quite sure if this is the right place to raise the issue. I could not find a repository for the CLI.

Hi @joelbourbon hoping I can help debug.
The even't detection may be failing based on the event names and how they are converted into Class/method names. Are you able to share the exact Event names that are being detected / not detected?
Thanks!

Hey @justin-fiedler,
Thanks for helping me with this. Unfortunately your example does work on its own but still does not work in my code.
I also had the necessity to wrap the library in a feature flag and to do so elegantly, I wrapped the ampli object in a custom React Hook, returning conditionally the instance and therefore calling the event functions only when the object is defined like so ampli?.accessRequestStarted(). This extra layer, I think, would never allow for the ampli status to work anyways :(
Thanks for your help, but I won't be spending anymore time in fixing this.

Hi @joelbourbon, sorry event detection is still not working in your project. We are in progress of adding a new option to our CLI that will allow you to set the instanceName you want to use for Ampli (which is currently this is hardcoded to "ampli")
I believe this feature might work in your scenario e.g. ampli status --instanceName ampli?. I will let you know when the feature is complete.

Hi @joelbourbon we just released Ampli CLI 1.17.0 that supports setting instanceName, including special characters such as . and ?.
You can now run the following to detect functions such as ampli?.accessRequestStarted().

Update brew upgrade ampli or npm i -g @amplitude/ampli
Check you have 1.17.0 or higher. ampli --version
ampli status --instanceName "ampli?" ampli

Hey @justin-fiedler!
Thanks for the follow-up.
We changed our implementation to go through Segment as of now, so I won't be able to test this.
Pretty sure this would have worked :)


(ansi-term PR 69): make Style methods const fns

https://github.com/ogham/rust-ansi-term/pull/69

Not sure if we can fix this conflict ... might have to close this.

I think we just close this anyway... I don't see the point


[Feature request] React Native support

Currently LangchainJS doesn't support React Native due to it missing several JS symbols, etc. It would be great to see a RN compatible version of this library!

Yes we need this!

An issue I am currently facing when using langchain with React Native is that the url used with the fetch function is missing the base url.
If I add my own fetch function that simply prepends the base url to the url arg and calls the Rract Native fetch, then a forward slash is pretended to the url.
Either way, I get a 404.

Yes I really want to tackle this! Have continually fallen behind.
For now, does specifying a custom url like this help?
https://js.langchain.com/docs/integrations/chat/openai#custom-urls

Yes I really want to tackle this! Have continually fallen behind.
For now, does specifying a custom url like this help?
https://js.langchain.com/docs/integrations/chat/openai#custom-urls

Yes and no.  I got it working by trimming the trailing slash from the url on iOS and Android.
import { ChatOpenAI, ClientOptions, OpenAIChatInput } from '@langchain/openai';
import { Platform } from 'react-native';

export class LangchainService {
  private readonly openAiConfig: Partial<OpenAIChatInput> = {
    openAIApiKey: '***',
    modelName: 'gpt-4',
  };

  private readonly clientConfig = Platform.select<ClientOptions | undefined>({
    web: undefined,
    default: {
      fetch: (url, init) => {
        if (typeof url === 'string') {
          return fetch(
            url.slice(0, url.length - 1), // <-- This fixed it!
            init,
          );
        }
        return fetch(url, init);
      },
    },
  });

  private readonly model = new ChatOpenAI(this.openAiConfig, this.clientConfig);

  async prompt(text: string) {
    return this.model.invoke(text);
  }
}

Here is a before and after in Flipper of the network requests

Before - Not Working

After - Working

Long story short. There doesn't seem to be an issue running Langchain JS in the latest version of React Native 0.73.5. Not sure when it started working and I haven't tried all your features out yet. But just a basic set up works fine. I'll be trying out the parts that may have issues tomorrow i.e. streaming. I'll share my results here.

Ah gross. Do you think we'd have to override/polyfill fetch to get this working in a reasonable way?

Ah gross. Do you think we'd have to override/polyfill fetch to get this working in a reasonable way?

Maybe? But I don't understand why the trailing slash causes a 404, perhaps its the OpenAI API.
You might not have to do anything at all using a different LLM with Langchain.
I'll try hitting the OpenAI API from Postman with and without the slash tomorrow and see if it is just the OpenAI API.

I've played around with the OpenAI API to see where the 404 issue came from. I can confirm that the API does not like trailing slashes. I tried this out in Postman. I'm not sure why the browser fetch implementation removes the trailing slash, but the React Native fetch does not.

https://api.openai.com/v1/chat/completions/
{
    "error": {
        "message": "Invalid URL (POST /v1/chat/completions/)",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

https://api.openai.com/v1/chat/completions
{
    "id": "chatcmpl-90QkixWp8vQqHSn3I6cqWQsTkyCYP",
    "object": "chat.completion",
    "created":<PHONE_NUMBER>,
    "model": "gpt-4-0613",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hello! How can I assist you today?"
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 8,
        "completion_tokens": 9,
        "total_tokens": 17
    },
    "system_fingerprint": null
}

I'll be trying out more features from Langchain JS today to see if they are compatible with React Native.

It looks like the trailing slash is a known issue in the React Native URL polyfill and isn't going to be fixed. See here.

Streaming is proving difficult. Use of both ReadableStream and AsyncGenerator provides a big challenge in React Native with Hermes enabled.

Streaming is proving difficult. Use of both ReadableStream and AsyncGenerator provides a big challenge in React Native with Hermes enabled.

Got it working but I don't think anyone will be happy with the solution... Lots of polyfills... Bundle size increases...

Langchain Streaming in React Native

Install react-native-polyfill-globals - you don't need to apply the patches as the readme suggests.
Install react-native-fetch-api
Install core-js
Add the encoding, readable stream and async generator polyfills to your entry point (i.e. where the app is registered index.jsx/main.jsx/index.tsx/main.tsx):import { polyfill as polyfillEncoding } from 'react-native-polyfill-globals/src/encoding';
import { polyfill as polyfillReadableStream } from 'react-native-polyfill-globals/src/readable-stream';
import 'core-js/modules/es.symbol.async-iterator';

import { AppRegistry } from 'react-native';
import App from './app/App';

polyfillEncoding();
polyfillReadableStream();

AppRegistry.registerComponent('MyApp', () => App);

Modify your Langchain client config to provide a custom fetch function (I am using the ChatOpenAI client):/* eslint-disable @typescript-eslint/no-explicit-any */
import { ChatOpenAI, ClientOptions, OpenAIChatInput } from '@langchain/openai';
import { Platform } from 'react-native';
// @ts-expect-error No typings available.
import { fetch } from 'react-native-fetch-api'; // <-- The package readme suggests this isn't required but it didn't work if I didn't import it.

const model = new ChatOpenAI(
  {
    openAIApiKey: '***',
    modelName: 'gpt-4',
  },
  {
    fetch: (url, init) => {
      if (typeof url === 'string' && url.endsWith('/')) {
        return fetch(url.slice(0, url.length - 1), {
          ...init,
          reactNative: { textStreaming: true },
        } as any);
      }
      return fetch(url, init);
    },
  }
);

Not sure if this is needed, but I reset metro cache and re-ran the app.
Call the stream function:try {
  const readable = await model.stream(text);
  for await (const chunk of readable) {
    console.log(chunk);
  }
} catch (reason) {
  console.warn(reason);
}

Sorry for the TypeScript clutter to those who prefer JavaScript.

I tested with a simple "Hello" prompt, the logger output looks like so:
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": ""}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": "Hello"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": "!"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": " How"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": " can"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": " I"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": " assist"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": " you"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": " today"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": "?"}, "lc": 1, "type": "constructor"}
 LOG  {"id": ["langchain_core", "messages", "AIMessageChunk"], "kwargs": {"additional_kwargs": [Object], "content": ""}, "lc": 1, "type": "constructor"}

Other Notes
There are many different ways you can polyfill the missing features in React Native fetch. The above was the easiest to implement in my opinion.
core-js was critical to getting AsyncGenerator working when using Hermes which is now enabled by default and much better than its predecessor.

Hoo boy... this is going to be a fun one. Thank you so much for your efforts digging here - hopefully we can work some of this into a guide/possibly the framework directly.

After attempting to add more features and other third party libs (various things) I've found that although my above set up kind of works, there can be a lot of issues down the line, polyfill conflicts, breaking other libs, etc.
@jacoblee93 I wouldn't bother trying to update the docs or lib with React Native support. The ideal solution would be a version of langchain written for React Native i.e. using Native Modules. Just to clarify, I'm not directly asking you to do this as it is a big task.
I've started writing a bespoke solution that meets the needs of the application I am creating using Native Modules. Unfortunately this means abandoning langchain for now. Hopefully in the future we - the React Native community - can contribute to a React Native version of langchain.

Damn. I do still really want to dig in deep here. Such a cool use case.
Keep me posted! And thank you for investigating!

Still planned and have actually made a bit of progress - the following polyfill works at least for basic prompt/model chains:
import 'react-native-get-random-values';
import 'react-native-url-polyfill/auto';
import { ReadableStream } from 'web-streams-polyfill/es6';
(globalThis as any).ReadableStream = ReadableStream;

You need to set web-streams-polyfill to ^3 in package.json:
"web-streams-polyfill": "^3"

@david-gettins what do you think of the effort made here https://github.com/julian-hecker/naitive?tab=readme-ov-file It's not my branch, I just ran into it randomly but am not knowledgable enough to know if it solves any of the issues you encountered in a better way. You input would be useful in deciding of I should look into that repo or not..

In case it is useful for this implementation or anyone else that lands on this issue like I did, I ended up building an openai react native client that supports file upload and chat completion streaming without polyfills by using react-native-sse and the expo file system. The library uses the official node sdk everywhere else along with the same types and API.
https://github.com/backmesh/openai-react-native

Expo v52 now supports fetch streaming with the expo/fetch library: https://github.com/expo/expo/blob/main/packages/expo/src/winter/fetch/fetch.ts
More context here: https://x.com/JI/status/1852021277944607161
Is there any easy way to overwrite the fetch function Langchain uses internally?

Not globally, would need to do it individually per integration package.
For OpenAI, you can pass additional raw client params in configuration, though I'm not sure off the top of my head if their SDK has an option for this:
https://js.langchain.com/docs/integrations/chat/openai/#custom-urls
Did the polyfills above not work for you?


Use Standard Style

When I saw #48, I looked to the travis job to see what didn't pass only to find:
$ npm test
><EMAIL_ADDRESS>test /home/travis/build/jsperf/jsperf.com
> lab -t 100 -c -L -r lcov -o lcov.info
npm ERR! Test failed.  See above for more details.

Not very helpful so I ran the tests locally adding a second reporter of "console" to stdout. Sure enough the test was broken, but there were also a lot of linting errors. Some mentioned outdated rules and at that point, I decided to pick a more widely used style that others maintain.
I don't have any strong feelings towards Standard. We could use another rule set. I mostly just want to easily extend a config with eslint.
And with that... I edited every file in the project... but now the tests pass and you can easily see what's wrong when you run the standard npm test
$ npm test

><EMAIL_ADDRESS>test /Users/max/Sites/jsperf.com
> lab -t 100 -c -L -r lcov -o lcov.info -r console -o stdout

  ..................................................
  ..................................................
  ..................................................
  .................

167 tests complete
Test duration: 2824 ms
No global variable leaks detected
Coverage: 100.00%
Linting results: No issues

I'll add some comments on specific parts that changed beyond style

buried inside this is an update to this test that should allow it to pass in multiple locales to resolve #48
Code.expect(relativeDate(d)).to.equal('on ' + d.toLocaleDateString())

ready for review and can be merged if there's no issues :shipit:

I'd prefer the standard semicolon variant fwiw.

@jdalton Me too. But if @maxbeatty prefers it this way, I can live with it.
Either way, :+1: to setting a strict coding standard and automatically checking it!

I don't have a strong opinion regarding semicolons. If there's a tool or trick to add them all back (anything but one at a time :sweat_smile:), I'd be happy to do it

Rock then semistandard it up. Anything to avoid supporting standard really.

Thanks to semistandard-format cli adding back semicolons was pretty painless. Is there anything else to address?

Can the commits be squished where approp.

Is that something we're doing now? If so, will you add directions in CONTRIBUTING.md and go ahead with squishing as an example of what's appropriate?

Hmm.. they're a little out of order, we can skip the squish.


4397 customize the login with org name button color just like background

This closes #4397. @matallo CR this, please. It involves passing the color through the URL because we explicitly need to remove subdomain because of google button referral check, and because color is not available in Central. This works both in the box and in Central

Frontend tests were OK :+1: (details)

:sparkles:

Frontend tests were OK :+1: (details)


Timer reset?

The text should be reset after "x" amount of time.

fixed in d520a2521a866e4d2a5ee0dcedb3c1aa8477133d


fix: standardize svg formatting

Description
Some devs are having issues with certain system svgs not changing color with the font as expected, trying to standardize our svg format a bit to mitigate this. Changed all instances of the black fills on our system svgs to "currentColor" as that makes the most sense.
Also fixed the barge icon which had a white path overtop of a rect so it wouldn't change with the background. Converted this to a path with fill-rule="evenodd" to "cut a hole" in the rectangle instead. @francisrupert this should maybe be updated in figma as well.
Pull Request Checklist

[x] Ask the contributors if a similar effort is already in process or has been solved.
[x] Review the contribution guidelines.
[x] Use staging as your pull request's base branch. (All PRs using production as its base branch will be declined).
[x] Ensure all gulp scripts successfully compile.
[ ] Update, remove, or extend all affected documentation.
[x] Ensure no private Dialpad links or info are in the code or pull request description (Dialtone is a public repo!).

Obligatory GIF (super important!)

Must have been some anomalies not included in there. I'll see if I can update that file to cover more things instead of changing the svgs

Updated gulpfile to handle the cases we were missing.


Hide Previous date

How to hide previous date

Please see the sample application. This is done over and over in the samples.


Fix parent pom in testing_algorithms subprojects

The subprojects of testing_algorithms currently have their arifact ID set to metanome instead of testing_algorithms which sometimes causes the build to fail.
This simply sets the correct artifact ID.

@michaelmior reviewed and accepted

@JoeAtHPI Thanks!

@JoeAtHPI Thanks!


SW-2652 - Add time zone and display to the Monitoring charts

Adding time zone selector to monitoring
Saving selected value on preferences
Default value to seedbank value
Charts not applying timezone yet. Timeseries values come from backend. Should backend receive a time zone or should we transform those values using the selected timezone?

Thoughts on moving the timepicker into a white card and layout horizontally (desktop)? The current version looks a bit off..
I know design will give feedback but we can make our best judgement as well.

Basically another card just like battery and connected status.

@constanzauanini the timestamps are unix timestamps, we just need to transform value with selected time zone. I'm pretty sure the chart library has some time zone option. BE data is already complete.

I will take a look on chart library. Thanks

Thoughts on moving the timepicker into a white card and layout horizontally (desktop)? The current version looks a bit off.. I know design will give feedback but we can make our best judgement as well.

Basically another card just like battery and connected status.

Would that be a card that takes the full width?

Thoughts on moving the timepicker into a white card and layout horizontally (desktop)? The current version looks a bit off.. I know design will give feedback but we can make our best judgement as well.

Basically another card just like battery and connected status.

Would that be a card that takes the full width?

Same row as other cards (share width) .. it’s only a suggestion - but design may not consider it as same category of information. The charts are already pushed down below the fold and with another row they get pushed down further. If you have no preference we can make it another card sharing same row as other cards.

Thoughts on moving the timepicker into a white card and layout horizontally (desktop)? The current version looks a bit off.. I know design will give feedback but we can make our best judgement as well.

Basically another card just like battery and connected status.

Would that be a card that takes the full width?

Same row as other cards (share width) .. it’s only a suggestion - but design may not consider it as same category of information. The charts are already pushed down below the fold and with another row they get pushed down further. If you have no preference we can make it another card sharing same row as other cards.

Yes, same row sounds good 👌

Thoughts on moving the timepicker into a white card and layout horizontally (desktop)? The current version looks a bit off.. I know design will give feedback but we can make our best judgement as well.

Basically another card just like battery and connected status.

Would that be a card that takes the full width?

Same row as other cards (share width) .. it’s only a suggestion - but design may not consider it as same category of information. The charts are already pushed down below the fold and with another row they get pushed down further. If you have no preference we can make it another card sharing same row as other cards.

Yes, same row sounds good 👌

Thanks, this looks good... we could move it to the right so the other 2 (more important) show first?

@constanzauanini you may need to rebase... my recent changes are showing up for review.


TimeAgo + SSR somewhat problematic

Our use of <TimeAgo/> is slightly wonky with SSR:
https://github.com/cloudflare/cloudflare-docs-engine/blob/6faa9d1291d1d4980e6b533a7d4212aa60d96f4a/src/components/docs-tutorials.js#L89-L93
It can flash "N hours ago" and then switch to "3 days ago" on page load for example. This is because the SSR time will be locked in at the last time it was built, but upon hydration it will be from now.
We could potentially use HTMLRewriter to set on the fly.

@adamschwartz and i synced up on this in chat, we're leaning towards:

hiding this element via a CSS data attribute
refreshing the text content via an initial render
removing the data attribute once the initial render has completed

in the situation where the user isn't running javascript, we can use noscript to just show the SSR time:
<style>[data-hide-ssr] { display: none }</style>
<noscript><style>[data-hide-ssr] { display: unset }</style></noscript>

Also re noscript, maybe the SSR time should then just be more like 10/13/2020 as opposed to "2 months ago"?


Note that to get help, you need to run the latest version.
1.2.0
Where is the issue?

Public client

[ ] Device code flow
[ ] Username/Password (ROPC grant)
[x] Authorization code flow

Confidential client

[ ] Authorization code flow
[ ] Client credentials:

[ ] client secret
[ ] client certificate

Token cache serialization

[ ] In-memory cache

Other (please describe)

Is this a new or an existing app?
This is a new app or an experiment.
What version of Go are you using (go version)?
 Then expect the code exchange to work and be authenticated.
Actual behavior
The code exchange does not work. I get the following error here: https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/c3591af567c769d83becf8a8129fb2d5c8c752f4/apps/public/public.go#L677
AADSTS9002327: Tokens issued for the 'Single-Page Application' client-type may only be redeemed via cross-origin requests.
Possible solution
Based on searching around I tried adding a "Origin": "localhost:8082" in the addStdHeaders() function here: https://github.com/AzureAD/microsoft-authentication-library-for-go/blob/c3591af567c769d83becf8a8129fb2d5c8c752f4/apps/internal/oauth/ops/internal/comm/comm.go#L319

Forgot to add that adding the Origin header solved the issue and I was authenticated as expected.

apologies, the code I used was:

func AzureADAuthMiddleware() gin.HandlerFunc {
	return func(c *gin.Context) {
		client, err := public.New("my-app-id", public.WithAuthority("https://login.microsoftonline.com/my-tenant-id"))
		result, err := client.AcquireTokenInteractive(context.TODO(), []string{"openid"}, public.WithRedirectURI("http://localhost:8082"))
		if err != nil {
			c.String(http.StatusUnauthorized, "Unauthorized")
			c.Abort()
			return
		}
		c.Set("account", result)
		c.Next()
	}

}
Github removed some characters

@ericmort Did you find a clean way to add the origin to the headers without changing directly "addStdHeaders()"?


[Autocomplete] Disable focusedTag and remove item by backspace

[x] I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡
There is nice example of GitHub's picker with Autocomplete component.
https://material-ui.com/components/autocomplete/#githubs-picker
As we have renderTags={() => null}, any chips in search field won't show up.
Despite of nothing is shown, backspace will remove last selected item from value of Autocomplete.
Examples 🌈
Just not to remove (invisible) item by backspace :)
disableTagFocus={true} ?
Motivation 🔦
I just implemented similar picker and cannot disabled backspace behavior.

@ypresto this is expected behavior for a multi-select Autocomplete (if there is no text in the search field, backspace will remove the last selected item) You can use the Autocomplete in controlled mode and handle this by user self - https://material-ui.com/components/autocomplete/#controllable-states


flottbot: 0.13.1 -> 0.14.0

Automatic update generated by nixpkgs-update tools. This update was made based on information from passthru.updateScript.
meta.description for flottbot is: Chatbot framework written in Go
meta.homepage for flottbot is: https://github.com/target/flottbot
Updates performed

Ran passthru.UpdateScript

To inspect upstream changes

Release on GitHub

Compare changes on GitHub

Impact
Checks done

built on NixOS
The tests defined in passthru.tests, if any, passed
found 0.14.0 with grep in /nix/store/vpy11lkh7qj5mnd1kcvk8p08r9pnjxx8-flottbot-0.14.0
found 0.14.0 in filename of file in /nix/store/vpy11lkh7qj5mnd1kcvk8p08r9pnjxx8-flottbot-0.14.0

Rebuild report (if merged into master) (click to expand)

2 total rebuild path(s)

2 package rebuild(s)

First fifty rebuilds by attrpath

flottbot

Instructions to test this update (click to expand)

Either download from Cachix:
nix-store -r /nix/store/vpy11lkh7qj5mnd1kcvk8p08r9pnjxx8-flottbot-0.14.0 \
  --option binary-caches 'https://cache.nixos.org/ https://nix-community.cachix.org/' \
  --option trusted-public-keys '
  nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
  cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
  '

(The Cachix cache is only trusted for this store-path realization.)
For the Cachix download to work, your user must be in the trusted-users list or you can use sudo since root is effectively trusted.
Or, build yourself:
nix-build -A flottbot https://github.com/r-ryantm/nixpkgs/archive/453e4c611a51ad8a233f170faffb4f25a470bc35.tar.gz

Or:
nix build github:r-ryantm/nixpkgs/453e4c611a51ad8a233f170faffb4f25a470bc35#flottbot

After you've downloaded or built it, look at the files and if there are any, run the binaries:
ls -la /nix/store/vpy11lkh7qj5mnd1kcvk8p08r9pnjxx8-flottbot-0.14.0
ls -la /nix/store/vpy11lkh7qj5mnd1kcvk8p08r9pnjxx8-flottbot-0.14.0/bin

Pre-merge build results
We have automatically built all packages that will get rebuilt due to
this change.
This gives evidence on whether the upgrade will break dependent packages.
Note sometimes packages show up as failed to build independent of the
change, simply because they are already broken on the target branch.
nixpkgs-review result
Generated using nixpkgs-review.
Command: nixpkgs-review

x86_64-linux

:white_check_mark: 1 package built:

flottbot

Maintainer pings
cc @bryanhonof for testing.

[!TIP]
As a maintainer, if your package is located under pkgs/by-name/*, you can comment @NixOS/nixpkgs-merge-bot merge to automatically merge this update using the nixpkgs-merge-bot.

Add a :+1: reaction to pull requests you find important.

@NixOS/nixpkgs-merge-bot merge


Instance GPG key not recognized if subkey

Gitea version (or commit ref): 1.11.0
Git version: 2.17.2
Operating system: macOS 10.13.6 (17G11023)
Database (use [x]):

[ ] PostgreSQL
[x] MySQL
[ ] MSSQL
[ ] SQLite

Can you reproduce the bug at https://try.gitea.io:

[ ] Yes (provide example URL)
[x] No
[ ] Not relevant

Log gist:

Description
Regarding the new signing functionality introduced in #7631
Gitea only checks for the primary key when checking a commit with gpgSettings:
https://github.com/go-gitea/gitea/blob/master/models/gpg_key.go#L738-L742
If one uses a subkey to sign, this doesn't get recognized in the GUI.
Screenshots

@cleverer Could you confirm the old gitea version worked?

That wouldn't make sense, as the possibility of signed merge commits, repository creations etc. was only introduced in 1.11.0.

Bad bot. Could a member please reopen this?
Is there anything I can do to help get this resolved?

I use subkeys successfully but had issues at the beginning, i had to add the email address of the gpg key also to the account and verify it.

@b90g can you put an example up on try.gitea.io?

(I'm currently working on GPG verification again - so if I can get an example I can get this fixed and backported in to 1.12 PDQ.)

https://try.gitea.io/klaus/lhmmm
<EMAIL_ADDRESS>Key ID: REDACTEDHASH Subkeys: REDACTEDHASH REDCATEDHASH
Added on May 30, 2020 - Valid forever

feel free to request more interaction (altough a lot of requests fail torwards try.gitea.io  from bad gateway to 404..)

To clarify, regular git commits signed with a subkey work just fine. However you can set up Gitea so it signs commits done on the web (eg. when merging or creating a new repo).
If you configure your gitea with a subkey the verification fails. If you pull that repository and check locally with the correct public key, everything is fine.
I think the problem lies somewhere here. I think the parsing of the key doesn't work with subkeys somehow. However I'm not too familiar with Go, so I might be wrong…

Hi!
So that appears to be matching and verifying fine on try

@cleverer could you give me the commands used to create the subkey so I can try to repeat your problem?

Ah figured it out!

👍 Let me know if you still need the instructions or some help in other form! (I think I originally created the subkeys in GPG Keychain for mac, so not sure about the specific commands right now).
#11713 looks very promising though!

If you could have a go with it and confirm it fixes your issue that would be good

I can try to get the PR running tomorrow, but I can't promise anything, I haven't set up a gitea dev-environment and am not really familiar with Go (yet).
Thanks a lot for your effort though!

I can confirm, it works like a charm! Thanks a lot!


Refresh doesn't redraw the screen (should it?)

refresh is documented as
Refresh the display. nextEvent will refresh the display if a resize occurs. If other programs output to the terminal and mess up the display then the application might want to force a refresh.

I was hoping that this operation would attempt to redraw the whole screen, but as far as I can tell it just doesn't do anything. Should it do something?
My test case where I mash p a few times and then hope that l fixes things:
import Control.Exception (bracket)
import Graphics.Vty

main :: IO ()
main =
  bracket (mkVty mempty) shutdown $ \vty ->
    do update vty (picForImage (string defAttr "some string"))
       loop vty

loop :: Vty -> IO ()
loop vty =
  do ev <- nextEvent vty
     case ev of
       EvKey KEsc        _ -> return ()
       EvKey (KChar 'p') _ -> putStrLn "bad news" >> loop vty
       EvKey (KChar 'l') _ -> refresh vty         >> loop vty
       _                   -> loop vty

Should that have worked? Is there some other way to get the redraw effect?

This has been fixed in the associated commit.

Thank you so fixing that so quickly! I'm very excited to have my ^L binding working.

You're welcome. It's now released as 5.8.1.


Testing

So far we have PA-VAE up until 11340 drugs (see #1 ). The models are qsar-tested on 500 test samples.

Aug 16 10:34 averaged_metrics_for_zinc_paired_encoder2_252_to_11340_test_size_500.npy

For SA-VAE, the models from 12600 - 201600 are all qsar-tested on 4500 test samples.

Jul 25 12:07 averaged_metrics_for_all_zinc_encoder_iris2.npy
pasted in excel: (local) SA_VAE model results.xlsx)

(the results not looking good)
To do:

[x] Write the methods to check the decoded SMILES's similarity using Tanimoto similarity (jaccard_similarity on Scikit-learn)
one using one-hot version of the smiles and the other using Morgan FP version
[x] Run SA-VAE QSAR-Eval again on testsizes = 500, like for PA-VAE.

Note on AE-similarity:

X_decoded is often non-integer. For each row (letter), the highest value/prob is taken as 1 and the rest of the values are put as 0.
X_one_hot_decoded might not be able to be translated back to SMILE because they just don't make sense. So I can't use MFP in RDKIT to compare input SMILES and output SMILES for a AE.


Weird bug on login

Step to reproduce:

Create a user with force change password to true
Restart the server
Try to log in. The password update form pops up
Navigate manually to a page like "/upload"
Redirected to the password change form, click "Logout"
Log in again and change password

You get instant logged out for "password changed" whereas you should land on the main layout...
This bug is not that annoying but still weird
Another issue noticed, when redirected to the password change form with redirection to "/upload" in the URL, the redirection vanishes when clicking logout...

Couldn't reproduce the bug, but found another bug where the update password page fails on logout. Fixed it and now everything seems to work just fine.
For the redirect problem, I will try to fix it.


axisTitleData missing in LineChartData

In the doc for the LineChartData
 as well as in the doc comment for it, the axisTitleData is mentioned.
But LineChartData has no axisTitleData, which probably should be there.
Code to reprouce
class Test extends StatelessWidget {
  const Test({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return LineChart(
      LineChartData(
        axisTitleData: AxisTitles(),
      ),
    );
  }
}

You're right. We forgot to update the docs.

So there is no axisTitleData anymore?

We restructured SideTitles. Please read 0.50.0 release note.

Thanks for this quick answer @imaNNeoFighT 👍🏻

In that case I will be updating the docs to remove axisTitleData. I have created a pull request.

Great! Thank you.


How to use this in a JS backend?

I am wanting to use this in my backend in JS. How would I do it using this library?

Hi,
You can use this library in your back end, however, you would still need to generate a request URL and send it to the front end for a user to sign in.
As far as I am aware, Plex does not have the capability of creating an OAuth client and providing a client id/client secret that you can use to authenticate a system rather than a user.
In order to retrieve an authentication token, you usually need to manually sign into Plex at least once: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
Please let me know if this answers your question. If it does, please close this issue.
Thank you

I found a library that works very well for anyone in the future that needs it for a backend. https://github.com/kylmp/Login-With-Plex

Hi @Wamy-Dev,
I think I may have misunderstood your original question. based on the library that you found, you can do the same with plex-oauth. Using a similar example:
Create an instance of the PlexOauth class:
const plexOauth = new PlexOauth({
	clientIdentifier: "<PROVIDE_UNIQUE_VALUE>",
	product: "<NAME_OF_YOUR_APP>",
	device: "<NAME_OF_YOUR_DEVICE>",
	version: "1",
	forwardUrl: "https://localhost:3000",
	platform: "Web",
	urlencode: true
});

Redirect user to the Oauth login page:
App.get('/login', async function(req, res) {
	// Generate OAuth URL and Pin
	const [hostedUILink, pinId] = await plexOauth.requestHostedLoginURL();

	// Save Pin in session
	req.session.pinId = pinId;

	// Reduirect to the OAuth URL for authentication
	res.redirect(hostedUILink);
})

Store auth token and redirect to your application:
App.get('/redirect', async function(req, res) {
	// Get the auth token
	const authToken = await plexOauth.checkForAuthToken(req.session.pinId);

	// Save the auth token to the session
	req.session.authToken = authToken;

	// Delete Pin that is no longer required
	req.session.plexUser = plexUserInfo;
	delete req.session.pinId;

	// Redirect to your app
	res.redirect('/app');
})

Please let me know if this works for you, or if you have any trouble.
Thank you!

Does it fix this problem. I will move to this library if I dont get this error


Replace PROJECT with Yochu

I looked into #6, but couldn't find any differences to https://github.com/giantswarm/example-opensource-repo/blob/master/CONTRIBUTING.md - but I noticed we forgot to replace the projectname. So here we go.
ping @puja108 @JosephSalisbury

LGTM


feat: Add instrumentation for tracking variables in debugging

Description
Problem*
Part of #3015
Summary*
This PR injects instrumentation snippets to the compiled code when running under a debugger to track the values assigned to variables in the program. It also provides the debugging context with necessary support code (in the form of foreign functions) and new functionality to inspect the tracked values.
Instrumentation occurs in two phases:

During parsing, when assignments are detected, they are replaced by a small snippet that captures the value assigned and a temporary identifier for the variable being assigned, and a foreign function (oracle) is called with this information.
At monomorphization time, ie. after the exact types of all variables has been determined, replacing the temporary identifier by a final one which will depend on the variable itself and the type at each instance of the function being compiled (for generic functions). Also, since structs are replaced for tuples during compilation, at this stage field and other member accesses is resolved for the final types (ie. indices in the tuples).

Additional Context
Besides the runtime support in the debugger, the compiler also injects a synthetic crate __debug which holds the definition of the oracle functions used in the injected code for tracking the variables and their assigned values.
These changes were extracted from the dap-with-vars branch of manastech/noir repository where most of the development of this feature occurred. We will submit additional PRs for the remaining features in that branch, notably improved REPL and DAP support to make use of this instrumentation code.
Documentation*
Check one:

[ ] No documentation needed.
[ ] Documentation included in this PR.
[X] [Exceptional Case] Documentation to be submitted in a separate PR.

PR Checklist*

[X] I have tested the changes locally.
[X] I have formatted the changes with Prettier and/or cargo fmt on default settings.

Failures in wasm/compiler are because we're injecting the __debug crate always, regardless of whether we're debugging or not. I'll work on addressing this issue and update the PR.

Fixes #4026

I think this PR would benefit greatly from adding ID types for its variables, types, and fe_vars which all currently use u32 in the source code right now. This makes it hard to tell what a u32 is for without documentation and potentially easy to use a fe_var u32 where a type was expected or vice-versa.

I addressed all comments and made a bunch of changes. I did some renames as well for some of the types and variables that we introduced for the instrumentation. I think the code reads a lot better now and is easier to follow.


ReferenceError: __ is not defined when hitting "Run" button

laravel: 10.48.4
nova: 4.33.1
nova-command-runner: 4.3.5

Same problem

This issue was introduced in 4.3.5. Downgrading to 4.3.4 works as expected.

Tagging @stepanenko3 in case they missed this. I'm having the same issue on:

Laravel 11.7
Nova 4.33.2
Nova command runner: 4.3.5

And this isn't the only issue. Downgrading to <=4.3.4 works (make sure to clear cache, including cached JS in the browser), but results in another issue #36
I downgraded back to 4.2.7 which didn't have either issues.

@stepanenko3 bump in case you missed it 😄


Problem with setting permissions

Hi
I'm trying to implement the admin consent flow for this sample. The flow itself works fine but I'm unable to set the openid, email, profile, and offline_access scopes in the v2 registration portal at apps.dev.microsoft.com because they are not in the Delegated Permissions list.
How can I set these scopes for a v2 app?
Thanks :)

You don't need to specify those in your app registration.
From https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-scopes:

The v2.0 implementation of OpenID Connect has a few well-defined scopes that do not apply to a specific resource: openid, email, profile, and offline_access

Thanks but this unfortunately does not answer my question.
I can request these scopes without any problems using the /tokens endpoint but my question is related to the admin consent. How can an admin consent to these scopes for all users of his organization so that not every user is presented with a consent screen?
This scenario was possible under the v1 endpoint BTW.

@gsacavdm We seem to run into the same problem as htryggva :

we have an registered an app in the v2 app portal with delegated permission 'User.Read' (among others)
the tenant admin has given admin-consent for our app (thus, for scope 'User.Read')

Now, when another user signs in, we request 2 scopes: 'openid' & 'User.Read'. This user is presented a (user-)consent screen. This is not what we expected (we expected no user-consent-screen because of admin-consent).
The admin-consent page said the following:
[our app] needs permission to:
- Read files in all site collections (preview)
- Read user calendars
- Read calendars in all mailboxes
- Read all users' full profiles
- Read all users' basic profiles
- Read all users' full profiles
- Read all files that user can access
- Sign in and read user profile

The user-consent page says the following:
[our app] needs permission to:
- Sign in as you
- Sign you in and read your profile

The Sign in as you permission on the user-consent-page is not present on the admin-consent-page (related to the openid-scope?).
In the readme.md of this project, it says:
Under Delegated Permissions, add the following permissions: [...], openid, [...].
But that is not available on the app-registration-page (any more?)
Can you help htryggva and me with this issue? (or maybe tell us who can help us with this issue?)

To answer my own question:
We contacted Microsoft and got this reply:
[...] It seems like this is a missing item in the registration portal at present. While we work on fixing that, you can [...]
So there will be a fix in the feature.

I looked into this, I'll need more time to confirm the behavoir, but the intended behavior is that you do not need to specify those permissions for admin consent - in particular openid (sign-in). They should be granted by default when you do admin permissions. This is specifically to @MichielK 's point of users getting prompted for consent after admin consent has occurred. If I can confirm repo on that, we'll file a bug.

I'm having the same issues; admin consent is given but all users are still asked for consent.
Any updates on this issue?

I just tried it again and everything sees to be working on my end. Maybe Microsoft fixed the issue? :-)

this has been fixed in the portal now. Closing the issue


Python 3.6.0

I've been holding off on this a bit, trying to decide if it made sense to migrate to 3.6.0 or not. While 3.6.0 is the newest version and there's little reason not to upgrade CPython 3.5.2 to CPython 3.6.0, in the upcoming months it's likely that PyPy3 will be released with production level completion for Python 3.5. That means if we stick with Python 3.5.2 we should be able to pretty easily move over to PyPy3 when that is released.
However, I'm not sure if it makes much sense to care a whole lot about using PyPy here since we purposely offload as much as we can to Varnish. Another consideration is that I can't think of a whole lot in Python 3.6 that is really compelling to move, but I'm happy to consider something if I'm forgetting it.

Ok! I just did it now because the Docker image was just released and I didn't really have a good reason not to move to 3.6, but I wasn't aware that there was a plan to move to PyPy.
I'll close this PR for now so it's not hanging around!

Absolutely! My PyPy plan is not fully formed, more like a "It would be nice if...." kind of deal. If there was something really compelling about 3.6 (or 3.7, or 3.8, etc) and PyPy didn't have plans to support that version yet I'd be fine with moving to it too. It's really just a combination of nothing super compelling in 3.6 and PyPy being zoom zoom.


feat(syntax): add support for graphql_ppx in reason

Adds support for syntax highlighting when using graphql_ppx.
I didn't know how to add them in the same pattern. The first is how refmt formats (at least my code gets formatted that way) and the second is how the examples are formatted.

Thanks. Merged in 8d275f5 🎉


feat: add custom enhancements

feat: Add configuration to hide lyrics on startup
feat: Add auto-hide configuration for APlayer
feat: Add configuration to show APlayer after loading is complete

You create observer and eventListener, i think you should them when unmounted.
How about this?
const { init, destroy } = useMetingLoadObserver()
onMounted(() => {
  init()
})
onUnMounted(() => {
  destroy()
})


Added "include-all" command line option ("a" shortname)…

…to display the entire GTFS-RT message, not  just the entity value. Issue #5 in upstream repo.

Published as<EMAIL_ADDRESS>🎉


HCI reset synchronization

Bluetooth: controller: Prevent HCI reset race with RX thread
When an HCI reset is issued, the HCI RX thread may be in the middle of
processing RX nodes. Normally this is not a problems as the RX/TX
cooperative threads are exclusive. However, if the RX thread yields via
a kernel functions like waiting for a semaphore or netbuffer, the RX
thread may have unfinished business when the reset is executed.
This means that when reset is done, the processing continues, and may
operate on invalidated data.
To prevent this, a new "processing" semaphore is introduced in the RX
thread. Before starting node processing, the semaphore is taken, and
given when processing is done.
The HCI reset function also takes this semahore, thereby preventing
reset starting in the middle of node processing. Whenever the RX thread
takes the semaphore, it checks for reset signal to see if a reset
happened while waiting. In this case the node is discarded.
Swapped order of execution for ull_iso_reset and ull_conn_iso_reset.
It is important that connected ISO reset is performed before general ISO
reset, to prevent race condition in any ongoing data flow.
Bluetooth: controller: Signal HCI reset to recv thread
Synchronize HCI reset with receive thread to prevent processing of
dangling RX nodes.

Re-triggering CI.

I got an action to run a simulation test to see the problem reported by @cvinayak. However, what kind of test would that be, which is not already run in CI?

I believe none of the Babblesim CI tests that involve host have the CONFIG_BT_HCI_RAW and do not use BT_HCI_RESET_SIGNAL set and hence not exercising the changes in this PR, correct me...
My change requested in this PR is only based on testing a build with the two commits added to upstream hci_uart sample and running through the conformance tester which hangs on the first HCI Reset Command being sent to IUT. I have not investigated or debugged as the setup is remote with no possibility to attach a debugger to the running target to get a back trace.

I believe none of the Babblesim CI tests that involve host have the CONFIG_BT_HCI_RAW

Right, forgot about that difference. One thing though; did you solve conflicts when taking in the commits? I noticed that the first commits I pushed were difficult to merge, and left in a merge error in my first attempt. Any chance you could try with the rebased version in the PR now?

Closing this PR as another somewhat similar solution was merged. Will monitor if that solution solves our problem.


1414 jackson ignore examplesetflag

Added the SchemaMixin and MediaTypeMixin to the default Jackson2JsonMapper in order to explicitely ignore exampleFlagSet property of Schema and MediaType.
This addresses #1414 and is more or less a re-adding of #1089 (the fix for #1079).
Additionally added end-to-end testing with respect to the openapi-json.
Any feedback is welcome. I plan to add more end-to-end tests as well as I'm thinking on using the openapi generator to verify the openapi-json

@sauterl what's the status on this?

My apologies, a lot of things were going on. I try to finish the integration tests that would fail, if #1414 would break again. Might be able to open the PR by the end of this week.

No worries, I was just doing some cleaning :)

Long week? :D

Module has been deprecated.

see https://github.com/swagger-api/swagger-core/issues/4381


[Tracking] Cloud Native Sustainability Week 2024 Tokyo

Description

Location/Region: Tokyo, Japan
Hosting Local Community: Cloud Native Community Japan (CNCJ)
Organizers: @sunya-ch @marceloamaral @tatsuhirochiba @rinana @trent-s @YaSuenag @naonishijima @tiwatsuka @nttDamien @bahung @inductor
Sponsors: NTT DATA, Hitachi, the Linux Foundation
Date: 4th October 2024
Event link: community.cncf.io/e/m4m4je/
Call For Speaker: https://sessionize.com/cncj-sustainability-week-japan/?e=3c84e9
Social networks:

Twitter: https://x.com/CloudNativeComm/status/1810953041916612826

Details
To connect people who work in cloud space and care about the environmental sustainability, make an awareness, and have a discussion about how can we realize the green cloud computing together and so on.
To-Do

[X] Review the Meetup Organizer Guide for onboarding.
[X] Check the website.
[X] Create a PR to update the Meetup's table on the website. Example PR.
[X] Join one of the TAG ENV Sustainability Week Syncs to talk about your event.
[X] Find a sponsor for the event.
[X] Find a location for the event.
[X] Set a date for the event.
[x] Announce the event.
[X] Reach out to the Cloud Native Sustainability Week Organizer team to promote the event.

Code of Conduct

[X] I agree to follow this project's Code of Conduct

Comments
No response

Thank you @sunya-ch for creating this 🚀

Hello @sunya-ch
I hope you're doing well. With just a few weeks left, I wanted to check in and see if you need any help with anything.

To-Do (During Execution)
What specific actions to do during event execution?

[ ] Use the Artworks and Presentation Template. You can use some slides in the template at the begining of the event for introducing the cloud native sustainability week event.

[ ] Distribute the feedback survey to attendees. Use the Survey Blueprint.

Record the event with photos or video recordings.
To-Do (After Event)
What specific actions to do after the event?

[ ] Share the event records, summary via blog post, recordings to #tag-env-cloud-native-sustainability-week slack channel.

[ ] Share the survey summary from attendees.

[ ] Leave feedbacks/comments (KEEP DOING, MORE OF, START DOING, STOP DOING, LESS OF, IDEAS) about organzing the event in this issue.

[ ] Submit the information of organizers, speakers to issue the credly badges. [to put the submission form here]

Pictures uploaded on event page: https://community.cncf.io/events/details/cncf-cloud-native-community-japan-presents-cncf-cloud-native-sustainability-week-2024-local-meetup-tokyo/
Blog post: https://github.com/cncf/tag-env-sustainability/issues/547
Youtube Video Recording: https://www.youtube.com/playlist?list=PLP6cDU-AhHU6CI6VpFQ11XigCt3kqFDLT

Feedback from Organizers
KEEP DOING

cooperate with TAG ENV
MORE OF
promoting together in large event
promoting CFS/demos/LTs
checking live video (event issue: cannot seen screen, video lag)
START DOING
fix format of presentation for smooth flow (all PDF?)
STOP DOING
expecting prompt engagement from participants
LESS OF
food overestimation
IDEAS
add pre-event form to get real first name, last name, and company name
co-located with OSS japan or GSF event next year

Hi! Just a reminder to submit all the speakers and organizers' information for Credly badges using this form https://forms.gle/KHizxY47h3ynEBUL9

Hi! Just a reminder to submit all the speakers and organizers' information for Credly badges using this form https://forms.gle/KHizxY47h3ynEBUL9

Thank you @vallss. Done :)

Closing this since all the main activities were completed. Thanks to everyone who made this local event possible and contributed! 🔝


Add support for an @export tag

/**
 * @export
 * @typedef {{a: number}}  X
*/

export {};

Note, this is different from the @exports tag defined in http://usejsdoc.org/tags-exports.html

Does this comment turn the file into a module without an export {}?

Does this comment turn the file into a module without an export {}?

i suppose so.

The docs of @export for Closure seem to me to be similar to jsdoc's @exports, though the latter was focused on its own module names while Closure was focused on generated symbols.
One use case I'm coming across would be for class-producing factories.
AFAICT, there is no good JSDoc-only-based way with TS to specify that for something like the following that a private class (in this case EspreeParser) is meant to be made available as an export from this file for type purposes. If it were being exported directly, it would not be a problem, but it seems there is no way to indicate it should be exported as a constructor along with its type pattern:
export default () => {
    return Parser => {
        // Read static properties from `Parser`
        const tokTypes = /** @type {EnhancedTokTypes} */ (Object.assign({}, Parser.acorn.tokTypes));

        return class EspreeParser extends Parser {
            // Use the static properties like `tokTypes` within instance methods of the class
        };
}

The only terribly hackish way I could do this with our project goal of seeking to keep the definitions inline within the file (and not in a declaration file) was to export a separate EspreeParser class at the root of the document, with that class being bare-bones but actual JavaScript with necessary JSDoc-based type hints and then referring to that type, e.g.:
export class EspreeParser extends acorn.Parser {

    /**
     * Constructor for EspreeParser
     * @param {ParserOptions} options The parser options
     * @param {string} input The input text
     * @param {number} [startPos] The starting position
     */
    constructor(options, input, startPos) {
        super(/** @type {acorn.Options} */ (options), input, startPos);
    }

    // Other bare-bones methods here...
}

Using @typedef with a new declaration would not get me the behavior of extending another class yet not being bound, ala & intersection, to adhere to all of the same class signatures.
So if there were an @exports tag of sorts, I could indicate a name and fact of exporting of the inner return class EspreeParser extends Parser  class so its type could be accessed by other files.
While JSDoc with @typedef is only marginally more expansive than plain TypeScript, with classes it becomes really awkward especially when needing to extend a class--not to mention requiring exposing a useless export to users were we to use this very ugly approach and not just give in and use a declaration file for the private class.
An alternative would be allowing one to define a class within the type portion of @typedef but that does not seem possible currently.


sc.pl.stacked_violin: issue using imported adata

Hi,
I am testing sc.pl.stacked_violin and I had an issue with running it on an AnnData variable that is imported from a h5ad file. I explain.
If I run:
>>> import scanpy.api as sc
>>> adata = sc.datasets.krumsiek11()
>>> sc.pl.stacked_violin(adata, adata.var_names, 'cell_type', use_raw=False, color='blue', show=False)

No problem, but if I run:
>>> import scanpy.api as sc
>>> adata = sc.datasets.krumsiek11()
>>> adata.write('anndata.h5ad')
>>> adata = sc.read_h5ad('anndata.h5ad')
>>> sc.pl.stacked_violin(adata, adata.var_names, 'cell_type', use_raw=False, color='blue', show=False)

then I got the error:
Traceback (most recent call last):
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/scanpy/plotting/anndata.py", line 896, in stacked_violin
    orient='vertical', scale=scale, ax=ax, **kwds)
  File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 2387, in violinplot
    color, palette, saturation)
  File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 562, in __init__
    self.establish_variables(x, y, hue, data, orient, order, hue_order)
  File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 155, in establish_variables
    raise ValueError(err)
ValueError: Could not interpret input 'variable'

I tested it with versions 1.3.1 and 1.3.2, installed with bioconda.
Any idea?
Bérénice

Very strange. variable is some assigned name after an internal pandas.melt.
First, I would not recommend to plot all  adata.var_names unless they are fewer (<30). But that seems not to be the problem.
To discard a problem with seaborn violin plot, can you try sc.pl.matrixplot instead?
Also, do you get the same output in both cases after
adata.obs.head()

Not exactly the same head:
>>> adata = sc.datasets.krumsiek11()
>>> adata.obs.head()
    cell_type
0  progenitor
1  progenitor
2  progenitor
3  progenitor
4  progenitor
>>> adata.write('anndata.h5ad')
>>> adata = sc.read_h5ad('anndata.h5ad')
>>> adata.obs.head()
        cell_type
index
0      progenitor
1      progenitor
2      progenitor
3      progenitor
4      progenitor

Can you try:
sc.pl.stacked_violin(adata, adata.var_names[:10], groupby='cell_type',
use_raw=False, color='blue', show=False)

The second parameter for stakec_violin is a list of genes, but it should be
on a range that is amenable for plotting meaning <30 genes. In your example
you provide most likely thousands. I don't know if the error is related to
this but we can narrow down the problem.
Maybe the examples here can help you:
https://gist.github.com/fidelram/2289b7a8d6da055fb058ac9a79ed485c
On Mon, Oct 22, 2018 at 1:42 PM Bérénice Batut<EMAIL_ADDRESS>wrote:

Hi,
I am testing sc.pl.stacked_violin and I had an issue with running it on
an AnnData variable that is imported from a h5ad file. I explain.
If I run:

import scanpy.api as sc
adata = sc.datasets.krumsiek11()
sc.pl.stacked_violin(adata, adata.var_names, 'cell_type', use_raw=False, color='blue', show=False)

No problem, but if I run:

import scanpy.api as sc
adata = sc.datasets.krumsiek11()
adata.write('anndata.h5ad')
adata = sc.read_h5ad('anndata.h5ad')
sc.pl.stacked_violin(adata, adata.var_names, 'cell_type', use_raw=False, color='blue', show=False)

then I got the error:
Traceback (most recent call last):
Traceback (most recent call last):
File "", line 1, in
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/scanpy/plotting/anndata.py", line 896, in stacked_violin
orient='vertical', scale=scale, ax=ax, **kwds)
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 2387, in violinplot
color, palette, saturation)
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 562, in init
self.establish_variables(x, y, hue, data, orient, order, hue_order)
File "/miniconda3/envs/scanpy/lib/python3.6/site-packages/seaborn/categorical.py", line 155, in establish_variables
raise ValueError(err)
ValueError: Could not interpret input 'variable'
I tested it with versions 1.3.1 and 1.3.2, installed with bioconda
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/theislab/scanpy/issues/318, or mute the thread
https://github.com/notifications/unsubscribe-auth/AEu_1RQhpzCd2j00XyUqCiVkWLZo96vZks5una8NgaJpZM4XzO0F
.

I can reproduce the problem. I will take a look


[VL] Test: Daily Update Velox Version (20231211)

Dependency https://github.com/zhztheplayer/velox/tree/wip-rebase-231211

Fixed by https://github.com/oap-project/gluten/pull/3999.


block crashes

after testing the current-scope example and removing some code block seems to be the cause of the crash
(defvar x 5)
(current-scope x)
(block
  (defvar x 10)
  (current-scope x)
)

fish: Job 1, '~/Documents/GIT/crow/crow crowD…' terminated by signal SIGSEGV (Address boundary error)

Looks like another garbage collector issue, I hadn't tested block extensively when implementing the new closure cleanup system (which is what block uses) so it probably is trying to access values that are freed. Will investigate.


[release-4.15] CNF-11641: seedgen: Use RELATED_IMAGE_RECERT_IMAGE, if available

This is a manual cherry-pick of https://github.com/openshift-kni/lifecycle-agent/pull/388
/cc @browsell

/lgtm
/approve


Fix a failed link about contribution guidelines.

Thanks @primetang for fixing this and sorry for the late response on this.


Dask error on xarray.corr

What happened:
When I use xarray.corr on two Dataarrays I get a NameError: name 'dask' is not defined error. Notice that dask is not installed in my environement.
What you expected to happen:
Obtain the correlation values without dask interfering (as it should be optional in my understanding)
Minimal Complete Verifiable Example:
N = 100
ds = xr.Dataset(
    data_vars={
        'x': ('t', np.random.randn(N)),
        'y': ('t', np.random.randn(N))
    },
    coords={
        't': range(N)
    }
)
xr.corr(ds['y'], ds['x'])

Results in:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/tmp/ipykernel_732567/1992585666.py in <module>
----> 1 xr.corr(ds['y'], ds['x'])

~/.local/share/virtualenvs/e-sport-ml-IJ_mJ64l/lib/python3.8/site-packages/xarray/core/computation.py in corr(da_a, da_b, dim)
   1343         )
   1344
-> 1345     return _cov_corr(da_a, da_b, dim=dim, method="corr")
   1346
   1347

~/.local/share/virtualenvs/e-sport-ml-IJ_mJ64l/lib/python3.8/site-packages/xarray/core/computation.py in _cov_corr(da_a, da_b, dim, ddof, method)
   1371             return da
   1372
-> 1373     da_a = da_a.map_blocks(_get_valid_values, args=[da_b])
   1374     da_b = da_b.map_blocks(_get_valid_values, args=[da_a])
   1375

~/.local/share/virtualenvs/e-sport-ml-IJ_mJ64l/lib/python3.8/site-packages/xarray/core/dataarray.py in map_blocks(self, func, args, kwargs, template)
   3811         from .parallel import map_blocks
   3812
-> 3813         return map_blocks(func, self, args, kwargs, template)
   3814
   3815     def polyfit(

~/.local/share/virtualenvs/e-sport-ml-IJ_mJ64l/lib/python3.8/site-packages/xarray/core/parallel.py in map_blocks(func, obj, args, kwargs, template)
    332             )
    333
--> 334     if not dask.is_dask_collection(obj):
    335         return func(obj, *args, **kwargs)
    336

NameError: name 'dask' is not defined

Environment:
INSTALLED VERSIONS
------------------
commit: None
python: 3.8.6 (default, Dec 16 2020, 11:33:05)
[GCC 10.2.0]
python-bits: 64
OS: Linux
OS-release: 5.13.6-arch1-1
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: None

xarray: 0.19.0
pandas: 1.3.1
numpy: 1.21.1
scipy: 1.7.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: 3.3.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.4.2
cartopy: None
seaborn: 0.11.1
numbagg: None
pint: None
setuptools: 51.0.0
pip: 20.3.1
conda: None
pytest: None
IPython: 7.26.0
sphinx: None

Thanks @Gijom , I can repro.
I think the fix should be fairly easy, if someone wants to take a swing. I'm not sure why the existing tests don't cover it.

The responsible code for the error originally comes from the call to da_a = da_a.map_blocks(_get_valid_values, args=[da_b]), which aim is to remove nan values from both DataArrays. I am confused by this given that the code lines below seems to accumplish something similar (despite of the comment saying it is not):
# 4. Compute covariance along the given dim
# N.B. `skipna=False` is required or there is a bug when computing
# auto-covariance. E.g. Try xr.cov(da,da) for
# da = xr.DataArray([[1, 2], [1, np.nan]], dims=["x", "time"])
    cov = (demeaned_da_a * demeaned_da_b).sum(dim=dim, skipna=True, min_count=1) / (
        valid_count
    )

In any case, the parrallel module imports dask in a try catch block to ignore the import error. So this is not a surprise that when using dask latter there is an error if it was not imported. I can see two possibilities:

encapsulate all dask calls in a similar try/catch block
set a boolean in the first place and do the tests only if dask is correctly imported

Now I do not have any big picure there so there are probably better solutions.

I had a look to it this morning and I think I managed to solve the issue by replacing the calls to dask.is_dask_collection by is_duck_dask_array from the pycompat module.
For (successful) testing I used the same code as above plus the following:
ds_dask = ds.chunk({"t": 10})

yy = xr.corr(ds['y'], ds['y']).to_numpy()
yy_dask = xr.corr(ds_dask['y'], ds_dask['y']).to_numpy()
yx = xr.corr(ds['y'], ds['x']).to_numpy()
yx_dask = xr.corr(ds_dask['y'], ds_dask['x']).to_numpy()
np.testing.assert_allclose(yy, yy_dask), "YY: {} is different from {}".format(yy, yy_dask)
np.testing.assert_allclose(yx, yx_dask), "YX: {} is different from {}".format(yx, yx_dask)

The results are not exactly identical but almost which is probably due to numerical approximations of multiple computations in the dask case.
I also tested the correlation of simple DataArrays without dask installed and the result seem coherent (close to 0 for uncorrelated data and very close to 1 when correlating identical variables).
Should I make a pull request ? Should I implement this test ? Any others ?

That sounds great @Gijom ! Thanks for working through that. A PR would be welcome!
In the tests, we should be running this outside a @requires_dask decorated test, so that this gets tested without dask. If you can find that, great, otherwise someone can help.

Thanks @Gijom this is a dupe of https://github.com/pydata/xarray/issues/3391
Please send your changes in a pull request, we'd be happy to merge it after reviewing. Thank you!


Model perform well when using flash_attention_2 or SDPA, but it output "!!!!" when using the original attention (i.e., attn_implementation="eager")

I found this issue when working with the lmms-lab/llava-onevision-qwen2-7b-ov model and qwen2vl.（the transformers library is the latest version.）
Code
import json
import argparse
from PIL import Image
import copy
import torch
import accelerate

from llava.model.builder import load_pretrained_model
from llava.mm_utils import process_images, tokenizer_image_token
from llava.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN
from llava.conversation import conv_templates

def main(args):
    accelerator = accelerate.Accelerator()
    llava_model_args = {
            "multimodal": True,
        }
    overwrite_config = {}
    overwrite_config["image_aspect_ratio"] = "pad"
    llava_model_args["overwrite_config"] = overwrite_config

    tokenizer, model, image_processor, max_length = load_pretrained_model(
        model_path=args.pretrained_model_name_or_path,
        model_base=None,
        model_name=args.model_name,
        device_map=accelerator.device,
        attn_implementation=args.attn_implementation,
        **llava_model_args
    )
    model.eval()

    info = json.loads(open(args.data_path,'r',encoding="utf-8").read())
    model = accelerator.prepare(model)
    if accelerator.num_processes > 1:
        model = model.module

    cnt = -1
    for item in info:
        cnt += 1
        context = item["context"]
        context = context.replace("<ImageHere>", DEFAULT_IMAGE_TOKEN)
        images = item["raw_img_list"]
        images = [Image.open(img) for img in images]
        images = process_images(images, image_processor, model.config)
        images = [img.to(dtype=torch.float16, device=accelerator.device) for img in images]

        conv = copy.deepcopy(conv_templates[args.conv_template])
        conv.append_message(conv.roles[0], context)
        conv.append_message(conv.roles[1], None)
        prompt_question = conv.get_prompt()

        input_ids = tokenizer_image_token(prompt_question, tokenizer, IMAGE_TOKEN_INDEX, return_tensors="pt").unsqueeze(0).to(accelerator.device)
        image_sizes = [img.size for img in images]

        try:
            cont = model.generate(
                input_ids,
                images=images,
                image_sizes=image_sizes,
                do_sample=False,
                temperature=0,
                max_new_tokens=4096,
            )
        except Exception as e:
            print(e)
            continue
        result = tokenizer.batch_decode(cont, skip_special_tokens=True)
        result = result[0]

        print(result)

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("--pretrained_model_name_or_path", type=str, default="lmms-lab/llava-onevision-qwen2-7b-ov")
    parser.add_argument("--model_name", type=str, default="llava_qwen")
    parser.add_argument("--root_path", type=str, default="******")
    parser.add_argument("--data_path", type=str, default="******")
    parser.add_argument("--attn_implementation", type=str, default="eager", choices=["eager", "flash_attention_2", "sdpa"])
    parser.add_argument("--conv_template", type=str, default="qwen_1_5")

    return parser.parse_args()

if __name__ == "__main__":
    main(parse_args())

same question.
When using attn_implementation="eager", the “llava-onevision-qwen2-0.5b-si” model works normally, but the “llava-onevision-qwen2-7b-ov” model constantly outputs “!!!”.

same question. When using attn_implementation="eager", the “llava-onevision-qwen2-0.5b-si” model works normally, but the “llava-onevision-qwen2-7b-ov” model constantly outputs “!!!”.

llava-onevision-qwen2-7b-ov+sdpa:
The video features a person standing on a stage, dressed in a black shirt and dark pants. A large hand appears from the background, reaching towards the person's pocket. The text 'Source: Joshua AG' is displayed at the top left corner of the frames, and 'EVAN CARMICHAEL' is shown in the top right corner. The text 'Anyone know what this pocket is for?' appears as the hand continues to reach into the pocket. The person then looks down at their pocket, and the text 'I've always wondered that' appears.  The person holds up the iPod Nano, and the text 'is the new iPod Nano' appears. The video concludes with a close-up of the person holding the iPod Nano, showing it from different angles.
llava-onevision-qwen2-7b-ov+eager:
The!! video!!!!!!!!!!!
llava-onevision-qwen2-0.5b-ov+sdpa:
The video features a person standing on a stage, holding a pair of jeans in front of them. The background is dark with a large hand reaching towards the jeans, causing it to appear as if someone is pulling or pushing it. The text 'Anyone know what this pocket' appears at the bottom left corner, and 'is for?' appears at the bottom right corner. The scene then transitions to show the same person now holding an iPod Nano o, which is white with a black screen. The text 'this is the new' appears at the bottom center of the frame. Finally, the person holds up a pen, indicating they are about to write something.
llava-onevision-qwen2-0.5b-ov+eager:
The video features a person standing on a stage, holding a pair of jeans in front of them. The background is dark with a large hand reaching towards the jeans, causing it to appear as if someone is pulling or pushing it. The text 'Anyone know what this pocket' appears at the bottom left corner, and 'is for?' appears at the bottom right corner. The scene then transitions to show the same person now holding an iPod Nano o, which is white with a black screen. The text 'this is the new' appears at the bottom center of the frame. Finally, the person holds up a pen, indicating they are about to write something.

same question. When using attn_implementation="eager", the “llava-onevision-qwen2-0.5b-si” model works normally, but the “llava-onevision-qwen2-7b-ov” model constantly outputs “!!!”.

llava-onevision-qwen2-7b-ov+sdpa: The video features a person standing on a stage, dressed in a black shirt and dark pants. A large hand appears from the background, reaching towards the person's pocket. The text 'Source: Joshua AG' is displayed at the top left corner of the frames, and 'EVAN CARMICHAEL' is shown in the top right corner. The text 'Anyone know what this pocket is for?' appears as the hand continues to reach into the pocket. The person then looks down at their pocket, and the text 'I've always wondered that' appears.  The person holds up the iPod Nano, and the text 'is the new iPod Nano' appears. The video concludes with a close-up of the person holding the iPod Nano, showing it from different angles.
llava-onevision-qwen2-7b-ov+eager: The!! video!!!!!!!!!!!
llava-onevision-qwen2-0.5b-ov+sdpa: The video features a person standing on a stage, holding a pair of jeans in front of them. The background is dark with a large hand reaching towards the jeans, causing it to appear as if someone is pulling or pushing it. The text 'Anyone know what this pocket' appears at the bottom left corner, and 'is for?' appears at the bottom right corner. The scene then transitions to show the same person now holding an iPod Nano o, which is white with a black screen. The text 'this is the new' appears at the bottom center of the frame. Finally, the person holds up a pen, indicating they are about to write something.
llava-onevision-qwen2-0.5b-ov+eager: The video features a person standing on a stage, holding a pair of jeans in front of them. The background is dark with a large hand reaching towards the jeans, causing it to appear as if someone is pulling or pushing it. The text 'Anyone know what this pocket' appears at the bottom left corner, and 'is for?' appears at the bottom right corner. The scene then transitions to show the same person now holding an iPod Nano o, which is white with a black screen. The text 'this is the new' appears at the bottom center of the frame. Finally, the person holds up a pen, indicating they are about to write something.

I have already raised an issue in the transformers repo, and I suspect the problem might originate from the Qwen2LM code. huggingface/transformers#33615

same， what a annoying problem

Try to use bf16 to load the model, instead of fp16.

e.g:
tokenizer, model, image_processor, max_length = load_pretrained_model(pretrained, None, model_name, torch_dtype="bfloat16", device_map=device_map)  # Add any other thing you want to pass in llava_model_args

e.g:
tokenizer, model, image_processor, max_length = load_pretrained_model(pretrained, None, model_name, torch_dtype="bfloat16", device_map=device_map) # Add any other thing you want to pass in llava_model_args

thanks for your reply. it works for easy task, but the problem still exists when task become complex.
EASY TASK
[QUESTION]
'Deliver concise, accurate answers to questions prompted by the images\n\nContext:  \n\nQuestion: What is the special magic Thimphu number in the images?\nRespond with the answer and your thought process for reasoning.'
[MODEL_OUTPUT]
'!425900'
[EXPECTED ANSWER]
'425900'
COMPLEX TASK
[QUESTION]
I will give you some pictures, and each group of pictures will correspond to a question. Please answer it briefly. You must choose your answer from the Choice List. \nQuestion: what is the title for the name robert kauk ?\nChoice list: \nA. VICE PRESIDENT, BRUSH BEET GROWERS ASS'N\nB. TREASURER, BRUSH BEET GROWERS ASS'N\nC. PRESIDENT, BRUSH BEET GROWERS ASS'N\nD. SECRETARY, BRUSH BEET GROWERS ASS'N\n\nRespond with the answer and your thought process for reasoning."
[MODEL_OUTPUT]
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'


[Feature Request] Customizable "tab" label (different from "tabs")

I have noticed that in the tabline.vim file, the part of the tabline which shows which tab you are on out of the total (i.e. "tab 2/7") is hardcoded to say "tab":
    call a:dict.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))

I was originally hoping that g:airline#extensions#tabline#tabs_label would also affect this; would it be possible to add a setting to the tune of g:airline#extensions#tabline#tab_label which affects the hardcoded portion?

sure, please go ahead and create a PR for this.