Resolve input file collections independent of snapshotting

Fixes https://github.com/gradle/gradle/issues/13276

@bot-gradle test QFL please.

OK, I've already triggered the following builds for you:

QuickFeedbackLinux build

@bot-gradle test QFL please.

OK, I've already triggered the following builds for you:

QuickFeedbackLinux build

@bot-gradle test QFL please.

OK, I've already triggered the following builds for you:

QuickFeedbackLinux build

@bot-gradle test PT QFL please.

OK, I've already triggered the following builds for you:

AllPerformanceTestsReadyForNightly build
QuickFeedbackLinux build

OK, I've already triggered the following builds for you:

AllPerformanceTestsReadyForNightly build
QuickFeedbackLinux build

@bot-gradle test PT QFL please.

OK, I've already triggered the following builds for you:

AllPerformanceTestsReadyForNightly build
QuickFeedbackLinux build

@bot-gradle test PT QFL please.

OK, I've already triggered the following builds for you:

AllPerformanceTestsReadyForNightly build
QuickFeedbackLinux build

@bot-gradle test PT QFL please.

OK, I've already triggered the following builds for you:

AllPerformanceTestsReadyForNightly build
QuickFeedbackLinux build

@bot-gradle help

Currently, the following commands are supported:
@bot-gradle test <BuildTrigger1> <BuildTrigger2> ... <BuildTriggerN>

A trigger is a special build for this PR on TeamCity, common triggers are:

SanityCheck/CompileAll/QuickFeedbackLinux/QuickFeedback/PullRequestFeedback/ReadyForNightly/ReadyForRelease
Shortcuts: SC/CA/QFL/QF/PRF/RFN/RFR
Specific builds:

BD: BuildDistributions/BuildDocs so that you can preview the generated docs/distribution.
PT: PerformanceTest, all performance tests for Ready For Nightly stage.
APT: AllPerformanceTest, all performance tests, including slow performance tests.
AST: AllSmokeTestsPullRequestFeedback
AFT: AllFunctionalTestsPullRequestFeedback
ASB: AllSpecificBuildsPullRequestFeedback
ACC: AllConfigCacheTestsPullRequestFeedback
ACT: AllCrossVersionTestsReadyForNightly
AFTN: AllFunctionalTestsReadyForNightly
ACTR: AllCrossVersionTestsReadyForRelease
AFTR: AllFunctionalTestsReadyForRelease

@bot-gradle test and merge

queues this PR for testing and merges if all tests pass by:

Creating a merge commit from your PR branch HEAD and the target branch
Running a ReadyForNightly build against the merge commit
When it passes, fast-forward the target branch to this merge commit (i.e. merge the PR)

The merge commit is called a pre-tested commit, which means that it fully tests the integration
of your branch HEAD and latest master, instead of only testing your branch HEAD.
@bot-gradle cancel

cancel a running pre-tested commit build or remove it from queue

@bot-gradle clean

clear the conversation history

@bot-gradle help

display this message

To run a command, simply submit a comment.  For detailed instructions see here.

@bot-gradle test PT QFL please.

OK, I've already triggered the following builds for you:

AllPerformanceTestsReadyForNightly build
QuickFeedbackLinux build

@bot-gradle test QFL please.

OK, I've already triggered the following builds for you:

QuickFeedbackLinux build

@bot-gradle test QFL please.

OK, I've already triggered the following builds for you:

QuickFeedbackLinux build

Superseded by https://github.com/gradle/gradle/pull/21861.


What are the implications of this model?

Is this model feasible and ready to start being implemented on a massive scale? Do you think it's useful? What do you think in general about Megabyte?

the paper demonstrates that one can learn a tokenizer end-to-end, starting from character representations, without having to worry about BPE, sentencepiece etc.
if one wants to extend the vision further, the end result may be a generalized architecture for learning hierarchical (multiscale) representations on any modality.

@kyegomez more research needed, but i've seen multiple papers attempt this already with good results, so i'm personally bullish on the direction

Is it easily integratabtle with vanilla transformers or does the entire transformer architecture have to change to accomodate MEGABYTE?

@kyegomez it won't work with a few minor modifications to existing transformer libraries, if that is what you mean

@kyegomez but still quite simple. the repository is < 400 loc


Implementing Interrupt and exception ?

Let me thank you for providing the repository. This is super good to learn RISC-V core !!
My question is that does the core have interrupt and exception? (As far as my looking, I cannot find them)
If not, will the core be extended to implement such functions and update the repository?
Best,

This is a minimal implementation meant for teaching - it's used for an entry-level course in University of Wrocław. If it gets extended by interrupt and exception support (or other features from the Privileged Architecture volume), it's only if it can be done without making the core more complex.


SDK missing libqmldbg_messages.so, CMake fails

Hi,
I'm currently trying to build an SDK for my QtWaylandCompositor project with the master branch.
The SDK builds just fine with this little patch (at the moment X11 is included for other tests):
diff --git a/recipes-qt/packagegroups/packagegroup-qt5-toolchain-target.bb b/recipes-qt/packagegroups/packagegroup-qt5-toolchain-target.bb
index 8c8bed3..8d99332 100755
--- a/recipes-qt/packagegroups/packagegroup-qt5-toolchain-target.bb
+++ b/recipes-qt/packagegroups/packagegroup-qt5-toolchain-target.bb
@@ -19,7 +19,6 @@ USE_WAYLAND = " \
 # Requires X11 to work
 USE_X11 = " \
     qtx11extras-dev \
-    qtx11extras-mkspecs \
 "

 RDEPENDS_${PN} += " \

Which was hinted by:
Error:
 Problem: conflicting requests
  - nothing provides qtx11extras-mkspecs needed by packagegroup-qt5-toolchain-target-1.0-r0.aarch64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Now with the SDK installed, I'm trying to configure my QtWaylandCompositor project (which builds fine inside the core image) using CMake, which fails due to a missing library:
$ cmake ..
-- Toolchain file defaulted to '/home/user/test/sdk/sysroots/x86_64-test-linux/usr/share/cmake/OEToolchainConfig.cmake'
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /home/user/test/sdk/sysroots/x86_64-test-linux/usr/bin/aarch64-test-linux/aarch64-test-linux-gcc
-- Check for working C compiler: /home/user/test/sdk/sysroots/x86_64-test-linux/usr/bin/aarch64-test-linux/aarch64-test-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/user/test/sdk/sysroots/x86_64-test-linux/usr/bin/aarch64-test-linux/aarch64-test-linux-g++
-- Check for working CXX compiler: /home/user/test/sdk/sysroots/x86_64-test-linux/usr/bin/aarch64-test-linux/aarch64-test-linux-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:32 (message):
  The imported target "Qt5::Qml" references the file

     "/home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/plugins/qmltooling/libqmldbg_messages.so"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Qml/Qt5Qml_QDebugMessageServiceFactory.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:209 (_qt5_Qml_check_file_exists)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Qml/Qt5Qml_QDebugMessageServiceFactory.cmake:5 (_populate_Qml_plugin_properties)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Qml/Qt5QmlConfigExtras.cmake:4 (include)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:224 (include)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5QmlModels/Qt5QmlModelsConfig.cmake:117 (find_package)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake:117 (find_package)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5WaylandCompositor/Qt5WaylandCompositorConfig.cmake:117 (find_package)
  /home/user/test/sdk/sysroots/aarch64-test-linux/usr/lib/cmake/Qt5/Qt5Config.cmake:33 (find_package)
  CMakeLists.txt:26 (find_package)

-- Configuring incomplete, errors occurred!

I could not yet get rid of Qml in the SDK (as my project is pure C++). Maybe someone could give me a hint.
For me, this boils down to two questions:

How can the missing libqmldbg_messages.so be added?
How can the Qml part be omitted from the SDK?

I'd be glad to get some insight. :slightly_smiling_face:
Thanks in advance,
Flössie

Yet another question comes to my mind:

Is there a way to (ab)use the yocto tree directly for an out-of-tree build of a single component without first building and installing the SDK?

Thanks,
Flössie


[DTLS] potentially incorrect/buggy behavior of webrtc_dtls::crypto::verify_signature

I'm writting a WebRTC MCU "Client". After the ICE gathering finished, the MCU server initiates a DTLS connection. However, the server certificate was rejected by the DTLS module of webrtc-rs:

The same certificate was accepted by other WebRTC clients (Firefox, for example):

The certificate verify "frame", sent by server, looks like:

After some debugging work, I located the following code inside webrtc-dtls crate:
https://github.com/webrtc-rs/webrtc/blob/de6e781ec437198ffe329d68e99b9348b7e83cc6/dtls/src/crypto/mod.rs#L279-L313
Here verify_alg is picked according to hash algorithm. For the SHA256 + RSA combination, RSA_PKCS1_2048_8192_SHA256 was picked. However that algorithm expects a minimal signature length of 2048 bits, while the signature given by my server has only 1024 bits (128 bytes as shown in previous figures).

Actually, ring provides RSA_PKCS1_1024_8192_SHA256_FOR_LEGACY_USE_ONLY which accepts 1024 bit length signatures:
https://github.com/briansmith/ring/blob/83298f55aa802879a04013a130376e639f5b05b3/src/rsa/verification.rs#L73-L80
Checking the length of signature and choosing algorithm accordingly might resolve the problem. I'll make a fork and take an experiment then.

This patch worked for me.
I also noted that there are also _FOR_LEGACY_USE_ONLY variants to RSA_PKCS1_1024_8192_SHA512_FOR_LEGACY_USE_ONLY. Perhaps that also needs a bit fix.


Fix auto-adding escaped closing tags

Summary
Closes #464
Adds tagAllowed() helper function.
What are the specific steps to test this change?
Existing tests may need to be reviewed. I don't do a lot of PRs, sorry.
What kind of change does this PR introduce?
(Check at least one)

[x] Bug fix
[ ] New feature
[x] Refactor
[ ] Documentation
[ ] Build-related changes
[ ] Other

Make sure the PR fulfills these requirements:

[x] It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
[ ] The changelog is updated
[ ] Related documentation has been updated
[ ] Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.
Other information:

Hi @dliebner
Thanks for giving this a go! As a first step, can you at least describe how your new function should work? Does the tagAllowed() take a boolean, or...? You can use the original example to provide the input and expected output. "here is a string with a  tag."
Thanks!
Bob

tagAllowed() takes a tag name and checks it against options.allowedTags and returns true if the tag is allowed and false if it is not.
const wackyText = sanitizeHtml('
here\'s a string with a <wacky> tag.', {
	disallowedTagsMode: 'escape',
});

console.log( wackyText ); // expected: "
here's a string with a <wacky> tag.
"

Hi @dliebner,
I'm still not quite getting it. I wrote the following test:
it('Should allow unclosed tags', function() {
    assert.equal(
      sanitizeHtml('
Text with a <wacky> tag.
', {
        allowedTags: [ 'wacky' ],
        disallowedTagsMode: 'escape'
      }), '
Text with a <wacky> tag.
'
    );
  });

This test fails with the output being: <p>Text with a <wacky> tag.</wacky></p>
While I expected: <p>Text with a <wacky> tag.</p> based on the original issue.
Any additional feedback?
Thanks,
Bob

In your test, you set your allowedTags to ['wacky'], meaning only the wacky tag is allowed. All other tags will be escaped using HTML entities.  The opening
 is correctly sanitized as it is not allowed. The opening <wacky> tag is correctly preserved as it is allowed, and it is correctly auto-closed as it is allowed. The closing
 tag is correctly sanitized because it is not allowed (and is literally included in the input, as opposed to being only implied by the presence of an opening tag).


Add option to use the contrib binaries

The Otel Collector binaries are now divided into "core" and "contrib", and most of the exporters are only available in the contrib release.
This PR adds an option to download contrib (defaulting to core) and updates the pinned version to the latest stable (0.43)

@Djiit Hello! I am wondering if you could have a look to this PR. It is needed when using a newer version of the otel collector

Super nice! Did you had a chance to live test it ?

@Djiit yes, this was tested and I wrote about it here: https://arapulido.github.io/blog/2022/02/07/otel-heroku-datadog/
Once you merge, I will edit it, so people use your buildpack directly, and not my fork :)

Awesome !!


Retains old download location

In latest update v1.3.1, I set download path "/storage/342D-B935/Android/data/com.xmader.aria_ng_gui_android/files/" but it retains old download path "/storage/emulated/0/Download"everytime I open the app. I have to set it manually everytime. There was no such issue in the previous versions.
Regards
Vpn12

In latest update v1.3.1, I set download path "/storage/342D-B935/Android/data/com.xmader.aria_ng_gui_android/files/" but it retains old download path "/storage/emulated/0/Download"everytime I open the app. I have to set it manually everytime. There was no such issue in the previous versions.
Regards
Vpn12

I think it's not saving changes in aria2.conf


MINOR: Remove unused params in ZkConfigManager

Remove changeExpirationMs and time in ZkConfigManager, since this two params is not used.

Committer Checklist (excluded from commit message)

[ ] Verify design and implementation
[ ] Verify test coverage and CI build status
[ ] Verify documentation (including upgrade notes)

@ruanwenjun Thanks for the patch. One minor import to fix:
[2022-02-15T12ː00ː59.047Z] [Error] /home/jenkins/workspace/Kafka_kafka-pr_PR-11763/core/src/main/scala/kafka/server/ZkConfigManager.scalaː28ː38: Unused import

@hachikuji Thanks for your review. I have removed the unused import. Now, it should pass the checkstyle task.
By the way, how can I control the import order of kafka project? I read the developer setup doc, there is no description of how to manage the code  format.
I find the checkstyle.xml and import this file into my IDEA, but it doesn't manage the import order. Furthermore, I just find the ImportControl referenced to another file.

@ruanwenjun To be honest, I don't think we have official guidelines on import ordering. The only style enforcement I'm aware of is avoiding * imports in the Java code. If you know of any way to enforce an ordering convention, I'd suggest opening a PR to get feedback from other developers. You could also ask on the dev list perhaps. It would definitely be nice to de-clutter PRs from a lot of the noise from import reordering.


Inconsistency with resizeMode behavior between iOS and Android

Not a huge issue, but slightly annoying. iOS doesn't need to set resize mode, but android does. This should be made consistent.

++++

I also encountered this problem and asked the official to help solve it.


Need accordion view in Mobile resolution

Hi,
Need accordion view in Mobile resolution

Not a trivial feature within the current implementation, keeping it open for further consideration

I was thinking of the feature. Might be reasonable to have a separate widget, e.g. TableAsAccordion which gets as inputs same rows and columns (or uses same data source) as DataTable2 yet only a couple of cells are displayed until a row is clicked and the rest of the cells get expanded. Can be implemented via a series of Rows and Columns. The widget can be switched via LayoutBuilder depending on the viewport size

any updates?

Any updates?


Real-world path traversal challenge?

I saw that there some challenges for file retrieval exists already [1], [2], but this challenges are limited to .md files and are not a very obvious/real-world example from the architectural point of view. Is there challenge/functionality for arbitrary file retrieval (e.g. /etc/passwd), or do you plan to make one in near future?

There is also 3 but that's about it at the moment. We are lacking a "normal" path traversal vulnerability at the moment. We tried it some years back, but it messed with the serve-index module too much.
So, any ideas on a different way and a place to put path traversal into would be welcome!


doc: publishing to nuget

@b-r-o-c-k What are the steps you follow to publish to nuget?

I set up automatic publishing for all commits on the master branch. The NuGet Gallery API key inside the appveyor.yml just needs to be updated to make it work.

Resolved by https://github.com/neovim/nvim.net/commit/bc8e3a2a98ad5a9fd3fb0eaa55730d0d9b078dfc thanks to @b-r-o-c-k 's instructions.

Alternatively, you could publish the package on the NuGet Gallery using your own account or create one for the Neovim organization:
https://blog.nuget.org/20180417/organizations-on-nuget-org.html


[BUG]: code in /home/project/coati/trainer/ppo.py always read same datas from prompt_dataloader

🐛 Describe the bug
always read same data from prompt_dataloader:

should be changed to:

Please check.
Environment
No response

This is random because shuffle is True.

This is random because shuffle is True.

'shuffle'  is invalid while training with multiple gpus.

Could you provide your launch command so that we can better reproduce this error? :)

Actually, I can not reproduce this error in my environment.
Besides, this implementation is modified in b03d64d010cb6803b66230a0386bc62d989e6ef6 and I believe the bug is fixed.
Please reopen the issue if you find it still exists. :)


[TUIM-4] Remove Bueller screenshot code and App Engine config

After looking at #3108's update to test screenshot code, it looks like the SCREENSHOT_BUCKET configuration was only used for Bueller. Most Bueller related code was removed by #3065. This removes the code related to saving test screenshots to a bucket and also removes the Bueller App Engine configuration.

Rebased to pick up changes to flaky tests from #3111.


Automatically work with failover setup (master slave)

Is there a way that we can redundantly connect to a master slave setup in MySQL and PostgreSQL?  i.e. when one goes down gorm is automatically able to connect to the other?

I think you could setup a load balancer for your master, slave, and use gorm to connect the load balancer


Display Total File Count in Folder When Using Attribute Function

What feature or improvement do you think would benefit Files?
I am inclined to submit a request for a new feature related to the attribute function. When making use of the attribute feature, it would be extremely advantageous if the Files were capable of presenting the total count of files encompassed within the folder. Such an addition would significantly improve the user experience and offer a more lucid overview of the folder's contents.
Requirements
I am submitting a feature request to enhance the folder attribute functionality. Specifically, I would like to see the implementation of a recursive file count feature within the folder attributes display.
Files Version
<IP_ADDRESS>
Windows Version
10.0.22631.4037
Comments
No response

Thanks for the feedback.
You can see the total count from the folder's properties window,

@ZhiQiu-Kinsey as @0x5bfa mentioned, you can access this info from the properties window. Does this help, or did you have something else in mind?

@ZhiQiu-Kinsey as @0x5bfa mentioned, you can access this info from the properties window. Does this help, or did you have something else in mind?

@yaira2 @0x5bfa
When my folder contains a symbolic link folder, it will cause the correct number of statistics toto not be counted

I looked at the source code and found the problem because this judgment skipped symbolic links and junctions.
This appears to have been done to fix this issue: https://github.com/files-community/Files/issues/8216

@hishitetsu fyi
I didn't know so but there seems to be a case reparse point can point to another link and circular reference would happen, subsequently the counting won't finish.
How's File Explorer shown it?

@ZhiQiu-Kinsey Can you answer the above question


Depth raycasting does not work over QuestLink

This almost mostly works now! Here's the issue I've been having:
When I run the DepthRaycast Example scene, I get the following error about half of the time:
Compute shader (DepthCast): Property (EnvDepthTextureCS) at kernel index (0) is not set
This pauses the editor. However, if I un-pause it, it seems to carry on like it should.
From some experimentation, it seems to have to do with line 221 of DepthCast.cs (computeShader.SetTextureFromGlobal(0, EnvDepthTextureCS, depthTextureId);) not taking effect before the RaycastBlocking function is called.
I tried adding a private bool variable that would be set to true at the completion of the UpdateCurrentRenderingState() function, and made the RaycastBlocking() function return early if the variable was false. This didn't seem to work. However, if I use a coroutine to delay setting that variable to true by 1 second, it seems to consistently work.
Happy to submit a pull request if desired, but I figure you might have a better idea for a more elegant solution. I haven't tested to see if this affects the built version at all.


Option to set a path to log file?

is there any way to set a path to logs? So I can use filebeat to collect from it?

Hi @ericsouza!
imgproxy is a 12-factor app so it writes its logs to STDOUT only: https://12factor.net/logs

Hey @DarthSim thanks for the quick answer.
Do you think is there any way to convert the json logging format to GELF format?
Context:
At my company we use graylog and need the GELF formatted log. So I was going to use filebeat as sidecar to improxy running on k8s and read logs from imgproxy. The thing is that filebeats require a log file as input.

If you're asking about a tool that can convert imgproxy log to GELF then I don't know since I'm not familiar with graylog.
If you are asking about adding GELF support to imgproxy, then it's pretty possible since imgproxy uses logrus that supports custom formatters. PRs are always welcome 😉 You can find some examples here: https://github.com/imgproxy/imgproxy/blob/master/logger/formatter.go. Or you can simplify and modify logrus built-in JSON formatter: https://github.com/sirupsen/logrus/blob/master/json_formatter.go


[ISSUE #2516]Fix the problem of caculating a correct headSlowTimeMills value with 1/2 chance

Make sure set the target branch to develop
What is the purpose of the change
Fix the problem of caculating a correct headSlowTimeMills value with 1/2 chance
Brief changelog
The header element  of queue may not match the specified type (1/2 chance)，so find the first correct element by traversing the queue.
Scope of influence: [printWaterMark() ] and [invoke broker: prepareRuntimeInfo() method ,get headSlowTimeMills]

Coverage decreased (-0.1%) to 51.807% when pulling 54f153b77593737b8c7963290d45db68ea6a45e1 on xxd763795151:develop into 0239421fa59b67c423cf9fcabf5cd6edda0c2076 on apache:develop.

Coverage decreased (-0.1%) to 51.807% when pulling 54f153b77593737b8c7963290d45db68ea6a45e1 on xxd763795151:develop into 0239421fa59b67c423cf9fcabf5cd6edda0c2076 on apache:develop.


Native contarct addresses wrong padded

The native contracts are added to a map with a crypto.Address of it eth address.
This make the number of the address right padded, while the caller addr is left padded. For example the key in the map of the 4th native is<PHONE_NUMBER>000000000000000000000000000000 while the caller addr is<PHONE_NUMBER>000000000000000000000000000004 (I debugged this with Printf, sorry the dirtiness). So the condition if IsRegisteredNativeContract(address) always fails.

Thanks @madiazp I've resolved this is a refactored I have done, your work looks good though and I will merge and resolve conflicts when we get your changes integrated


testTemplateCanBeCompiled fails if no template files are available

When running the 0.1.1 test suite in a Symfony 2 project without any views (e.g. just console commands), testTemplateCanBeCompiled fails with:
1) Warning
The data provider specified for Webfactory\Tests\Integration\TwigTemplateTest::testTemplateCanBeCompiled is invalid.
You must call one of in() or append() methods before iterating over a Finder.

The test could skip or be considered successful (see #10) if there are no Twig templates.

@MalteWunsch please check if version 0.1.2 solves this issue.

Great success :+1:


UnauthorizedError: jwt issuer invalid. expected: undefined

I followed instructions, and even tried changes shown in issue #30 because I was initially receiving the invalid audience error. Now I'm getting the invalid issuer error when I authenticate and try to hit a protected API. I'm using this example for my app: https://auth0.com/blog/adding-authentication-to-react-native-using-jwt/
Sign up and Login seem to work (aside from errors when I try to sign up the same user twice and try to login twice).
Any ideas?
I think the only difference is that my react-native app that uses this API as an end point fetches with my local IP instead of localhost.
Thanks!

I'm not entirely sure how I resolved this. But, I got it working so it looks like it was something on my end. I changed the issuer to anything else. I changed my issuer to http://something.com and my username and password are both something in the user object. I'm not 100% if I changed anything else relevant b/c I was multitasking.

This issue came for me when a forward slash was missing. I have used "https://user.auth0.com" which is wrong. Correct one is " "https://user.auth0.com/""

Have the same question! Is the issuer not supposed to be validated? Works for me when I remove it, but that doesn't seem like it should be the solution?

Ah, here it is: issuer should be
`https://${process.env.AUTH0_DOMAIN}/`

if you just put ${process.env.AUTH0_DOMAIN} it will remain broken.

In my case I forgot .eu in my domain name

Ah, here it is: issuer should be
`https://${process.env.AUTH0_DOMAIN}/`

if you just put ${process.env.AUTH0_DOMAIN} it will remain broken.

Thanks @dearamerican it worked


'baselines' missing / needs mujoco after issue #1 workaround

I was able to get it built with the change suggested in issue #1.
However, when trying to run  python3 -m gfootball.play_game, I get  ModuleNotFoundError: No module named 'baselines', and when I try to do pip3 install baselines, I get  Exception:     You appear to be missing MuJoCo.
I don't think I should need MuJoCo to get the football stuff running.
I'm on Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-50-generic x86_64)

Don't install the "baselines" directly from pip. (the version in there is over a year old and some functions have different signatures).
Does this issue also show up, when you install baselines from the current git ?

I am/was a bit confused why I even need to install baselines in the first place; I thought the suggested change in issue #1 was meant to take care of that?

The baselines library is needed (we use it a little in the environment and in the examples).

The baselines library is needed (we use it a little in the environment and in the examples).

What I meant was "why do I even have to install it manually?"

What command did you run, when you installed the football env for the first time ?
What you can try is:

pip3 uninstall baselines
pip3 install<EMAIL_ADDRESS>
This should not ask for Mujoco anymore.

hang on, I seem to have a whole zoo of different python versions on my machine, some via ubuntu, some anaconda, some miniconda. let me clean up this mess and get back to you

As far as I can tell, that error is fixed by my cleanup.
Now I'm getting an error because apparently cuda 10.0 is expected but I only have 10.1

root@f869a41fc79e:/# pip3 install<EMAIL_ADDRESS>Collecting baselines-0.1.6 from<EMAIL_ADDRESS>Cloning https://github.com/openai/baselines.git (to revision master) to /tmp/pip-install-31axpame/baselines-0.1.6
Running command git clone -q https://github.com/openai/baselines.git /tmp/pip-install-31axpame/baselines-0.1.6
WARNING: Generating metadata for package baselines-0.1.6 produced metadata for project name baselines. Fix your #egg=baselines-0.1.6 fragments.
Requirement already satisfied (use --upgrade to upgrade): baselines from<EMAIL_ADDRESS>in /gfootball/baselines
Requirement already satisfied: click in /usr/local/lib/python3.6/dist-packages (from baselines) (7.0)
Requirement already satisfied: cloudpickle in /usr/local/lib/python3.6/dist-packages (from baselines) (1.2.1)
Requirement already satisfied: gym<1.0.0,>=0.10.0 in /usr/local/lib/python3.6/dist-packages/gym-0.12.5-py3.6.egg (from baselines) (0.12.5)
Requirement already satisfied: joblib in /usr/local/lib/python3.6/dist-packages (from baselines) (0.13.2)
Requirement already satisfied: opencv-python in /usr/local/lib/python3.6/dist-packages/opencv_python-<IP_ADDRESS>-py3.6-linux-x86_64.egg (from baselines) (<IP_ADDRESS>)
Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages/scipy-1.3.0-py3.6-linux-x86_64.egg (from baselines) (1.3.0)
Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from baselines) (4.32.1)
Requirement already satisfied: numpy>=1.10.4 in /usr/local/lib/python3.6/dist-packages (from gym<1.0.0,>=0.10.0->baselines) (1.16.4)
Requirement already satisfied: pyglet>=1.2.0 in /usr/local/lib/python3.6/dist-packages (from gym<1.0.0,>=0.10.0->baselines) (1.3.2)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from gym<1.0.0,>=0.10.0->baselines) (1.11.0)
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from pyglet>=1.2.0->gym<1.0.0,>=0.10.0->baselines) (0.17.1)
Building wheels for collected packages: baselines, baselines
Building wheel for baselines (setup.py) ... done
Stored in directory: /tmp/pip-ephem-wheel-cache-8m9vai8r/wheels/47/4b/a3/0a25aebc24e2f3302802b56aef9855b3bc7bb051cc5bc3debd
Building wheel for baselines (setup.py) ... error
ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-31axpame/baselines/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', op
en)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-p_4lw153 --python-tag cp36:
ERROR: Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-31axpame/baselines/setup.py'
ERROR: Failed building wheel for baselines
Running setup.py clean for baselines
ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-31axpame/baselines/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', op
en)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all:
ERROR: Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-31axpame/baselines/setup.py'
ERROR: Failed cleaning build dir for baselines
Successfully built baselines
Failed to build baselines

pip3 uninstall baselines
pip3 install<EMAIL_ADDRESS>

says: ERROR: Could not find a version that satisfies the requirement baselines-0-1-6 (unavailable)
ERROR: No matching distribution found for baselines-0-1-6 (unavailable)

@psymbio It's probably because you have Tensorflow 2 installed, but master branch of the baselines supports Tensorflow up to 1.14. You can either install Tensorflow 1 (use supported version of python3 in such case) or try using tf2 branch of the baselines:
pip3 install "git+https://github.com/openai/baselines.git@tf2"


Wheels dont scale

So, Valkyrien Skies 2 has a thing where it has different ship sizes relative to the "real" world. VMod adds a convenient button to change a ship's size ("Scale" in the toolgun menu). And Trackwork wheel entities do not scale with this.

The naive fix for this would expose trackwork as a scam so I am delaying it until I can actually address the underlying problem.

can you add scales to simple wheel like sprocket track have 3 sizes small medium and large, can you add to the simple wheel sizes like the track S. M. L.

Small block sized wheels would be a fantastic addition pls


Corrected possibly a typo in registrationDescription

@ziyadahmad : Thanks for your contribution! The author(s) have been notified to review your proposed change.

@ziyadahmad Thank you for catching that and submitting the fix! #sign-off


[Feature Request] Implement the ODE solver "modified Patanker scheme" (MPRK)

Problem:
I am working in the field of ecosystem modelling.
A common constraints on the solution of a set of ODEs is positivity.
The most famous example of such a a set of ODEs is the Lotka-Volterra Equations

Here, x and y are required to be positive or zero.
However, during the numerical integration with the currently implemented solver these state variables can reach negative values due to numerical errors.
So far there exists no ODE solver that guarantees positivity in scipy.
Solution/Feature Request:
Therefore, I recommend the implementation of the "modified Patankar–Runge–Kutta" (MPRK) scheme which preserves positivity.
Is such an implementation welcome in the scipy library or does the community prefer a minimal set of ODE solvers and therefore wish to stick to the current list of solvers?

Hi Laurin
I’m not an expert on the ODE package so I can’t comment on your question.
You may get a little more traction on your enquiry by posting the question on the scipy-dev email list.
-Lucas Roberts

On Aug 25, 2020, at 9:30 AM, Laurin Steidle<EMAIL_ADDRESS>wrote:

Problem:
I am working in the field of ecosystem modelling.
A common constraints on the solution of a set of ODEs is positivity.
The most famous example of such a a set of ODEs is the Lotka-Volterra Equations
Here, x and y are required to be positive or zero.
However, during the numerical integration with the currently implemented solver these state variables can reach negative values due to numerical errors.
So far there exists no ODE solver that guarantees positivity in scipy.
Solution/Feature Request:
Therefore, I recommend the implementation of the "modified Patankar–Runge–Kutta" (MPRK) scheme which preserves positivity.
Is such an implementation welcome in the scipy library or does the community prefer a minimal set of ODE solvers and therefore wish to stick to the current list of solvers?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

I often need nonnegative states in ODEs so this would be useful to me. I am not familiar with the methods that do this. I know that Matlab's ODE solvers accept the NonNegative option to list the states that are not permitted to go negative, which presumably works as a modification to their suite of existing solvers. Would the MPRK be a totally different ODE solver or a feature added the existing solvers?

@drhagen Yes, MPRK would be a new solver, not a feature to the existing ones.
Nevertheless a NonNegative  feature like you mentioned would be helpful for me as well if this is something that seems like a better solution.
However, I think that this would require a large change to the solve_ivp function.

Hello @465b, have you worked through the examples in the article? I've tried but I get stuck once they "modify" the Patankar Euler scheme. Feel free to continue my little script that tests the simple linear model in the article.

Simple linear model examples
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp

plt.close('all')

# %% Functions

def slm_analytical(t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.025):
    """Solve the simple linear model analytically."""
    t = np.arange(*t_span, step=dt)
    c10, c20 = y0
    a = args[0]

    c1inf = (c10 + c20) / (a + 1)
    c = c10 / c1inf - 1
    c1 = (1 + c * np.exp(-(a + 1)*t)) * c1inf
    c2 = c10 + c20 - c1

    return c1, c2, t

def slm_E(t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25):
    """Solve the simple linear model using Euler forward."""
    t = np.arange(*t_span, step=dt)
    c1, c2 = np.zeros_like(t), np.zeros_like(t)
    c1[0] = y0[0]
    c2[0] = y0[1]
    a = args[0]
    for i, v in enumerate(t[1:]):
        c1[i+1] = c1[i] + dt * (c2[i] - a*c1[i])
        c2[i+1] = c2[i] + dt * (a*c1[i] - c2[i])

    return c1, c2, t

def slm_PE(t_span=[0, 2],  y0=[0.9, 0.1], args=[5], dt=0.25):
    """Solve the simple linear model using Patankar Euler scheme."""
    t = np.arange(*t_span, step=dt)
    c1, c2 = np.zeros_like(t), np.zeros_like(t)
    c1[0] = y0[0]
    c2[0] = y0[1]
    a = args[0]
    for i, v in enumerate(t[1:]):
        P1 = c2[i]
        D1 = a * c1[i]
        c1[i+1] = (c1[i] + dt * P1) / (1 + dt * D1/c1[i])

        P2 = a*c1[i]
        D2 = c2[i]
        c2[i+1] = (c2[i] + dt * P2) / (1 + dt * D2/c2[i])

    return c1, c2, t

def slm_MPE(t_span=[0, 2],  y0=[0.9, 0.1], args=[5], dt=0.25):
    """Solve the simple linear model using Modified Patankar Euler scheme."""
    t = np.arange(*t_span, step=dt)
    c1, c2 = np.zeros_like(t), np.zeros_like(t)
    c1[0] = y0[0]
    c2[0] = y0[1]
    a = args[0]
    # for i, v in enumerate(t[1:]):
        # ?

    # return c1, c2, t

def slm(t, y, a):
    """Simple linear model."""
    c1, c2 = y
    dc1 = c2 - a*c1
    dc2 = a*c1 - c2

    return [dc1, dc2]

# %% Plot

plt.figure()

c1_analytical, c2_analytical, t_analytical = slm_analytical()
plt.plot(t_analytical, c1_analytical, 'b-', label='c1, analytical')
plt.plot(t_analytical, c2_analytical, 'g-', label='c2, analytical')

c1_E, c2_E, t_E = slm_E()
plt.plot(t_E, c1_E, 'b--x', label='c1, euler forward')
plt.plot(t_E, c2_E, 'g--x', label='c2, euler forward')

c1_PE, c2_PE, t_PE = slm_PE()
plt.plot(t_PE, c1_PE, 'b--d', label='c1, patankar euler scheme')
plt.plot(t_PE, c2_PE, 'g--d', label='c2, patankar euler scheme')

sol = solve_ivp(slm, t_span=[0, 2], y0=[0.9, 0.1], args=[5])
plt.plot(sol.t, sol.y[0], 'b--.', label='c1, solve_ivp')
plt.plot(sol.t, sol.y[1], 'g--.', label='c2, solve_ivp')

plt.legend()

@Illviljan I am working on it.
I found FOTRAN implementation of several of its versions.
Send me a mail if you would like to help me on implementing it in SciPy.

@Illviljan That link you have has GPL license which is incompatible with BSD, MIT and alike hence we cannot even use it as inspiration. So better not look at it if you wish to contribute to SciPy. Or you might ask the authors for licensing.

@ilayn Thank you for pointing that out. I was in contact with the authors beforehand and asked if I may reimplement their code.
How do you handle such issues? Shall I provide proof of the email conversation?

It's not a super strict requirement but better safe than sorry. Actually @rgommers should know better.

I am currently stuck with the following issue:
SciPy assumes the following structure for its set of ODEs:
    dy / dt = f(t, y)

However, the integration scheme for the MPRK solver requires the following form:
    dy / dt = p(t, y) + d(t, y)

where p is positive (or zero) and d is negative (or zero).
This is crucial as the integration schemes depends on these two components being separable as seen in the equation further below.
I currently do not see any option how this could be implemented while sticking to the structure of f(t,y) where it returns an array-like of shape (n,).
Would it be acceptable to require a special f(t,y) for the MPRK solver where it returns an array-like shape (n,2)?
MPRK Equations:

@465b
I think implementing a new "non-negative" solver would be plausible. Adjusting existing solvers to do MATLAB non-negativity constraint seems tricky, not much information on how to do that properly.
As for your last issue. Can we simply assume that d is zero? Seems straightforward to adjust the algorithm to this specific case.

If you set the negative destruction term (d) to zero that would mean there's only the positive production term (p) left and the solver will therefore diverge to +infinity.
With the help of that fortran script I think I've finally figured out the simple linear model examples in the article:

I've only done this with for loops at the moment but I think this can be implemented using the OdeSolver class, as you have to define how to calculate each step anyway. But I have only quickly glanced at the Runge-kutta module so there's probably a lot I'm missing.
I will try that out next weekend.

Simple linear model examples
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt

plt.close('all')

# %% Functions
def solve_analytical_slm(t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.025):
    """Solve the simple linear model analytically."""
    t = np.arange(*t_span, step=dt)
    c10, c20 = y0
    a = args[0]

    c1inf = (c10 + c20) / (a + 1)
    c = c10 / c1inf - 1
    c1 = (1 + c * np.exp(-(a + 1)*t)) * c1inf
    c2 = c10 + c20 - c1

    return c1, c2, t

def solve_e(fun, t_span, y0, dt, args=None):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a euler forward scheme.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_e(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[ 0.9       -0.2        0.35       0.075      0.2125     0.14375
       0.178125   0.1609375]
     [ 0.1        1.2        0.65       0.925      0.7875     0.85625
       0.821875   0.8390625]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    t = np.arange(*t_span, step=dt)
    y = np.zeros([len(y0), len(t)])
    y[:, 0] = y0
    for i, ti in enumerate(t[1:]):
        p, d = fun(ti, y[:, i])
        p = np.asarray(p)
        d = np.asarray(d)

        P = p.sum(1)
        D = d.sum(1)
        y[:, i+1] = y[:, i] + dt*(P - D)

    return t, y

def solve_pe(fun, t_span, y0, dt, args=None):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a patankar euler scheme.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_pe(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[0.9        0.41111111 0.29160494 0.26239232 0.25525146 0.25350591
      0.25307922 0.25297492]
     [0.1        0.98       1.19511111 1.24769383 1.26054738 1.26368936
      1.2644574  1.26464514]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    len_y0 = len(y0)
    t = np.arange(*t_span, step=dt)
    y = np.zeros([len_y0, len(t)])
    y[:, 0] = y0
    for ci, ti in enumerate(t[1:]):
        # Get the production and destruction term:
        p, d = fun(ti, y[:, ci])
        p = np.asarray(p)
        d = np.asarray(d)

        P = p.sum(1)
        D = d.sum(1)
        y[:, ci+1] = (y[:, ci] + dt*P) / (1 + dt*D/y[:, ci])

    return t, y

def solve_mpe(fun, t_span, y0, dt, args=None):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a modified patankar euler scheme.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_mpe(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[0.9        0.46       0.284      0.2136     0.18544    0.174176
      0.1696704  0.16786816]
     [0.1        0.54       0.716      0.7864     0.81456    0.825824
      0.8303296  0.83213184]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    len_y0 = len(y0)
    t = np.arange(*t_span, step=dt)
    y = np.zeros([len_y0, len((t))])
    y[:, 0] = y0
    eye = np.identity(len_y0, dtype=bool)
    a = np.zeros_like(eye, dtype=float)
    r = np.zeros_like(a[:, 0], dtype=float)
    for ci, ti in enumerate(t[1:]):
        # Get the production and destruction term:
        p, d = fun(ti, y[:, ci])
        p = np.asarray(p)
        d = np.asarray(d)

        # a[:], r[:] = 0, 0
        # for i in np.arange(0, len_y0):
        #     for j in np.arange(0, len_y0):
        #         a[i, i] = a[i, i] + d[i, j]
        #         if i != j:
        #             a[i, j] = -dt * p[i, j] / c[j, ci]
        #     a[i, i] = dt * a[i, i] / c[i, ci]
        #     a[i, i] = 1 + a[i, i]
        #     r[i] = c[i, ci] + dt*p[i, i]

        # Calculate diagonal:
        a[eye] = dt * d.sum(1) / y[:, ci] + 1

        # Calculate non-diagonal:
        c_rep = np.broadcast_to(y[:, ci], (len_y0, len_y0))
        a[~eye] = -dt * p[~eye] / c_rep[~eye]

        # Something:
        r[:] = y[:, ci] + dt*p[eye]

        # Solve system of equation:
        y[:, ci+1] = np.linalg.solve(a, r)

    return t, y

def solve_mprk(fun, t_span, y0, dt, args):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a 2nd order modified patankar-runge-kutta.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_mprk(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[0.9        0.34985219 0.21016238 0.17649204 0.16884278 0.16714614
      0.16677219 0.16668988]
     [0.1        0.65014781 0.78983762 0.82350796 0.83115722 0.83285386
      0.83322781 0.83331012]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    len_y0 = len(y0)
    t = np.arange(*t_span, step=dt)
    y = np.zeros([len_y0, len((t))])
    y[:, 0] = y0
    eye = np.identity(len_y0, dtype=bool)
    a = np.zeros_like(eye, dtype=float)
    r = np.zeros_like(a[:, 0], dtype=float)
    for ci, ti in enumerate(t[1:]):
        # Get the production and destruction term:
        p0, d0 = fun(ti, y[:, ci])
        p0 = np.asarray(p0)
        d0 = np.asarray(d0)

        # Calculate diagonal:
        a[eye] = dt * d0.sum(1) / y[:, ci] + 1

        # Calculate non-diagonal:
        c_rep = np.broadcast_to(y[:, ci], (len_y0, len_y0))
        a[~eye] = -dt * p0[~eye] / c_rep[~eye]

        # Something:
        r[:] = y[:, ci] + dt*p0[eye]

        # Solve system of equation:
        c0 = np.linalg.solve(a, r)

        # Run the algorithm a second time:
        # Get the production and destruction term:
        p, d = fun(ci, c0)
        p = np.asarray(p)
        d = np.asarray(d)

        # Calculate the mean value of the terms:
        p = 0.5 * (p0 + p)
        d = 0.5 * (d0 + d)

        # Calculate diagonal:
        a[eye] = dt * d.sum(1) / c0 + 1

        # Calculate non-diagonal:
        c_rep = np.broadcast_to(c0, (len_y0, len_y0))
        a[~eye] = -dt * p[~eye] / c_rep[~eye]

        # Something:
        r[:] = y[:, ci] + dt*p[eye]

        # Solve system of equation:
        y[:, ci+1] = np.linalg.solve(a, r)

    return t, y

# %% Plot
plt.figure()

# Analytical solution:
c1_analytical, c2_analytical, t_analytical = solve_analytical_slm()
plt.plot(t_analytical, c1_analytical, 'b-', label='c1, analytical')
plt.plot(t_analytical, c2_analytical, 'g-', label='c2, analytical')

def slm_pd(t, y, a):
    """Production and destruction term for the simple linear model."""
    c1, c2 = y

    p = [[0, c2],
         [a*c1, 0]]

    d = [[a*c1, 0],
         [0, c2]]

    return p, d

t_E, c_E = solve_e(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
plt.plot(t_E, c_E[0], 'b--x', label='c1, euler forward')
plt.plot(t_E, c_E[1], 'g--x', label='c2, euler forward')

t_PE, c_PE = solve_pe(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
plt.plot(t_PE, c_PE[0], 'b--d', label='c1, patankar euler scheme')
plt.plot(t_PE, c_PE[1], 'g--d', label='c2, patankar euler scheme')

t_MPE, c_MPE = solve_mpe(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5],
                         dt=0.25)
plt.plot(t_MPE, c_MPE[0], 'b--o', label='c1, modified patankar euler scheme')
plt.plot(t_MPE, c_MPE[1], 'g--o', label='c2, modified patankar euler scheme')

t_MPRK, c_MPRK = solve_mprk(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5],
                            dt=0.25)
plt.plot(t_MPRK, c_MPRK[0], 'b--<', label='c1, modified patankar-runge-kutta')
plt.plot(t_MPRK, c_MPRK[1], 'g--<', label='c2, modified patankar-runge-kutta')

# sol = solve_ivp(slm, t_span=[0, 2], y0=[0.9, 0.1], args=[5])
# plt.plot(sol.t, sol.y[0], 'b--.', label='c1, solve_ivp')
# plt.plot(sol.t, sol.y[1], 'g--.', label='c2, solve_ivp')

plt.legend()

# %% Doctest
if __name__ == '__main__':
    import doctest
    doctest.testmod()

@nmayorov
I think you must have misunderstood the concept of the solver as pointed out by Illvjan.
@Illviljan Thanks for your input! However you use a fun which returns two objects which is not allowed by the scipy design.
Hence, I think you are stuck at the problem I stated above.

If you set the negative destruction term (d) to zero that would mean there's only the positive production term (p) left and the solver will therefore diverge to +infinity.

@nmayorov
I think you must have misunderstood the concept of the solver as pointed out by Illvjan.

Certainly, I was thinking about something else. I realize now that this will make the solver almost useless.
Returning 2 vectors - I guess possible, albeit not ideal. Also looks like there is no known way to compute "dense output" for the proposed method.
Considering all this, if you believe that this is a very good method, which solves an important class of problems - you may introduce it as a separate function, not connected to solve_ivp. I believe it might be better than trying to fit it into solve_ivp, fighting all arising inconsistencies.

scipy.integrate.solve_ivp and scipy.integrate.OdeSolver seems to handle functions that returns p and d terms just fine from my testing. I redid the euler forward scheme with the p and d terms and it solves it as expected. Maybe there's some weird edge cases I'm missing.

Simple linear model examples
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt

plt.close('all')

# %% Functions
def solve_analytical_slm(t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.025):
    """Solve the simple linear model analytically."""
    t = np.arange(*t_span, step=dt)
    c10, c20 = y0
    a = args[0]

    c1inf = (c10 + c20) / (a + 1)
    c = c10 / c1inf - 1
    c1 = (1 + c * np.exp(-(a + 1)*t)) * c1inf
    c2 = c10 + c20 - c1

    return c1, c2, t

def solve_e(fun, t_span, y0, dt, args=None):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a euler forward scheme.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_e(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[ 0.9       -0.2        0.35       0.075      0.2125     0.14375
       0.178125   0.1609375]
     [ 0.1        1.2        0.65       0.925      0.7875     0.85625
       0.821875   0.8390625]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    t = np.arange(*t_span, step=dt)
    y = np.zeros([len(y0), len(t)])
    y[:, 0] = y0
    for i, ti in enumerate(t[1:]):
        p, d = fun(ti, y[:, i])
        p = np.asarray(p)
        d = np.asarray(d)

        P = p.sum(1)
        D = d.sum(1)
        y[:, i+1] = y[:, i] + dt*(P - D)

    return t, y

def solve_pe(fun, t_span, y0, dt, args=None):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a patankar euler scheme.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_pe(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[0.9        0.41111111 0.29160494 0.26239232 0.25525146 0.25350591
      0.25307922 0.25297492]
     [0.1        0.98       1.19511111 1.24769383 1.26054738 1.26368936
      1.2644574  1.26464514]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    len_y0 = len(y0)
    t = np.arange(*t_span, step=dt)
    y = np.zeros([len_y0, len(t)])
    y[:, 0] = y0
    for ci, ti in enumerate(t[1:]):
        # Get the production and destruction term:
        p, d = fun(ti, y[:, ci])
        p = np.asarray(p)
        d = np.asarray(d)

        P = p.sum(1)
        D = d.sum(1)
        y[:, ci+1] = (y[:, ci] + dt*P) / (1 + dt*D/y[:, ci])

    return t, y

def solve_mpe(fun, t_span, y0, dt, args=None):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a modified patankar euler scheme.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_mpe(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[0.9        0.46       0.284      0.2136     0.18544    0.174176
      0.1696704  0.16786816]
     [0.1        0.54       0.716      0.7864     0.81456    0.825824
      0.8303296  0.83213184]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    len_y0 = len(y0)
    t = np.arange(*t_span, step=dt)
    y = np.zeros([len_y0, len((t))])
    y[:, 0] = y0
    eye = np.identity(len_y0, dtype=bool)
    a = np.zeros_like(eye, dtype=float)
    r = np.zeros_like(a[:, 0], dtype=float)
    for ci, ti in enumerate(t[1:]):
        # Get the production and destruction term:
        p, d = fun(ti, y[:, ci])
        p = np.asarray(p)
        d = np.asarray(d)

        # a[:], r[:] = 0, 0
        # for i in np.arange(0, len_y0):
        #     for j in np.arange(0, len_y0):
        #         a[i, i] = a[i, i] + d[i, j]
        #         if i != j:
        #             a[i, j] = -dt * p[i, j] / c[j, ci]
        #     a[i, i] = dt * a[i, i] / c[i, ci]
        #     a[i, i] = 1 + a[i, i]
        #     r[i] = c[i, ci] + dt*p[i, i]

        # Calculate diagonal:
        a[eye] = dt * d.sum(1) / y[:, ci] + 1

        # Calculate non-diagonal:
        c_rep = np.broadcast_to(y[:, ci], (len_y0, len_y0))
        a[~eye] = -dt * p[~eye] / c_rep[~eye]

        # Something:
        r[:] = y[:, ci] + dt*p[eye]

        # Solve system of equation:
        y[:, ci+1] = np.linalg.solve(a, r)

    return t, y

def solve_mprk(fun, t_span, y0, dt, args):
    """
    Solve an initial value problem for a system of ODE.

    The method used to solve is a 2nd order modified patankar-runge-kutta.

    Parameters
    ----------
    fun : callable
        Right-hand side of the system. The calling signature is ``fun(t, y)``.
        Here `t` is a scalar, and there are two options for the ndarray `y`:
        It can either have shape (n,); then `fun` must return a tuple of 2
        array_likes with shapes (n,). Alternatively, it can have shape (n, k);
        then `fun` must return an array_like with shape (n, k), i.e., each
        column corresponds to a single column in `y`. The choice between the
        two options is determined by `vectorized` argument (see below). The
        vectorized implementation allows a faster approximation of the Jacobian
        by finite differences (required for stiff solvers).
    t_span : 2-tuple of floats
        Interval of integration (t0, tf). The solver starts with t=t0 and
        integrates until it reaches t=tf.
    y0 : array_like, shape (n,)
        Initial state. For problems in the complex domain, pass `y0` with a
        complex data type (even if the initial value is purely real).
    dt : float, optional
        Time step.
    args : tuple, optional
        Additional arguments to pass to the user-defined functions.  If given,
        the additional arguments are passed to all user-defined functions.
        So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
        then `jac` (if given) and any event functions must have the same
        signature, and `args` must be a tuple of length 3. The default is None.

    Returns
    -------
    t : ndarray, shape (n_points,)
        Time points.
    y : ndarray, shape (n, n_points)
        Values of the solution at `t`.

    Examples
    --------
    >>> def fun(t, y, a):
    ...     "Production and destruction term for a simple linear model."
    ...     c1, c2 = y
    ...
    ...     p = [[0, c2],
    ...          [a*c1, 0]]
    ...
    ...     d = [[a*c1, 0],
    ...          [0, c2]]
    ...
    ...     return p, d

    >>> # Solve the problem:
    >>> t, y = solve_mprk(fun, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
    >>> print(y)
    [[0.9        0.34985219 0.21016238 0.17649204 0.16884278 0.16714614
      0.16677219 0.16668988]
     [0.1        0.65014781 0.78983762 0.82350796 0.83115722 0.83285386
      0.83322781 0.83331012]]
    """
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    len_y0 = len(y0)
    t = np.arange(*t_span, step=dt)
    y = np.zeros([len_y0, len((t))])
    y[:, 0] = y0
    eye = np.identity(len_y0, dtype=bool)
    a = np.zeros_like(eye, dtype=float)
    r = np.zeros_like(a[:, 0], dtype=float)
    for ci, ti in enumerate(t[1:]):
        # Get the production and destruction term:
        p0, d0 = fun(ti, y[:, ci])
        p0 = np.asarray(p0)
        d0 = np.asarray(d0)

        # Calculate diagonal:
        a[eye] = dt * d0.sum(1) / y[:, ci] + 1

        # Calculate non-diagonal:
        c_rep = np.broadcast_to(y[:, ci], (len_y0, len_y0))
        a[~eye] = -dt * p0[~eye] / c_rep[~eye]

        # Something:
        r[:] = y[:, ci] + dt*p0[eye]

        # Solve system of equation:
        c0 = np.linalg.solve(a, r)

        # Run the algorithm a second time:
        # Get the production and destruction term:
        p, d = fun(ci, c0)
        p = np.asarray(p)
        d = np.asarray(d)

        # Calculate the mean value of the terms:
        p = 0.5 * (p0 + p)
        d = 0.5 * (d0 + d)

        # Calculate diagonal:
        a[eye] = dt * d.sum(1) / c0 + 1

        # Calculate non-diagonal:
        c_rep = np.broadcast_to(c0, (len_y0, len_y0))
        a[~eye] = -dt * p[~eye] / c_rep[~eye]

        # Something:
        r[:] = y[:, ci] + dt*p[eye]

        # Solve system of equation:
        y[:, ci+1] = np.linalg.solve(a, r)

    return t, y

# %% Plot
plt.figure()

# Analytical solution:
c1_analytical, c2_analytical, t_analytical = solve_analytical_slm()
plt.plot(t_analytical, c1_analytical, 'b-', label='c1, analytical')
plt.plot(t_analytical, c2_analytical, 'g-', label='c2, analytical')

def slm_pd(t, y, a):
    """Production and destruction term for the simple linear model."""
    c1, c2 = y

    p = [[0, c2],
         [a*c1, 0]]

    d = [[a*c1, 0],
         [0, c2]]

    return p, d

t_E, c_E = solve_e(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
plt.plot(t_E, c_E[0], 'b--x', label='c1, euler forward')
plt.plot(t_E, c_E[1], 'g--x', label='c2, euler forward')

t_PE, c_PE = solve_pe(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5], dt=0.25)
plt.plot(t_PE, c_PE[0], 'b--d', label='c1, patankar euler scheme')
plt.plot(t_PE, c_PE[1], 'g--d', label='c2, patankar euler scheme')

t_MPE, c_MPE = solve_mpe(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5],
                         dt=0.25)
plt.plot(t_MPE, c_MPE[0], 'b--o', label='c1, modified patankar euler scheme')
plt.plot(t_MPE, c_MPE[1], 'g--o', label='c2, modified patankar euler scheme')

t_MPRK, c_MPRK = solve_mprk(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5],
                            dt=0.25)
plt.plot(t_MPRK, c_MPRK[0], 'b--<', label='c1, modified patankar-runge-kutta')
plt.plot(t_MPRK, c_MPRK[1], 'g--<', label='c2, modified patankar-runge-kutta')

# sol = solve_ivp(slm, t_span=[0, 2], y0=[0.9, 0.1], args=[5])
# plt.plot(sol.t, sol.y[0], 'b--.', label='c1, solve_ivp')
# plt.plot(sol.t, sol.y[1], 'g--.', label='c2, solve_ivp')

plt.legend()

# %% Implement using scipy.integrate.OdeSolver
from scipy.integrate import OdeSolver, DenseOutput
from scipy.integrate._ivp.common import (validate_max_step, validate_tol,
                                         select_initial_step, norm,
                                         warn_extraneous, validate_first_step)

def euler_forward_step(fun, t, y, f, h):
    """Test."""
    p, d = fun(t, y)
    p = np.asarray(p)
    d = np.asarray(d)

    P = p.sum(1)
    D = d.sum(1)
    f_new = h*(P - D)
    y_new = y + f_new

    return y_new, f_new

class EulerForwardDenseOutput(DenseOutput):
    """Test."""

    def __init__(self, t_old, t, y_old, f):
        super().__init__(t_old, t)
        self.h = t - t_old
        self.y_old = y_old
        self.f = f

    def _call_impl(self, t):
        h = t - self.t_old
        y = self.y_old + h * self.f

        return y

class EulerForward(OdeSolver):
    """Base class for explicit euler forward."""

    def __init__(self, fun, t0, y0, t_bound, max_step=np.inf,
                 rtol=1e-3, atol=1e-6, vectorized=False,
                 first_step=None, **extraneous):

        warn_extraneous(extraneous)
        super().__init__(fun, t0, y0, t_bound, vectorized,
                         support_complex=True)
        self.y_old = None
        self.f = self.fun(self.t, self.y)
        self.h_abs = 0.25
        self.h_previous = None

    def _step_impl(self):
        t = self.t
        y = self.y
        h = self.h_abs
        f = self.f

        t_new = t + h
        h_abs = np.abs(h)

        y_new, f_new = euler_forward_step(self.fun, t, y, f, h)

        self.h_previous = h
        self.y_old = y

        self.t = t_new
        self.y = y_new

        self.h_abs = h_abs
        self.f = f_new

        return True, None

    def _dense_output_impl(self):
        return EulerForwardDenseOutput(self.t_old, self.t, self.y_old, self.f)

def f(args=None):
    """Test."""
    fun = slm_pd
    if args is not None:
        # Wrap the user's fun (and jac, if given) in lambdas to hide the
        # additional parameters.  Pass in the original fun as a keyword
        # argument to keep it in the scope of the lambda.
        def fun(t, y, fun=fun): return fun(t, y, *args)

    return EulerForward(fun, t0=0, y0=[0.9, 0.1], t_bound=2)

a = f(args=[5])
sol = solve_ivp(slm_pd, t_span=[0, 2], y0=[0.9, 0.1], args=[5], method=EulerForward)

plt.figure()
plt.plot(sol.t, sol.y[0], 'b--.', label='c1, solve_ivp')
plt.plot(sol.t, sol.y[1], 'g--.', label='c2, solve_ivp')

# %% Doctest
if __name__ == '__main__':
    import doctest
    doctest.testmod()

@Illviljan Thanks first of all for all the work you put into this! Its great to see it work!
However, while using a fun that returns two arrays with shape (n,) is possible (as you demonstrated) it breaks with the convention used for all other solvers as I discussed above.

This forces users to write their ode fun with that specific solver in mind and they can't use the other solvers for the same ode implementation. This creates two disjoint solver sets for the solve_ivp method.
The good thing about this is that users that use the current set don't get bothered by the new set. Therefore, one could in principle add this.

Alternatively, a derivative from the solve_ivp function could be created which is the same exept that it uses ode funs that have the form dy / dt = p(t, y) + d(t, y) instead of  dy / dt = f(t,y)
This however would make it annoying to maintain as changes in solve_ivp will have to be applied to solve_positive_ivp as well.
It also introduces some confusion in the naming scheme as the problem is still a initial-value-problem and I would expect it to be handled by solve_ivp.

Personally I think I prefer the first method. While it introduces some inconsistency it keeps things well structured.
Maybe @nmayorov or @rlucas7 can comment on this?

@465b I think that the small difficulty that the users are going to face, if they decide to use their fun with other solvers is not significant enough to justify undermining the structure of the library. Users need only wrap their dedicated fun for MPRK with a wrapper such as
def to_conventional(fun):
    def wrapped(t, y):
        p, d = fun(t, y)
        return p + d
    return wrapped

and their fun should work for any other solver.

Hi,
I think the positivity could be inserted in a not so difficult manner in the exisiting explicit Runge-Kutta methods of solve_ivp.
In the function "rk_step", on could just reformulate it so that steps are computed in terms of stage values "y", not stage time derivatives "k", and then allow the user to provide a "limit" function which would be called after each stage.
This limit function would typically be:
def user_limit_solution(t,y):    y[y<0.] = 0.    return y
This function would be passed as an additional argument "limiter" to solve_ivp, which would then pass it to the RungeKutta class.
Maybe I will take a look into that if someone is still interested.
I doubt this feature would interact in a bad way with other features like error estimation and time step adaptation, however this might happen, particularly if the "true" solution wants to go past the limit, i.e. the limits should not be used to "settle" the solution vector y to a arbitrary values.
Note that, if the true solution would tend to 0 while remaining positive, then simply decreasing the absolute and relative tolerances atol and rtol used by the time step adaptation strategy should be enough to ensure positivity, unless the model is not so well-behaved.
Regards,

/!\ I am still writing this answer, please come back later ;)
I've quickly implemented this and tested it on a reaction problem with 4 variables, as in https://arxiv.org/pdf/2005.06268.pdf, page 5.

The first

@laurent90git Thank you for all this great input! I am still interested in this!
First I would like to not that while your approach is definitely helpful for some problems it is not dealing with MPRK anymore.
In my current workaround to the problem I also chose a "limiter" similar to your implementation.
However, introducing an arbitrary limit can cause major issue as you pointed out as well.
The major drawback is that it is not guaranteed to work. While in my personal (unsystematic) experience it often did, it can cause the system to become unstable which makes the solution invalid.
This is a major problem for me and anybody else who uses solve_ivp as part of algorithm where the output is not checked manually anymore.
In my case I am using the output solve_ivp as input for an optimization algorithm which calls solve_ivp for a different set of ODE's each time. Hence there is no way to test it in advance.
Nevertheless I think a limiter like the one you proposed could be a nice addition to solve_ivp.
Yet, it doesn't solve the problem that made me propose MRPK to be added.

I added a euler forward version which limits negative values to zero to my examples and as mentioned it does not converge to the correct value anymore.

I suppose RK45 would look a bit better.

Hi @Illviljan,
indeed it does not behave well. However your time steps seems too big with regards to the problem's time scale. Results would probably be more sensible with slightly more points I think.
Will you integrate your Patanker schemes in Scipy ? I guess the only thing missing is time adaptation, which is probably treated in some papers.


Sidecar config doesn't work when using port in egress

Bug description
Using a simple sidecar config for a given namespace (namespace-a), mostly following the sidecar reference doc example, resulted with service A in namespace-a communicates to service B in namespace-b in 502 error.
apiVersion: networking.istio.io/v1alpha3
kind: Sidecar
metadata:
  name: default
spec:
  ingress:
  - port:
      number: 9080
      protocol: HTTP
      name: somename
    defaultEndpoint: <IP_ADDRESS>:9080
  egress:
  - port:
      number: 9080
      protocol: HTTP
      name: egresshttp
    hosts:
    - "namespace-b/*"
  - hosts:
    - "./*"
    - "istio-system/*"

Below does work.
apiVersion: networking.istio.io/v1alpha3
kind: Sidecar
metadata:
  name: default
spec:
  ingress:
  - port:
      number: 9080
      protocol: HTTP
      name: somename
    defaultEndpoint: <IP_ADDRESS>:9080
  egress:
  - hosts:
    - "./*"
    - "istio-system/*"
    - "namespace-b/*"

After digging through, I found out in the dynamic route config section, there is no matching route for the  external name service I built to allow service A namespace-a to access service B namespace-b.
Affected product area (please put an X in all that apply)
[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ x ] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure
Expected behavior
Steps to reproduce the bug

Deploy service A in namespace-a
Deploy service B in namespace-b.
Create service B's external name service in namespace-a so that A can reach B (in namespace-b) the same way as A reach B as if B runs in namespace-a.

kind: Service
apiVersion: v1
metadata:
  name: b-service
spec:
  type: ExternalName
  externalName: b.namespace-b.svc.cluster.local
  ports:
  - name: http
    protocol: TCP
    port: 9080

Version (include the output of istioctl version --remote and kubectl version)
$ istioctl version
client version: 1.3.0-rc.1
control plane version: 1.2.0
I can reproduce this in newer version.
How was Istio installed?
default profile
Environment where bug was observed (cloud vendor, OS, etc)
IBM Cloud K8s Service
Additionally, please consider attaching a cluster state archive by attaching
the dump file to this issue.

In talking with Frank, I tried 2other possible solutions but none worked.

create a SE and VS and deploy in namespace-a.

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: b-service-entry
spec:
  hosts:
  - "b"
  ports:
  - number: 9080
    name: http
    protocol: http
  resolution: DNS

create a dummy service and VS and deploy in namespace-a.

apiVersion: v1
kind: Service
metadata:
  name: b
spec:
  ports:
    - name: http
      protocol: TCP
      port: 9080
      targetPort: 9080

Same VS is used in either 1 or 2.
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: virtual-service-b
spec:
  hosts:
    - b
  http:
  - route:
    - destination:
        host: b.ns-b
        port:
          number: 9080

Recreating the issue:

Create namespaces:

kubectl create namespace a
kubectl label namespace a istio-injection=enabled
kubectl create namespace b
kubectl label namespace b istio-injection=enabled

Deploy sleep in a:

kubectl apply -f samples/sleep/sleep.yaml -n a

Deploy httpbin in b:

kubectl apply -f samples/httpbin/httpbin.yaml -n b

@linsun With istio-1.4.0-beta.0, it works as expected for me, see https://github.com/istio/istio/issues/16885#issuecomment-547896625

Thank you @vadimeisenbergibm - it does looks working for you.
I have one q - did you use external service in your example? That is the only difference i noticed.
Create service B's external name service in namespace-a so that A can reach B (in namespace-b) the same way as A reach B as if B runs in namespace-a.

@linsun I did not use external services. So is the issue about ExternalName services and Sidecar? Or ExternalServices are used as a workaround? I would like to focus the problem.

Recreated the issue. ExternalName to in-mesh services seems not to work in Istio.

Create namespaces:

kubectl create namespace a
kubectl label namespace a istio-injection=enabled
kubectl create namespace b
kubectl label namespace b istio-injection=enabled
kubectl create namespace c
kubectl label namespace c istio-injection=enabled

Deploy sleep in a, httpbin in b:

kubectl apply -f samples/sleep/sleep.yaml -n a
kubectl apply -f samples/httpbin/httpbin.yaml -n b

Create external name service in namespace a:

kubectl apply -n a -f - <<EOF
kind: Service
apiVersion: v1
metadata:
  name: httpbin
spec:
  type: ExternalName
  externalName: httpbin.b.svc.cluster.local
  ports:
  - name: http
    protocol: TCP
    port: 8000
EOF

Define a destination rule to set mTLS for the traffic to httpbin in a:

kubectl apply -n a -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: httpbin
spec:
  host: httpbin
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL
EOF

Define a destination rule to set mTLS for the traffic to httpbin in b:

kubectl apply -n b -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: httpbin
spec:
  host: httpbin
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL
EOF

Call httpbin.b from sleep.a:

kubectl exec -it $(kubectl get pod -l app=sleep -o jsonpath='{.items..metadata.name}' -n a) -c sleep -n a -- curl httpbin.b.svc.cluster.local:8000/status/418

    -=[ teapot ]=-

       _...._
     .'  _ _ `.
    | ."` ^ `". _,
    \_;`"---"`|//
      |       ;/
      \_     _/
        `"""`

Call httpbin.a from sleep.a:

kubectl exec -it $(kubectl get pod -l app=sleep -o jsonpath='{.items..metadata.name}' -n a) -c sleep -n a -- curl httpbin:8000/status/418

For some reason, the address prefix contains the IP of the source pod:
 {
        "name": "<IP_ADDRESS>_8000",
        "address": {
            "socketAddress": {
                "address": "<IP_ADDRESS>",
                "portValue": 8000
            }
        },
        "filterChains": [
            {
                "filterChainMatch": {
                    "prefixRanges": [
                        {
                            "addressPrefix": "<IP_ADDRESS>",
                            "prefixLen": 32
                        },

kubectl get pods -o wide -n a
NAME                     READY   STATUS    RESTARTS   AGE    IP              NODE            NOMINATED NODE   READINESS GATES
sleep-6bdb595bcb-c8tw5   2/2     Running   0          116m   <IP_ADDRESS>   <IP_ADDRESS>   <none>           <none>


The Sitemaps.aspx is not updated correctly

Description of bug
Sitemaps.aspx does not update with new pages.
And also, if disable cache file the sitemaps become empty. even if you reset the cache.
Steps to reproduce
List the precise steps to reproduce the bug:

Go to Personal Bar -> SEO
Go to Sitemap Settings
Click on sitemap URL and see the content
Select "Days to Cache Sitemap For" = Disable Caching and save
Reload the sitemap URL and see empty content
Reset the "Days to Cache Sitemap For" to 1 Day and save.

Current behavior
The sitemap become empty. Same problem to see the new page on sitemaps.
The sitemap is not updated correctly.
Expected behavior
Update the sitemap.xml with correct pages.
Affected version

[ ] 10.0.0 alpha build
[ ] 9.5.0 alpha build
[x ] 9.4.4 latest supported release

Yes sorry, I correct.
I try other test and I found a solution.
The coreSitemapProvider wasn't setting to priority = 1.
After this the sitemaps work correctly.
I close the bug.


Does not handle list type in frontmatter. It also endup deleting the existing value

Describe the bug
When trying to display the frontmatter using the plugin, it deletes the content of the key if it is of type list
Steps to reproduce
My FrontMatter
Note.md
something:

one
two

Create a database
Source being folder containing the above file
Add a new column, select type as FrontMatter
Select custom and enter the key name -> something
The column value is empty
Check the actual file. The value for something in the file also becomes empty

Expected behavior
Frontmatter -> keys of type list should either be shown as list in database table or should say the type is not supported. Should not delete the existing values.
Also the column type does not have type list.
Are you using the mobile app?
No
Obsidian debug info
NA
Relevant log output
No response

I'm sorry if this caused any data loss. Will look into this today.

@pravin-d Fixed in 8.12.0


fix typo in variable name

Should be $newVM1

:white_check_mark: Validation status: passed

File
Status
Preview URL
Details

docs-conceptual/azurermps-5.4.0/azureps-vm-tutorial.yml
:white_check_mark:Succeeded

For more details, please refer to the build report.
Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.


Printing state

A cute little update to the serializer to output the state contained in stateful cells (i.e. memories & registers). It only does this when such cells are present, though generally there's at least one register.
We could remove registers from the output if we feel they're sufficiently represented in the port state, but I think it's nice to have them there.
Closes #548

LGTM! As we try to bring the input and output formats closer to those of fud, it might make sense to stratify the representation even more and have a registers field separate from memories. We can do it when we start running the correctness tests with the interpreter.


chore: Cleaning up ENABLE_REACT_CRUD_VIEWS config

SUMMARY
Now that ENABLE_REACT_CRUD_VIEWS is behind a feature flag (https://github.com/apache/incubator-superset/pull/11371) there seems to be merit in deprecating the config parameter with the same name (DRY) and using the feature flag framework to check the status, otherwise you'll likely need to override this in two places.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN
CI.
ADDITIONAL INFORMATION

[ ] Has associated issue:
[ ] Changes UI
[ ] Requires DB Migration.
[ ] Confirm DB Migration upgrade and downgrade tested.
[ ] Introduces new feature or API
[ ] Removes existing feature or API

Codecov Report

Merging #11496 into master will decrease coverage by 10.83%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master   #11496       +/-   ##
===========================================
- Coverage   66.64%   55.80%   -10.84%
===========================================
  Files         863      407      -456
  Lines       41230    13741    -27489
  Branches     3719     3502      -217
===========================================
- Hits        27477     7668    -19809
+ Misses      13653     5898     -7755
- Partials      100      175       +75

Flag
Coverage Δ

#cypress
55.80% <ø> (-0.67%)
:arrow_down:

#javascript
?

#python
?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files
Coverage Δ

...uperset-frontend/src/dashboard/util/dnd-reorder.js
0.00% <0.00%> (-100.00%)
:arrow_down:

...rset-frontend/src/dashboard/util/getEmptyLayout.js
0.00% <0.00%> (-100.00%)
:arrow_down:

...et-frontend/src/components/Menu/LanguagePicker.tsx
0.00% <0.00%> (-100.00%)
:arrow_down:

...dashboard/components/resizable/ResizableHandle.jsx
0.00% <0.00%> (-100.00%)
:arrow_down:

.../src/dashboard/util/getFilterScopeFromNodesTree.js
0.00% <0.00%> (-93.48%)
:arrow_down:

...uperset-frontend/src/utils/getClientErrorObject.ts
0.00% <0.00%> (-89.19%)
:arrow_down:

...ntend/src/views/CRUD/annotation/AnnotationList.tsx
3.57% <0.00%> (-88.74%)
:arrow_down:

...c/explore/components/controls/withVerification.jsx
9.09% <0.00%> (-87.88%)
:arrow_down:

...src/dashboard/components/gridComponents/Header.jsx
10.52% <0.00%> (-86.85%)
:arrow_down:

...rset-frontend/src/profile/components/Favorites.tsx
0.00% <0.00%> (-86.67%)
:arrow_down:

... and 679 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f918ca1...39e076d. Read the comment docs.

The CI is breaking probably because of this: https://github.com/apache/incubator-superset/blob/39e076d0566b12c115c6098fe5adaadec9cb7176/tests/superset_test_config.py#L76
I think we should clean this up and update is_feature_enabled to support env variables in a unified way:
    def is_feature_enabled(self, feature: str) -> bool:
        """Utility function for checking whether a feature is turned on"""
        env_key = f"SUPERSET_{feature}"
        if env_key in os.env:
            return True

        feature_flags = self.get_feature_flags()
        if feature_flags and feature in feature_flags:
            return feature_flags[feature]

        return False