text:
Typo in a method

There is a typo in a method:
mockSet.As<IQueryable<Blog>>().Setup(m => m.GetEnumerator()).Returns(0 => data.GetEnumerator());
Should be:
mockSet.As<IQueryable<Blog>>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

Document details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 1a04a5e4-3060-2331-f78d-8b45064b8983
Version Independent ID: 673d9406-3fa1-a9eb-f5cc-a431155e0260
Content: Testing with a mocking framework - EF6
Content Source: entity-framework/ef6/fundamentals/testing/mocking.md
Product: entity-framework
GitHub Login: @divega
Microsoft Alias: divega

This is already fixed. You may want to close this issue.

The recommended fix is wrong! It's even worser!
Take your attention on such importan thing like GetEnumerator which should called as Func here:
mockSet.As<IQueryable>().Setup(m => m.GetEnumerator()).Returns(  ( )=>  data.GetEnumerator());
instead of your wrong implemenration
mockSet.As<IQueryable>().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());
Because Returns(data.GetEnumerator()); will reach end of collection after first loop and each next request to collection\mocked object will return empty result!

It couldn't be worse, because previous example didn't compile at all.
But good catch. I reopened this issue. Thanks.

hey am new to testing, been following the tutorial but i can't quiet figure out where to create the async query provider. any help will be appreciated. thanks

Hey @santino-majur,
welcome. Your question does not relate to this issue, but let try to answer it here anyway.
It happens when you setup the Mock for the IQueryable<Blog>, where you use the TestDbAsyncQueryProvider instead of the default one:
mockSet.As<IQueryable<Blog>>()
       .Setup(m => m.Provider)
       .Returns(new TestDbAsyncQueryProvider<Blog>(data.Provider)); // here

Thank you for requesting a change to the EF6 documentation. We are prioritizing improvements to the EF Core documentation and at this time we are not making changes to the EF6 documentation.
However, we will consider well-written community pull requests to improve the EF6 documentation. The documentation source is located in the EntityFramework.Docs repository on GitHub. To submit a pull request:

Find the file to update and click on it to open

Click on the edit button (✏) to edit in your web browser

When done, add a title and description, then use the "Create a new branch and start a pull request." option.

(Note that you can also clone the docs repo and do a GitHub PR in the normal way.)

authors: Peska ajcvickers asartem rschindhelm-haba santino-majur


text:
Working on a project with SQL and Visual Studio 2015

Hello guys, I need help!!!
I'm currently working on a project where I have to create an **Application using SQL in Visual Studio 2015 ( UWP) .
The problem is , that Microsoft hasn't published any guide or tutorials for VS 2015 and SQL, as far as I know. There are some guides for previous Visual Studio but I always get to a point where something is missing or not the same .
I manage somehow  to connect the SQL database to my Project ( still don't know if it is the correct way) but my biggest problem  is , that i can't find any C # code to connect the SQL table to my application . Even when I find some code , it is not working because some libraries are missing or it is not well explained ( such as System.Data.SqlClient ).
I read that I can use SQLite with Entity Framework , but I'm not sure.I'm been working on this 2 weeks and still haven't find anything !The deadline is in 2 weeks. Please help :/

https://ef.readthedocs.io/en/latest/platforms/uwp/getting-started.html
hope it helps

source: gharchive/issue

repo: aspnet/EntityFramework

license: MIT

license_type: permissive

license_source: github-api


text:
Errors after upgrade from EF Core 1.1 to 1.1.1

After upgrading a solution to EF Core 1.1.1 some queries fail with stack traces similar to the following.
Result StackTrace:
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.CreateCommand(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, String executeMethod, IReadOnlyDictionary`2 parameterValues, Boolean closeConnection)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](Func`2 operation, Func`2 verifySucceeded, TState state)
   at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at lambda_method(Closure , ValueBuffer )
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Result Message:	No value provided for required parameter '_outer_Id1'.

I'll update the issue, when I find some time to create sample code for it. Need to find workarounds first.
Update: here comes some code...
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.EntityFrameworkCore;

// --- Models ------------------------------------------------------------------

public class Parent
{
    [Key]
    public Guid Id { get; set; }

    [Required]
    public string Name { get; set; }

    public ISet<Child> Children { get; } = new HashSet<Child>();
}

public class Child
{
    [Key]
    public Guid Id { get; set; }

    [Required]
    public string Name { get; set; }

    [Required]
    public Guid? ParentId { get; set; }

    public Parent Parent { get; set; }
}

// -- ViewModels ---------------------------------------------------------------

public class ResultView
{
    public string Name { get; set; }

    public int Children { get; set; }
}

// --- Context -----------------------------------------------------------------

public class ModelContext : DbContext
{
    public DbSet<Parent> Parents { get; set; }

    public DbSet<Child> Children { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var connectionStringBuilder = new SqlConnectionStringBuilder()
        {
            DataSource = "(localdb)\\MSSQLLocalDB",
            InitialCatalog = "EFCore",
            IntegratedSecurity = true
        };

        optionsBuilder.UseSqlServer(connectionStringBuilder.ConnectionString);
    }
}

// --- Test --------------------------------------------------------------------

public class Program
{
    public static void Main(string[] args)
    {
        // Set up database
        using (var context = new ModelContext())
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();
        }

        // Create query
        using (var context = new ModelContext())
        {
            var query = from parent in context.Parents
                        select new ResultView
                        {
                            Name = parent.Name,
                            Children = parent.Children.Count
                        };

            query.ToList();
        }
    }
}

Further technical details
EF Core version: 1.1.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 7
IDE: Visual Studio 2015

I got this error and also some others when trying to use .Select(new {});
I solved it by just returning the list and then iterating it to create new object as required

@axelheer This looks like a duplicate of #7811. I am going to close this one since the other issue has more information. If you think this is not a dupe of the other issue, then please can you provide more information on how to reproduce the bug and also include the exception message you are seeing.

@ajcvickers it's actually quite easy to reproduce. I've added the code; exception message is already there (copied from xunit ouput, whicht puts the message after the stack trace...).

authors: Wayne-Mather ajcvickers axelheer


text:
Make AddMyProvider methods act like top-level service methods

Since these now hang directly off IServiceCollection they should behave in the same way as other methods that are here. Specifically:

Renamed to indicate that they are methods for adding EntityFramework with a specific provider
Add their dependencies automatically--that is, call AddEntityFramework

This means that AddEntityFramework is now a infrastructure method, like AddRelational, that is called by providers. It has therefore been moved to the Infrastructure namespace.

Could somebody take a quick look at this? It's a very straightforward change and once it is reviewed I can start merging the D.I. changes.

:shipit:

Might be nice to have nested closure here, too

Merged

source: gharchive/pull-request

authors: ajcvickers anpete


text:
Prevent Collection Nav Props from Loading Unspecified Sub-Props

When including a navigation property, the associated navigation collection is loaded with data that is loaded from the initial query, even when ThenInclude is not specified.
Per the docs:

Entity Framework Core will automatically fix-up navigation properties to any other entities that were previously loaded into the context instance. So even if you don't explicitly include the data for a navigation property, the property may still be populated if some or all of the related entities were previously loaded.

Steps to reproduce
Consider the following entity structure:
public class Item
{
    public int Id { get; set; }
    public int CategoryId { get; set; }
    public string Name { get; set; }
    public Category Category { get; set; }
}

public class Category
{
    public int Id { get; set; }
    public string Name { get; set; }
    public List<Item> Items { get; set; }
}

If I want to retrieve all Items with their Category property populated, I unfortunately also get Item.Category.Items populated as well when a .ThenInclude was not specified:
public static async Task<List<Item>> GetItems(this AppDbContext db)
{
    var items = await db.Items
        .Include(x => x.Category)
        .OrderBy(x => x.Name)
        .ToListAsync();

    return items;
}

The default behavior should be to only load the navigation props specified. When using Entity Framework in conjunction with Web API, this creates unnecessarily bloated data structures received by the client and makes performance very slow.
My current workaround for large collections is as follows:
public static async Task<List<Item>> GetItems(this AppDbContext db)
{
    var items = await db.Items
        .Include(x => x.Category)
        .OrderBy(x => x.Name)
        .ToListAsync();

    Parallel.ForEach(items, i =>
    {
        i.Category.Items = null;
    });

    return items;
}

Further technical details
EF Core version: 2.1.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10 Pro
IDE: Visual Studio 2017 Pro 15.8.1 and Visual Studio Code 1.27.2

I already have ReferenceLoopHandling.Ignore set, but it's still populating this data. Beside the point, this is an unexpected and unintuitive behavior. If I wanted that data, then I would have used ThenInclude() to specify it as part of my query.

@JaimeStill You're only getting the data (i.e. rows from the database) that you are requesting. EF is not pulling back any extra data. It's just that this data is being connected up as defined by the relationships of the model. It, the relationships are being set between objects you are already getting.

@ajvickers There should at least be an opt-in or opt-out configuration for this as it is undesora

@JaimeStill The size of the dataset is not being changed in any way.

Or to try to explain in a different way, the JSON serializer is duplicating data, and hence it is taking the dataset that EF is returning and creating duplicates of many of the returned entities. This is why the data in JSON is bigger. The dataset that EF is returning is not bigger.

It is when it's serialized as JSON in Web API. Every Item conains a Category (which I asked for), and unexpectedly, each Category has an array of Items that I didn't ask for. The Category.Items should be null unless I specify that I wanted them with .ThenInclude(), or as proposed, I configure EF to attach the loaded data into the nav prop tree (as is default now).

@JaimeStill Yes. This is because the serializer is duplicating instances.

My biggest issue is that even before it gets to the serializer, that data is included in the C# model. Data I did not ask for, and data that I do not need. If I had wanted that data in the first place, I would have queried for it, and EF could have optimized reusing already retrieved data. I don't see how it's on the serializer to know not to include data I didn't ask for in the first place? I already have it ignoring self-referencing loops.

@JaimeStill I understand what you are saying--that you want the data in a graph that can be easily serialized without duplicates. There is value in that--it's something we are considering. However, this is specifically not about the data size.

I understand that having those values available doesn't impact the technical size of the data, but it does impact the shape of the data in a way that you wouldn't expect if you didn't understand what's happening. And that generates big implications for the size of serialized data being sent to the client side using Web API.
If I have a collection of 800 items with 800 categories, and each of those categories then has an entire array of items, that's a very crushing size once it becomes a JavaScript array.
It would be preferable to at least have the option to turn off this behavior to keep the shape of the data minimal when it is time for it to be serialized.

@JaimeStill Agreed!

@JaimeStill Of course, I am assuming that you know that if you never want to navigate that direction in your model, then you can just remove the navigation property:
public class Item
{
    public int Id { get; set; }
    public int CategoryId { get; set; }
    public string Name { get; set; }
    public Category Category { get; set; }
}

public class Category
{
    public int Id { get; set; }
    public string Name { get; set; }
}

Everything else should work the same.

@ajcvickers of course! Most of the time in these cases, the nav prop is preferred for the inverse (which items belong to a category). I understand you could manually query this, but I feel this is more in line with why we have nav props to begin with.
With this in mind, would there be a better workaround than manually setting the undesired values to null (as shown in the original issue)?

@JaimeStill I may have missed this if it was mentioned in the thread before, but are you aware that most serializers recognize “ignore” attributes that you can use to skip traversing specific navigation properties during serialization?
This is the simplest way to handle this that I am aware of, and possible the most common. It has the advantage that it can be used to eliminate cycles completely, so no extra configuration on the serializer is needed, and it solves it without introducing knobs on O/RMs (a good thing, IMO, because this is actually a  serialization concern independent of how the object graph was produced).

@divega, please see my response to the first comment. This data (in this case, each Item.Category.Items array) is still serialized in aspnet core using ReferenceLoopHandling.Ignore.

@ajcvickers @divega I created a minimal representation of this issue on GitHub with a comprehensive readme documenting the full scope of the issue in question.

@divega to look at the experience overall and suggest ways forward, either in docs or enhancements.

Guys...This issue is valid and affects performance drastically. In my case, the JSON response for a 4 record data reached about 25MB JSON responds. It's worse when you have a MANY to MANY relationship on your model.
    public class EventInfo
    {
        [Key]
        public int EventInfoId { get; set; }

        public Customer Customer { get; set; }

        public int EventLocaleId { get; set; }
        [ForeignKey("EventLocaleId")]
        public LocaleInfo EventLocale { get; set; }

        public int EventTypeId { get; set; }
        [ForeignKey("EventTypeId")]
        public EventType EventType { get; set; }

        public List<EventActivity> EventActivities { get; set; } //Many to many relation

    }

The above model is a simple model but each time I query as below:
EventInfo eventInfo = await _appDbContext.EventInfoes
                .Include(i => i.EventActivities)
                    .ThenInclude(i => i.Activity)
                        .ThenInclude(i => i.Translations)
                .Include(i => i.EventActivities)
                    .ThenInclude(i => i.SelectedSupplier)
                        .ThenInclude(i => i.VendorLocale)
                .FirstOrDefaultAsync(f => f.EventInfoId == id);

EventLocale is always fetched without any INCLUDE but others such as EventType is set to null. Same happens when i drill down the eventActivities collection
Temporary fix for me is below.
eventInfo?.EventActivities.ForEach(item =>
            {
                    item.EventInfo = null;           //Parent element EventInFo is also fetched
                    item.SelectedSupplier.EventActivities = null;  // Parent element fetch also

            });

To recognise the fix, i had to put a break point and then inspect my data generated from dbcontext. From 25MB, i was able to eliminate unnecessary data and reduced the size to about 197KB.
Is this an expected behavior.

Duplicate of https://github.com/aspnet/EntityFrameworkCore/issues/11564?

Triage: we consider this similar enough to close as duplicate of #11564.

authors: AndriySvyryd JaimeStill ajcvickers chukwu divega

repo: aspnet/EntityFrameworkCore


text:
Entity State going from Added to Detached upon calling SaveChanges()

I detailed my issue here: https://stackoverflow.com/questions/59185286/entityframework-savechanges-moving-entitystate-from-added-to-detached?noredirect=1#comment104613472_59185286
Are there any "gotchas" that I should be aware of as to why an entity would go from Added to Detached upon calling SaveChanges() while using an In Memory EF Core Database for Unit Testing?
Through debugging, I was able to figure out that it is ONLY happening upon the first Add/SaveChanges. Calling the same method a second time results in a successful, persisted insert.

@CoreySchnedl Please post a small, runnable project/solution or complete code listing that demonstrates the behavior you are seeing so that we can fully investigate.

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.
BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

authors: CoreySchnedl ajcvickers


text:
Join with DefaultIfEmpty on non-nullable (struct) property generates INNER JOIN

Similar to https://github.com/aspnet/EntityFrameworkCore/issues/13511 but with a Join rather than a SelectMany, using a join against a table with DefaultIfEmpty and a non-nullable struct as the the inner/outer key creates an INNER JOIN query rather than an OUTER JOIN query.
The non-nullable property that is used as the inner/outer join key has a converter to-and-from string.
Ulid? graderId = null;
var response = await _db.Responses
    .AsNoTracking(!track)
    .Where(response => response.Id == responseId)
    .Join(_db.GradedSurveys.DefaultIfEmpty(),
        response => response.Id,
        gradedSurvey => gradedSurvey.ResponseId,
        (response, gradedSurvey) => new {
            Response = response,
            GraderId = gradedSurvey.GraderId
        })
    .Where(join => join.GraderId != graderId)
    .Select(join => join.Response)
    .OrderBy(r => r.Id)
    .FirstOrDefaultAsync(cancel)
    .ConfigureAwait(false);

The intention is to select records from Responses where there is no corresponding record in GradedSurveys.
This expands to the following query:
SELECT "t0"."id", "t0"."date", "t0"."gradeId", "t0"."hash", "t0"."path", "t0"."subjectId", "t0"."surveyId", "t0"."teacherId", "t0"."id0", "t0"."date0", "t0"."jpegPath", "t0"."name", "t0"."pdfPath", "t0"."id00", "t1"."id", "t1"."index", "t1"."name", "t1"."surveyId", "t1"."text", "t1"."id0", "t1"."index0", "t1"."name0", "t1"."questionId", "t1"."text0"
FROM (
    SELECT "r"."id", "r"."date", "r"."gradeId", "r"."hash", "r"."path", "r"."subjectId", "r"."surveyId", "r"."teacherId", "s"."id" AS "id0", "s"."date" AS "date0", "s"."jpegPath", "s"."name", "s"."pdfPath", "t"."id0" AS "id00"
    FROM "responses" AS "r"
    INNER JOIN (
        SELECT "g"."id", "g"."flags", "g"."graderId", "g"."gradingTime", "g"."responseId", "g"."timestamp", "g"."id" AS "id0"
        FROM (
            SELECT NULL AS "empty"
        ) AS "empty"
        LEFT JOIN "gradedSurveys" AS "g" ON 1 = 1
    ) AS "t" ON "r"."id" = "t"."responseId"
    INNER JOIN "surveys" AS "s" ON "r"."surveyId" = "s"."id"
    WHERE ("r"."id" = @__responseId_0) AND "t"."graderId" IS NOT NULL
    ORDER BY "r"."id"
    LIMIT 1
) AS "t0"
LEFT JOIN (
    SELECT "q"."id", "q"."index", "q"."name", "q"."surveyId", "q"."text", "a"."id" AS "id0", "a"."index" AS "index0", "a"."name" AS "name0", "a"."questionId", "a"."text" AS "text0"
    FROM "questions" AS "q"
    LEFT JOIN "answers" AS "a" ON "q"."id" = "a"."questionId"
) AS "t1" ON "t0"."id0" = "t1"."surveyId"
ORDER BY "t0"."id", "t0"."id00", "t0"."id0", "t1"."id", "t1"."id0"

I believe this assumes that the intent is to find a matching record rather than exclude matching records and optimizes accordingly; I would have thought DefaultIfEmpty would have skipped that but it does not seem to.
Further technical details
EF Core version: 3.1
Database provider: Microsoft.Data.Sqlite
Target framework: 3.1
Operating system: Windows 10 x64
IDE: N/A

@mqudsi - Does this give incorrect results? Since you asked for Join with DefaultIfEmpty collection, we generate LeftJoin with Null to generate a DefaultIfEmpty and then inner join it with outer. The SQL is expected and correct.

Yes, the result is an empty set because records with an empty collection do not match at all.

The left join is fine, the first “inner join” is the issue.

Perhaps I am misunderstanding the intent of DefaultIfEmpty() here, or its virality? The missed records occur when there is a Response that has no GradedSurvey entries in its navigation property GradedSurveys.
In particular, for the data in question, the innermost query
SELECT "g"."id", "g"."flags", "g"."graderId", "g"."gradingTime", "g"."responseId", "g"."timestamp", "g"."id" AS "id0"
FROM (
    SELECT NULL AS "empty"
) AS "empty"
LEFT JOIN "gradedSurveys" AS "g" ON 1 = 1

produces the same results as a naive select:
SELECT "g"."id", "g"."flags", "g"."graderId", "g"."gradingTime", "g"."responseId", "g"."timestamp", "g"."id" AS "id0"
FROM gradedSurveys "g"

therefore the subsequent outer LEFT JOIN is effectively no different than if it were an INNER JOIN as the null values have already been excluded from propagating to this level.

produces the same results as a naive select:

No, it does not. It produces the same result only when gradedSurveys table is not empty. When that table is empty then the result of first query is a row with all null values rather than 0 rows returned. Which is exactly same behavior as DefaultIfEmpty in LINQ.

Your LINQ query does not match exactly with the SQL you have posted.
If you want a left join then use actual left join. See https://docs.microsoft.com/en-us/ef/core/querying/complex-query-operators#left-join

The intention is to select records from Responses where there is no corresponding record in GradedSurveys.

Your LINQ query does not do that. Specifically, you need to write an actual Left Join as posted in doc above and then use a where predicate to filter out non-null matches.

That's fair enough. I ran into issues with SelectMany, but that's in the other issue. I'll close this one out.

authors: mqudsi smitpatel


text:
Adding myself as CODEOWNER

For all kcore-related areas. So I can see the PRs coming in.

@anurse - merge?

Whoops! Thanks.

authors: Eilon anurse

repo: aspnet/Extensions


text:
Call OnStarting before verifying response length (#1289)

#1289
@Tratcher @halter73 @natemcmaster @pakrym

🔔

Updated.

:shipit:

repo: aspnet/KestrelHttpServer


text:
Install .NET Core 1.1.2

Required for the custom version of CSC we use

👍
/cc @benaadams

authors: davidfowl natemcmaster


text:
Merge branch 'release/2.1' into release/2.2

#2709

Merged here: https://github.com/aspnet/KestrelHttpServer/commit/864cfeb2aa1921188fd66eccbeaddf4155f47ad6


text:
Response.ContentType doesn't work in MVC controller

From @Daniel15 in https://github.com/aspnet/HttpAbstractions/issues/364:
I'm using Razor to generate some XML (an RSS feed). I have this in one of my ASP.NET MVC controllers:
Response.ContentType = "application/rss+xml";
return View("Foo")

However IIS Express is still serving the response as text/html.
This doesn't work either:
Response.Headers.Set("Content-Type", "application/rss+xml");

However, setting a custom header (eg. X-Test) does work.
(I wasn't sure whether to report this here or in the ASP.NET MVC repo)

From me:
We should have the view engine only set the content type if it's not already set. According to @Tratcher this is trivial to do.

repo: aspnet/Mvc


text:
Resource renames

The names of the generated resources will change. This change addresses that. The new names are <projectname>.<folder_path_with_dots>.<resource_name>
Please review: @pranavkm @davidfowl @dougbu @DamianEdwards

:watch:

@victorhurdugaci

which is the base change you're reacting to here?
what is the timing for the set of changes?
suggest this change should not impact the generated files under test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles.  instead change MvcRazorHostTest.RunRuntimeTest() and ...RunDesignTimeTest() to use the same filenames as before (nput files are still read from disk) but check them against the renamed resources.

:watch:

@dougbu
which is the base change you're reacting to here?

https://github.com/aspnet/dnx/pull/1615
what is the timing for the set of changes?

sometime this week
suggest this change should not impact the generated files under ...

good point. updated

:shipit:

authors: dougbu pranavkm victorhurdugaci


text:
Rename TargetElement to HtmlTargetElement

See discussion in https://github.com/aspnet/Mvc/issues/3101.
Please post an announcement when done.

f71f9fb67995c0d5aa56354fbe11769a5e26497b
https://github.com/aspnet/Mvc/commit/93735a5be67479616d92d07e5d04329ec4d64099
https://github.com/aspnet/RazorTooling/commit/30a8c5bebe6d15800250eec8bbcf90c026ed3ca1

authors: Eilon NTaylorMullen

repo: aspnet/Razor


text:
Reduce catch all element completion usage.

This makes it so if you have catch all TagHelperDescriptors their completions don't apply to every existing completion. Instead, they now only apply to already TagHelperified completions and existing completions that are prefixed with a non-empty TagHelperPrefix.
Updated existing test to have new expectations.
Added new test to validate non-empty tag helper prefix case.

#1230
/cc @alexgav This changes the expectations on how catch-all TagHelpers work.

We should probably wait until @alexgav is ready to digest these changes on his side since it's going to break their tests. I don't want their team to have to deal with this while he is on vacation.

Ok, this change looks fine, but let's wait for @alexgav to return

Totally agree

authors: NTaylorMullen rynowak


text:
Update Razor SDK packing logic to not include Pack at properties layer.

We now rely on the Razor source inputs layer to add packing to cshtml content items.

#2378
#2384
@mkArtakMSFT This is ready to go, let me know when i'm good to merge.

🆙 📅

@NTaylorMullen this should be good to go in now.

authors: NTaylorMullen pranavkm


text:
Consider splitting AutomaticAuthentication

AuthenticationOptions.AutomaticAuthentication actually covers two concepts, authenticate (set the user) and challenge (handle 401s).
/// If true the authentication middleware alter the request user coming in and
/// alter 401 Unauthorized responses going out. If false the authentication middleware will only provide
/// identity and alter responses when explicitly indicated by the AuthenticationScheme.

Cookie, Bearer, etc. support both, but facebook, OIDC, etc. only support automatic challenges.
Note that if we did separate the flags it would mean you could auto-authenticate (which is non-invasive) without auto-challenging, possibly alleviating some of the complaints against the cookie middleware.

Done as part of 409b50269a9d85618a31f84a3ffc2868abb3eeea

authors: HaoK Tratcher

repo: aspnet/Security


text:
Share ASP.NET MVC 5 Forms authentication?

My question: There are two projects, one project is old (ASP.NET MVC 5), it is a login site, write code like FormsAuthentication.SetAuthCookie (" xishuai ", false);, another project ASP.NET 5 is rewritten, the site needs to obtain verification of the identity of another site, such as this code: var name = User.Identity.Name;, but I can not get found, here is my test.
ASP.NET MVC 5
Web.config:
<system.web>
  <compilation debug="true" targetFramework="4.6" />
  <authentication mode="Forms">
    <forms name=".CNBlogsCookie2" loginUrl="/Home/About" />
  </authentication>
  <httpRuntime targetFramework="4.6" />
</system.web>

HomeController:
public class HomeController: Controller
{
    [Authorize]
    public ActionResult Index()
    {
        var name = User.Identity.Name; // get 'xishuai' value
        return View();
    }

    public ActionResult About()
    {
        FormsAuthentication.SetAuthCookie("xishuai", false);

        ViewBag.Message = "Your application description page.";

        return View();
    }
}

I first tested under the two projects are ASP.NET MVC 5, such as http: // localhost: 24255 / http: // localhost: 24256 /, User.Identity.Name value which can be obtained to.
ASP.NET 5
Startup.cs
app.UseCookieAuthentication((cookieOptions) =>
{
    cookieOptions.AutomaticAuthenticate = true;
    cookieOptions.AutomaticChallenge = true;
    cookieOptions.CookieName = ".AppCookie";
});

"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final"
HomeController:
public class HomeController: Controller
{
    public ActionResult Index()
    {
        var name = User.Identity.Name; // get null
        return View();
    }
}

How do I solve this problem?

The cookie format and the encryption pieces changed between MVC 6 and ASP.NET 5
Right now there's an unsupported compatibility package - it will become more official in the RC2 timeline.
There is documentation at https://docs.asp.net/en/latest/security/data-protection/compatibility/cookie-sharing.html

That compat package only helps if you were using Katana v3. It doesn't go all the way back to Asp.Net 4 forms auth.

The above test is not no solution?
My real problem is that there are a lot of old projects (WebForms, MVC 3/4/5, etc.), and now we want incremental improvements to ASP.NET 5, so the process of transformation on the emergence of the above problems.
I read this blog: [Sharing authentication cookies between ASP.NET 4.x and ASP.NET 5 applications.] (Https://docs.asp.net/en/latest/security/data-protection/compatibility/cookie -sharing.html # sharing-authentication-cookies-between-asp-net-4-x-and-asp-net-5-applications), is not to achieve this effect you need to rewrite ASP.NET 4.x applications, such as using app.UseCookieAuthentication(new CookieAuthenticationOptions {} ); GenerateUserIdentity..., instead of using FormsAuthentication.SetAuthCookie("xishuai", false);...?

@blowdart I understand what you mean, about how long it can be compatible? and about RC2 timeline I can see it?

@Tratcher 😭

In ASP.NET 5, and I am trying to rewrite FormsAuthentication.Decrypt(cookieValue) code, using  web.config-machineKey-validationKey decryption, I just want to get FormsAuthenticationTicket.Name, but it feels more difficult.

There is not FormsAuthentication.Decrypt(). The cookie format and the encryption methods got greatly improved. What you want to do simply won't work. We provide a back compat package, but as Chris says it's only going back one version.

@blowdart Ok, what this version is?

I'm afraid I don't understand your question.
If your project was a new project from vs2013 the shim package will work.
If you upgraded a previous project to the katana platform which came with 2013 it should work.

@blowdart Sorry, my English is very bad.
Once again, I describe my problem, I have a lot of old sites (such as using WebForms), now I need to rewrite these sites to ASP.NET 5, but the login site has not been rewritten (using the Forms Authentication), now I rewrote a project to ASP.NET 5, need to verify the identity of a user (such as using User.Identity.Name), it is the beginning of what I do that test.
You mentioned: "It's only going back one version", I want to know what this version is? thanks.

The version would be Katana v3. So you need to upgrade your existing sites to that first. Katana shipped with VS2013.

@blowdart Ok, but now I use VS2015 Update1, and some packages using rc2 version, if to solve the above problem, I can not use ASP.NET 5 is not it?

I'm sorry, I'm not sure what you're asking again?
So, let's imagine you start a new project in .NET 4.5.2 from scratch. In VS2015. That ends up using Katana 3. That will accept the forward compat packages. There's more about Katana at http://www.asp.net/aspnet/overview/owin-and-katana/an-overview-of-project-katana
FormsAuthentication.SetAuthCookie() isn't part of Katana. You must bring your login system, and of course everything that depends upon it up to Katana first. Then you need to switch everything to use the compat shim. Then and only then will ASP.NET v5 understand the cookies

@blowdart 😂
I think I know what you mean, I need to first upgrade login system to Katana v3, and other systems using ASP.NET 4.x or ASP.NET 5 is possible, is not it?

It should be possible yes, but it may be a lot of work for you. In all honesty you might want to look at some sort of OAuth system, using Identity Server https://identityserver.github.io/Documentation/
This means rather than drag everything up you would use whatever OAuth code is appropriate for each version of .NET, MVC, WebForms or whatever that you're using.

@blowdart Ok, I understand.
Now log into the system is not good upgrade, because it involves other systems, if a start using OAuth, this problem may not occur, and I really appreciate your patience, thank you very much.
However, if the ASP.NET 5 is compatible with Forms Authentication just fine.👻

Forms Authentication comes in many versions.
To be precise we are only compatible with Katana 3.0's cookie middleware, which is used by forms authentication

@blowdart Ok, Thanks again.

@blowdart Now, I can not rewrite the login system code(Forms Authentication), but other systems rewritten ASP.NET 5, my idea is to decrypt Cookie in the new system code, I saw this project DataProtection and relevant documents, but I do not really understand, you think you can achieve?

As @blowdart says, that will be very hard to do but if you can't possibly change the other application then you'd need to write a separate middleware and component that understands the older cookie format. Basically porting FormsAuthentication.Decrypt https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/FormsAuthentication.cs#L128 (which is a beast :smile:). And a bunch of logic from the old FormsAuthenticationModule https://github.com/Microsoft/referencesource/blob/master/System.Web/Security/FormsAuthenticationModule.cs#L327.
Some caveats:

This code won't work on .NET Core (which means it won't work cross platform). At least not as is.
It requires reading of the machine key section. Calling this method from an ASP.NET 5 application probably won't work the way you expect it to (if you just try to call FormsAuthentication.Decrypt), as there is no config hierarchy etc.

@davidfowl Yes, you say I fully understood, some time ago, I rewrote the code about FormsAuthentication.Decrypt in ASP.NET 5, the same as you say it is very difficult (😭😭😭), in addition to some of the caveats you said, there is involved a lot of other code, I'll try the next.
In addition to this way, do you think there are other solution?

In addition to this way, do you think there are other solution?

Not that I'm aware of. Just try calling FormsAuthentication.Decrypt and see what breaks.

@davidfowl Ok, thank you very much, if there is a breakthrough, then please tell me.

@davidfowl Now what progress?

Nobody is working on this. Did you try one of the suggestions?

@davidfowl Sorry, now I do not try to do this, but in my plan, some time ago I tried the next, but the implementation is very difficult, because the code involved is very large, Chinese called "牵一发而动全身", later if there is progress, I'll get back to you Thank you. :)
In addition, about this, do you have any plans? The future will provide a compatible version?

MVC6 Decrypting a forms authentication cookie from another website
FormsAuthenticationTicketHelper.cs

I tried again, but still failed, I was ready to give up temporarily.

As you appear to have gotten this working I'm going to close the issue.
There will not be any back compat package for anything other than Katana based sites.

I changed the ways to solve this problem, blog record: http://www.cnblogs.com/xishuai/p/aspnet-5-or-core1--identity-part-two.html

Incase anyone comes across this thread in the future, this may be helpful:
https://github.com/dazinator/AspNetCore.LegacyAuthCookieCompat

authors: Tratcher blowdart davidfowl johnhamm yuezhongxin


text:
[WIP] Adds launchSettings.json to 2.1.x templates

For #152 . WIP as 2.0.x didn't have launch settings for the Spa Templates and I'm not sure if we need to include some of the options.

I'll defer all review matters to @SteveSandersonMS. I don't know anything about what's expected here.

authors: jkotalik natemcmaster

repo: aspnet/templating


text:
Fix IndexError bug

Resolves #209

Thanks, looks fine to me. Will merge.

Closes #209

repo: asreview/asreview


text:
add description of ris-export option

@J535D165 screenshots need update

@J535D165 let's close this pr for now


text:
When rendering a pass through a response, the callback never gets called on success

When I render a pass through the .render(response, callback) method, the callback only gets called when something fails.
I thing the issue is that the "end" event is never emitted when the zip file has been created successfully. I've done some testing, and I've seen that the "end" event on the zip variable is never fired neither.
When I add an zip.emit("end") after adding the signature is added to the zip. Still nothing happens. When i move the zip.on("end", ...) outside of the callback passed to the self.signZip(...) method, my original callback gets called.
here is how I changed the code:
in pass.js:
within the pipe function:
function doneWithImages() {
    if (lastError) {
      zip.close();
      self.emit("error", lastError);
    } else {

//This was moved up
		zip.on("end", function() {
          self.emit("end");
        });
		zip.on("error", function(error) {
          self.emit("error", error);
        });
//End of change
      self.signZip(zip, manifest, function(error) {
        zip.close();
        //the above code was taken from here
      });
    }
  }

within the signZip function:
signManifest(this.template, json, function(error, signature) {
    if (!error) {
      zip.addFile("signature").end(signature);
//The next line was added
zip.emit("end");
    }
    callback(error);
  });

+1
and thanks @mikeseghers  for finding the solution

authors: kgjohnso mikeseghers

repo: assaf/node-passbook

license: mit

license_source: bigquery


text:
ERROR:    Exception in ASGI application

I am using my Mac M2 air.
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_models.py", line 70, in init
self._list = [
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_models.py", line 74, in
normalize_header_value(v, encoding),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_utils.py", line 53, in normalize_header_value
return value.encode(encoding or "ascii")
UnicodeEncodeError: 'ascii' codec can't encode character '\u201d' in position 7: ordinal not in range(128)
ERROR:    closing handshake failed

@13331112522 is this an error you're getting when trying to run the app?
If so, you might have an easier path via Docker Desktop:
Step 1: Install Docker Desktop
Step 2: Walk through this Tutorial
@arsaboo another requirement I should have mentioned: the path to your files should be within the code of this project

repo: assafelovic/gpt-researcher


text:
Lambda deployment fails

Due recent changes on Lambda state changes Lambda deployment fails because of the ResourceConflictException.
More information about the changes on AWS side:
https://aws.amazon.com/blogs/compute/tracking-the-state-of-lambda-functions/
Is this going to be fixed?

Not related.

repo: assertible/lambda-cloudwatch-slack


text:
(very) small error in javadoc of : org.assertj.core.api.Assertions#within(long, java.time.temporal.TemporalUnit)

There is a small error in the java doc of org.assertj.core.api.Assertions#within(long, java.time.temporal.TemporalUnit)
"Assertions entry point for TemporalUnitOffset with with less than or equal condition to use with isCloseTo temporal assertions."
"with" is doubled

assertj core version: 3.7.0

Good catch, thanks for reporting this @remika!

authors: joel-costigliola remika

repo: assertj/assertj


text:
isEqualToNormalizingWhitespace doesn't normalise non breaking space characters

Describe the bug
isEqualToNormalizingWhitespace doesn't normalise non breaking space characters

assertj core 3.21:
java version: 17
Kotlin 1.9.0
test framework version: JUnit 5.9.1
os (if relevant):

Compare 2 strings with one having a NBSP character instead of a normal space
val result = "10,00 € to 100NBSP000,00 € per year"
val expected = "10,00 € to 100 000,00 € per year"
assertThat(result).isEqualToNormalizingWhitespace(expected)

That's a bit weird since the implementation detects the whitespace characters according to the JDK Character method isWhitespace that includes non-breaking space characters.
Could you attach a test case in a PR, reason is a test in a github comment may or may not honor the non-breaking space characters when we copy it to our codebase.
Thanks!

@joel-costigliola the documentation of the isWhitespace method seems to indicate that the non-breaking spaces are  not consider as regular whitespaces.
I've added this test case locally that seems to confirm that:
should_pass_if_both_Strings_are_equal_after_whitespace_is_normalized

I've also noticed that the isNotBlank assertion is false if a string is filled with non-breaking spaces because it uses the isWhitespace method as well (I think that's the expected behavior because some unit tests have been specifically added).
I think that the non-breaking spaces ('\u00A0', '\u2007', '\u202F') should be replaced in the normalizeWhitespace method.
Is it ok if I work on this issue ? I think this might be a good first issue 🙂

I had some spare time so I gave it a try: https://github.com/assertj/assertj/pull/3120 😅

@joel-costigliola the documentation of the isWhitespace method seems to indicate that the non-breaking spaces are not consider as regular whitespaces.

Specifically:

Determines if the specified character is white space according to Java. A character is a Java whitespace character if and only if it satisfies one of the following criteria:

It is a Unicode space character (SPACE_SEPARATOR, LINE_SEPARATOR, or PARAGRAPH_SEPARATOR) but is not also a non-breaking space ('\u00A0', '\u2007', '\u202F').
...

Should we actually move away from what the JDK does, or should we only improve the Javadoc to state more clearly that these assertions follow the Character::isWhitespace behavior?
In the case of the latter, it would be nice to identify a workaround, if there is any.

I'm happy we extend the definition of whitespace and we update the javadoc to clearly show what we mean by it.

authors: ArneKlein joel-costigliola maximedezette scordio


text:
adding ui-hide-space attribute not removing space between [Number] and [%]

Hi,
I have added below given attributes to a input type text but the space between [Number] and [%] is still there. It is not getting removed. Appreciate if any one can help to fix this issue.

Regards,
Zubair Shaikh

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/37254019-adding-ui-hide-space-attribute-not-removing-space-between-number-and?utm_campaign=plugin&utm_content=tracker%2F1022469&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F1022469&utm_medium=issues&utm_source=github).

Check if 2.5.0 solves your problem.
If not reopen this issue.

authors: assisrafael zubairshaikh

repo: assisrafael/angular-input-masks


text:
Deselected keywords should not be extracted again

When a user removes one of the extracted keywords from the list, the keywords come up again:

when sending a new message
when leaving the room and enter it again.

In both cases the state gets lost and therefore the time the user (human) has spend to tell the Smarti (machine) what he wants is wasted. Therefore the user is a kind of frustrated.
Deselected/removed Keywords should not pop up again when a new message is being sent or when switching between channels.

Additionally, deselected keywords shall be marked as removed for all providers, not only for one

authors: mrsimpson ruKurz

repo: assistify/smarti


text:
doc: remove vue-vine from ecosystem

In the 'Who is using ast-grep?' github issue, vue-vine was reportedly using ast-grep instead of babel to parse ASTs. However, as of July 25, 2023, vue-vine has returned to using babel.
ast-grep.github.io has two more references to vue-vine but they are both still relevant.

Language Injection example for ast-grep to support vue-vine
Link to file showing how vue-vine used ast-grep NAPI from before they switched back to babel

Thanks!

authors: HerringtonDarkholme StevenLove


text:
Delivery policy and TriggerEngine revision proposal

Motivation
AMQP triggers and HTTP triggers are treated differently: an AMQP trigger generates a message which is sent to an exchange, and the handling of delivery errors is up to the third-party client. Instead, a HTTP trigger generates a message and must also handle the delivery of that message.
Therefore, AMQP and HTTP triggers should be two separate things, and HTTP triggers should be provided with a policy to address possible errors.
Definitions

Routing rule: the old AMQP trigger. Mechanism for the delivery of an AMQP message to an exchange upon the occurrence of specified conditions .
Trigger: the old HTTP trigger. Mechanism for the generation of actions upon the occurrence of specified conditions. An action delivers a HTTP message to a recipient.
(Delivery) Policy: structured description of how data from triggers are delivered to the recipient.

Description
A policy is an attribute of a trigger. The main focus of the policy is error handling upon delivery of messages. The payload is described by the action of the trigger. Each policy has a unique name.
Due to constraint on the dimensionality of data, it is not possible for a policy in the general case to assure that a message will reach its destination (e.g. messages are to be sent to a non-existing resource). However, if the destination is available, policy guarantee the reception of the message - unless explicitly stated otherwise.
The main attributes of a policy are the error_handling to adopt if a message does not reach destination and the retry_queues to use if messages are to be resent in case of failed delivery.
Main components

Error handling is done by a list of handlers. Each handler refers to one or more delivery errors and describes the retreat strategy Astarte should take when they occur.
It is possible to select a range of error numbers (e.g. HTTP client errors: [400 ... 499]) and explicitly exclude some in the range.
There are two possible retreat strategies: none (ignore the error) or retry. In case of retrying, an associated retry queue must be added. The default retreat strategy is none on all errors.

The retrying queue is a space containing messages whose delivery has failed and must be resent.
For memory reason, the size of the retrying queue must be fixed and therefore is not optional. This gives an upper bound on the amount of space a retry queue uses.
Every message in a retry queue can be resent up to a specified number of times.
If the number of messages in the retry exceeds the size, the maximum capacity policy specifies what messages to delete. The maximum capacity policy is one between fifo (default) and lifo.
The order in the retrying queue can be based on the timestamp of the first or the last delivery failure.
it is possible to have more than one handler related to the same queue. In this case, all messages in the queue have the same number of retry times, as specified by the queue.

Syntax
Policy:
{
    "name" : <string>,
    "error_handlers" : [<handler>],
    "retry_queues" : [<string>]
}

If error_handlers if empty, then messages failing to reach destination are lost.
Handler:
{
    "error_type" : [<int>] | '[' <int> '...' <int> ']' | "*",
    "excluding" : [<int>],
    "retreat_strategy" : "none" | "retry",
    "retry_queue": <string>
}

The error_type list or range must contain only valid HTTP errors. Every error not included in an handler range defaults to none repeat strategy. "*" is a shortcut for all errors.
excluding is optional.
If retreat_strategy is not retry then retry_queue must not be set.
Retry queue:
{
    "name" : <string>,
    "retry_times" : <int>,
    "order" : "first_failure" | "last_failure",
    "maximum_capacity" : <int>,
    "mc_policy" : "fifo" | "lifo"
}

Each message in the queue will be resent up to retry_times, unless the maximum_capacity is exceeded.
deletion_order describes which timestamp to use for ordering the queue, either the one of the first_failure or the one of the last_failure.
maximum_capacity sets the size of the retrying queue, while mc_policy describes the policy for deletion of exceeding messages.
Examples
The simplest policy:
{
    "name" : "simple_policy",
    "error_handlers" : [],
    "retry_queues" : []
}

This policy ensures no guarantee of good delivery for any HTTP error.
A more complex policy:
{
    "name" : "complex_policy",
    "error_handlers" : [
            {
                "error_type" : "*",
                "excluding" : [402, 403, 404],
                "retreat_strategy" : "none"
            },
            {
                "error_type" : [404],
                "retreat_strategy" : "retry",
                "retry_queue": "queue_1"
            },
            {
                "error_type" : [402, 403],
                "retreat_strategy" : "retry",
                "retry_queue": "queue_2"
            }
        ],
    "retry_queues" : [
            {
                "name" : "queue1",
                "retry_times" : 5,
                "order" : "first_failure",
                "maximum_capacity" : 500,
                "mc_policy" : "fifo"
            },
            {
                "name" : "queue2",
                "retry_times" : 1,
                "order" : "last_failure",
                "maximum_capacity" : 100,
                "mc_policy" : "lifo"
            }
        ]
}

If there occurs an HTTP error outside the range [402, 403, 404], then Astarte will do nothing.
If an HTTP 404 error occurs, then Astarte will try to resend the message up to 5 times, using a retry queue holding up to 500 messages, ordered by timestamp of the first failure;
if more messages are present in the queue, the oldest ones will be deleted, even if they were resent less than 5 times.
If an HTTP 402 or 403 error occurs, then Astarte will try to resend the message up 1 time, using a retry queue holding up to 100 messages, ordered by timestamp of the last failure;
if more messages are present in the queue, the newest ones will be deleted, even if they were resent less than 1 time.

A possible implementation may revise the current delivery of messages from Data Updater Plant to Trigger Engine.
At the moment, all HTTP data are published by Data Updater Plant to the astarte_events exchange in an unique trigger_engine queue. Trigger Engine then synchronously processes each message in order and acks the broker.
A revised implementation might allow for more than one AMQP queue (possibly user-defined), and the possibility of nacks to track failed delivery upon HTTP errors.
This means that retry_queues are to be mapped to AMQP queues, therefore some proposed attributes (e.g. "order" and "mc_policy") might not be implemented. In general, retry_queue attributes would be more similar to RabbitMQ queues'.
Some combination of policy and queues (1-to-1, n-to-m) are to be discussed.
Revised Syntax (up-to the type of policy/queue combination)
Policy: unchanged.
Handler:
    "error_type" : [<int>] | '[' <int> '...' <int> ']' | "*",
    "excluding" : [<int>],
    "retreat_strategy" : "none" | "retry",
    "message_ttl" : <int>

message_ttl is optional and sets an expiration time in milliseconds for each message.
Queue:
    "name" : <string>,
    "retry_times" : <int>,
    "maximum_capacity" : <int>,
    "mc_policy" : "default" | "reject_publish",
    "increase_priority_on_failure" : "true" | "false",
    "max_priority_level" : <1 ... 10>

A RabbitMQ queue either discards failed messages or re-enqueues them near their original position (see here).
The default behavior if the queue capacity is exceeded is to delete oldest messages, but it may be set to reject new messages until publication is again possible (see here). This might not be a desiderable feature, as newer messages may be lost.
There is no built-in tracking of retry_times, so this will probably be implemented adding a retry_time field to the message.
It could be useful to increase the priority of failed messages in order to resend them asap; in that case, a maximum priority level must be set (see here). Note, however, that this may alter the order of messages.
Possible combinations of policies and queues
Assuming 1,000 messages with 10 KB of payload, a  RabbitMQ queue with Astarte's internal messages could use up to 10 MB of memory (see here).  In a production environment, we may assume 30-50 installed Astarte interfaces.

1-to-1: a policy, a queue

Pro: can easily estimate an upper bound on memory usage, order of messages is preserved;
Con: each retried message has the same number of retry_times ad the same message_ttl.

1-to-many: a policy, many queues

Pro: the client can customize retry_times and message_ttl for any kind of error;
Con: client message reception could not be in order, there is no bound on memory usage.

many-to-many: policies and queues are not strictly related

Pro: Customizable as the 1-to-many case, there could be an hardcoded upper bound on the number of queues;
Con: Need an installation procedure (and overhead) for queues, client message reception could not be in order.

Other interesting points:

it should be possible to install a policy in the same way an interface is installed, so that interfaces can point to policies without declaring them at the same moment;
"increase_priority_on_failure"  and "max_priority_level" have no interesting use cases;
"reject_publish" policy is useless;
Probably Astarte Cloud can use more than ~50 interfaces;
A simple implementation of queues without using RabbitMQ may be considered.

Revised proposal
Definitions

Routing rule: the old AMQP trigger. Mechanism for the delivery of an AMQP message to an exchange upon the occurrence of specified conditions.
Trigger: the old HTTP trigger. Mechanism for the generation of actions upon the occurrence of specified conditions. An action delivers a HTTP event to a recipient.
Events: messages sent by a trigger.
(Delivery) Policy: structured description of how data from triggers are delivered to the recipient.
(Event) queue: the queue of events to be delivered using a policy.

Description
The main focus of the policy is error handling upon delivery of events. The payload is described by the action of the trigger. Each policy has a unique name and must be installed like and interface.
A trigger must specify an installed policy in the required policy field.
Due to constraint on the dimension of data, it is not possible for a policy in the general case to assure that an event will reach its destination (e.g. events are to be sent to a non-existing resource).
A policy describes what to do in case of delivery errors and how undelivered events are enqueued.
A policy is mapped to one queue, and queues are not shared among policies.
Main components

Error handling is done by a list of handlers. Each handler refers to one or more delivery errors and describes the retreat strategy Astarte should take when they occur.
It is possible to select a range of error numbers (e.g. HTTP client errors: [400 ... 499]) and explicitly exclude some in the range.
There are two possible retreat strategies: none (ignore the error) or retry. In case of retrying, events will be enqueued . The default retreat strategy is none on all errors.

The events queue is a space containing events to be delivered.
Due to memory bounds, the size of the events queue must be fixed and therefore is not optional. This gives an upper bound on the amount of space.
Every event in the event queue can be resent up to a specified number of times.
If the number of messages in the retry exceeds the size, the maximum capacity policy specifies what messages to delete.
It is possible to specify an event TTL to further lower the space requirement of the queue.

Syntax
Policy:
{
    "name" : <string>,
    "error_handlers" : [<handler>],
    "retry_times" : <int>,
    "maximum_capacity" : <int>
}

If error_handlers if empty, then events failing to reach destination are lost.
retry_times is optional, but required if an handler specifies the retry retreat strategy.
Each event in the queue will be resent up to retry_times, unless the maximum_capacity is exceeded. In that case, older events will be deleted from the queue until the number of enqueued events is below maximum_capacity.
Handler:
{
    "error_type" : [<int>] | '[' <int> '...' <int> ']' | "*",
    "excluding" : [<int>],
    "retreat_strategy" : "none" | "retry",
    "event_ttl" : <int>
}

The error type list or range must contain only valid HTTP errors. Every error not included in an handler range defaults to none repeat strategy. "*" is a shortcut for all errors.
excluding and event_ttl are optional.
Examples
The simplest policy:
{
    "name" : "simple_policy",
    "error_handlers" : [],
    "maximum_capacity" : 100
}

This policy ensures no guarantee of good delivery for any HTTP error. At most 100 events can be in the queue at any time.
A more complex policy:
{
    "name" : "complex_policy",
    "error_handlers" : [
            {
                "error_type" : "*",
                "excluding" : [402, 403, 404],
                "retreat_strategy" : "none"
            },
            {
                "error_type" : [402, 403, 404],
                "retreat_strategy" : "retry",
               "event_ttl" : 1000
            }
        ],
    "retry_times" : 5,
    "maximum_capacity" : 100
}

If there occurs an HTTP error outside the range [402, 403, 404], then Astarte will do nothing. At most 100 events can be in the queue at any time.
If an HTTP [402, 403, 404] error occurs, then Astarte will try to resend the event up to 5 times.
If more than 100 events are present in the queue, the oldest ones will be deleted (even if they were resent less than 5 times in the case of  HTTP [402, 403, 404] ).
Implementation details
The implementation will revise the current delivery of messages from Data Updater Plant to Trigger Engine.
At the moment, all HTTP data are published by Data Updater Plant to the astarte_events exchange in an unique trigger_engine queue. Trigger Engine then synchronously processes each message in order and acks the broker.
The implementation  will map each event queue to an AMQP queue on the astarte_events exchange. A good suggestion could be to allow the possibility of nacks to track failed delivery upon HTTP errors.
Event queue attributes can be mapped to RabbitMQ queues', with the exception of retry_times that will be implemented over RabbitMQ.

See also #117

Closed by https://github.com/astarte-platform/astarte/pull/583.

repo: astarte-platform/astarte


text:
PLE0237 false positive for slots literal concatenation

I have a class, whose slots are formed by concatenating other literal tuples via RUF005 style. Below B is reported to violate PLE0237, which is a false positive, I also tried a few variants of B:

C: If B is a subclass of any other class, PLE0237 seems to work fine
D: If B slots has no other literal items, PLE0237 seems to work fine
E: If B slots uses tuple concatenation, which violates RUF005, but PLE0237 seems to work fine

class A:
    pass

class B:
    names = ("x",)
    __slots__ = (*names, "a")

    def __init__(self) -> None:
        self.x = 1  # PLE0237: Attribute `x` is not defined in class's `__slots__`

class C(A):
    names = ("x",)
    __slots__ = (*names, "a")

    def __init__(self) -> None:
        self.x = 1

class D:
    names = ("x",)
    __slots__ = (*names,)

    def __init__(self) -> None:
        self.x = 1

class E:
    names = ("x",)
    __slots__ = names + ("a",)  # RUF005: Consider `(*names, "a")` instead of concatenation

    def __init__(self) -> None:
        self.x = 1

Thank you for opening this issue! I think we should ignore raising PLE0237 if __slots__ contain an unpacked argument.

authors: airallergy dhruvmanila

repo: astral-sh/ruff


text:
Fixing file with rules E302, I001 cause infinite loop

ruff 0.5.5+379 (a3e67abf4 2024-07-31)
ruff check *.py --select E302,I001 --no-cache --fix --unsafe-fixes --preview --output-format concise --isolated

file content(at the bottom should be attached raw, not formatted file - github removes some non-printable characters, so copying from here may not work):
import time
#替换环境

#测试环境，替换eb部分3台服务器及其代码
def web_replace():
    bg=time.time()

error
/tmp/tmp_folder/data/5053444380204826248.py:1:1: I001 Import block is un-sorted or un-formatted
Found 501 errors (500 fixed, 1 remaining).
[*] 1 fixable with the --fix option.

debug error: Failed to converge after 500 iterations in `/tmp/tmp_folder/data/5053444380204826248.py` with rule codes I001:---
import time

#替换环境

#测试环境，替换eb部分3台服务器及其代码
def web_replace():
    bg=time.time()
---

Ruff build, that was used to reproduce problem(compiled on Ubuntu 22.04 with relase mode + debug symbols + debug assertions + overflow checks) - https://github.com/qarmin/Automated-Fuzzer/releases/download/Nightly/ruff.7z
python_compressed.zip

Huh, that's funny. Thanks for reporting!

authors: MichaReiser qarmin


text:
Implement perflint

https://github.com/tonybaloney/perflint - Python Linter for performance anti patterns.

[x] PERF101: Unnecessary list() on already iterable type (unnecessary-list-cast)
[x] PERF102: Incorrect iterator method for dictionary (incorrect-dictionary-iterator)
[ ] PERF201: Loop invariant statement (loop-invariant-statement)
[ ] PERF202: Global name usage in a loop (loop-global-usage)
[ ] PERF203: Try..except blocks have a significant overhead. Avoid using them inside a loop (loop-try-except-usage)
[ ] PERF204: Looped slicing of bytes objects is inefficient. Use a memoryview() instead (memoryview-over-bytes)
[ ] PERF205:  Importing the "%s" name directly is more efficient in this loop. (dotted-import-in-loop)
[ ] PERF301: Use tuple instead of list for a non-mutated sequence. (use-tuple-over-list)
[ ] PERF401: Use a list comprehension instead of a for-loop (use-list-comprehension)
[ ] PERF402: Use a list copy instead of a for-loop (use-list-copy)
[ ] PERF403: Use a dictionary comprehension instead of a for-loop (use-dict-comprehension)

Also rules from https://github.com/tonybaloney/anti-patterns
like https://github.com/tonybaloney/anti-patterns/pull/4 and https://github.com/tonybaloney/anti-patterns/pull/5

If that's a separate plugin it's best to make a different issue for that. As for perflint, I will wait until the first PR is merged before looking at further rules.

I'll start implementing this. Off the top of my head, some of the rules may not be possible currently (W8101 : Unnecessary list() on already iterable type (unnecessary-list-cast) is one that seems tough right now - I'd have to check the AST docs to ensure they have an iterable type, but we don't have type checking currently).

Rules checklist:

[ ] PERF101: Unnecessary list() on already iterable type (unnecessary-list-cast)
[x] PERF102: Incorrect iterator method for dictionary (incorrect-dictionary-iterator)
[ ] PERF201: Loop invariant statement (loop-invariant-statement)
[ ] PERF202: Global name usage in a loop (loop-global-usage)
[ ] PERF203: Try..except blocks have a significant overhead. Avoid using them inside a loop (loop-try-except-usage)
[ ] PERF204: Looped slicing of bytes objects is inefficient. Use a memoryview() instead (memoryview-over-bytes)
[ ] PERF205:  Importing the "%s" name directly is more efficient in this loop. (dotted-import-in-loop)
[ ] PERF301: Use tuple instead of list for a non-mutated sequence. (use-tuple-over-list)
[ ] PERF401: Use a list comprehension instead of a for-loop (use-list-comprehension)
[ ] PERF402: Use a list copy instead of a for-loop (use-list-copy)
[ ] PERF403: Use a dictionary comprehension instead of a for-loop (use-dict-comprehension)

Thanks @qdegraaf - I went ahead and added that to the issue body :)

@qdegraaf I can pick up some of these - are there any that you're particularly interested in? Don't want to overstep

Awesome! I've got an almost complete PERF101. Otherwise haven't picked up anything yet. I'll open a draft PR for PERF101 and otherwise take your pick! Feel free to ping me on the Discord if you want to collaborate or check availability.

I can grab PERF203 and PERF204 to start. I have an idea about how to implement them (and some of the other for-loop based rules)

I'll start looking at 401 and 402

@qdegraaf You can grab 3X as well! I'll do 2X, if that works for you?

If that's a separate plugin it's best to make a different issue for that.

Rules from perflint are derived from tonybaloney/anti-patterns.
These rules ( https://github.com/tonybaloney/anti-patterns/pull/4 and https://github.com/tonybaloney/anti-patterns/pull/5) are not yet implemented in perflint (https://github.com/tonybaloney/perflint/issues/31)
So these 2 rules (join with generator and regex with IGNORECASE) should be part of perflint or RUF rules?

If that's a separate plugin it's best to make a different issue for that.

Rules from perflint are derived from tonybaloney/anti-patterns. These rules ( tonybaloney/anti-patterns#4 and tonybaloney/anti-patterns#5) are not yet implemented in perflint (tonybaloney/perflint#31)
So these 2 rules (join with generator and regex with IGNORECASE) should be part of perflint or RUF rules?

@charliermarsh what's the protocol for this. I think it makes functional sense to add it to perflint but not sure if Ruff is ok with expanding upon upstream implementations for direct ports.

@qdegraaf You can grab 3X as well! I'll do 2X, if that works for you?

Cool, works for me! If I get round to them at some point in the near future I'll make sure to announce it here. Feel free to change your mind in the meantime if you find time before me.

PERF203 should only trigger when there’s no loop flow control in the try-catch statement. E.g. I don’t think there’s a better way to write the following:
for repo in ['R-patched', 'cran', 'bioc']:
    try:
        pkg_cache = self._fetch_cache(repo, pkg)
        break
    except HTTPError:
        pass
else:
    return None

authors: charliermarsh evanrittenhouse flying-sheep q0w qdegraaf


text:
Question about SIM114, adding comment causes issue not to be detected

This testcase does not trigger SIM114:
x = "x"
y = "y"

if x == "x":
    pass
elif x == "y":
    # Comment
    pass
elif y == "y":
    pass

However, removing the comment causes ruff to detect SIM114 as expected:
x = "x"
y = "y"

if x == "x":
    pass
elif x == "y":
    pass
elif y == "y":
    pass

test.py:4:1: SIM114 Combine `if` branches using logical `or` operator
test.py:6:1: SIM114 Combine `if` branches using logical `or` operator

May I know if this is expected?
$ ruff --version
ruff 0.0.285

This is intentional. If the branches have their own comments, it's typically seen as a sign that it's intentional and should not be flagged.

Got it, thanks!


text:
pip install of uv can fail for Python < 3.10 with certain Debian Python distributions

I love the project and am grateful for all the work!
I noticed an issue that arose due to a confluence of bad user behaviors. For Python < 3.10 (bad) when using the Debian-based distribution of Python (bad) and not using a venv or pipx (bad), the pip installation of uv can install uv to a scripts location that find_uv_bin() then fails to find.
root:/# python3.9 -m pip install uv
Collecting uv
  Using cached uv-0.5.10-py3-none-manylinux_2_28_aarch64.whl.metadata (11 kB)
Using cached uv-0.5.10-py3-none-manylinux_2_28_aarch64.whl (13.9 MB)
Installing collected packages: uv
Successfully installed uv-0.5.10
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

root:/# python3.9 -m uv
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/dist-packages/uv/__main__.py", line 47, in <module>
    _run()
  File "/usr/local/lib/python3.9/dist-packages/uv/__main__.py", line 27, in _run
    uv = os.fsdecode(find_uv_bin())
  File "/usr/local/lib/python3.9/dist-packages/uv/_find_uv.py", line 36, in find_uv_bin
    raise FileNotFoundError(path)
FileNotFoundError: /root/.local/bin/uv

I believe what's happening here is actually a known irritation with the Debian distribution of Python: it is patched s.t. scripts are installed to /usr/local (https://wiki.debian.org/Python#Deviations_from_upstream), but there is not the appropriate corresponding adjustment in sysconfig, which still points to /usr/bin for the scripts location. So, in this case, we have:
root:/# python3.9
Python 3.9.5 (default, Nov 23 2021, 15:27:38)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_path("scripts")
'/usr/bin'

vs.
root:/# whereis uv
uv: /usr/local/bin/uv

find_uv_bin() starts by checking os.path.join(sysconfig.get_path("scripts"), uv_exe)
There is a cri de cœur on this topic (along with some unsatisfying solutions) here: https://ffy00.github.io/blog/02-python-debian-and-the-install-locations/
Not sure if this is something you want to address or not, but considering the size of the project I thought someone else might run into it. I switched to the standalone installer in this Docker image and that works well.

Details:
This is a Docker container
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal
6.10.11-linuxkit
Python 3.9.5
Python installed via apt-get install python3.9

Thank you!

Which container should I use to reproduce this?

Nevermind, I reproduced with debian:bullseye.

This honestly might not be fixable hah.

I guess we could sniff for debian and check import distutils.dist, etc.

I'm curious if you have python3.9-disutils installed in your example?

Thanks for the quick reply! I do have python3-distutils preinstalled but not python3.9-distutils
python3-distutils 3.8.10-0ubuntu1~20.04  all  distutils package for Python 3.x

Per this code, it appears this might affect Red Hat as well? And along the lines you suggest, it looks like pip uses distutils for scheme logic for versions <= 3.9. But it looks kind of nasty.
The more I look at this, there more I'm starting to think this is a whole can of worms to accommodate an upstream problem, and for Python versions that are almost all EOL. At the end of the day...users probably should be using pipx or a virtual environment, and in a container, the docs already point to a lot of good ways to install uv that don't run into this. So I could definitely see the argument to defer on this and see if anyone else runs into it.

repo: astral-sh/uv


text:
Relaxed git dependencies

We have a project structure where we have a core library, and then a number of projects which depend on this core library, and install it as a git dependency pinned either to main or a feature branch.
We currently use poetry (as we develop on mac and deploy to linux, and Pytorch to contend with...), but a pain point with this workflow is that any update to the branch will break the lock file as the commit SHA changes. As a default behaviour, this makes a lot of sense, but it means any time you update main, you either need to rerun dependency resolution or manually change the commit SHA in the lock file, both of which are a pain.
It would be nice to have an option to relax git dependencies in overrides.txt, effectively saying "I know that the commit SHA is wrong, but I expected this, so carry on as you were".

I am running into a similar issue and wondering why the commit hash is updated every time the lockfile is regenerated.
If the commit is still reachable from the branch tip, why isn't the lockfile's commit still considered a valid locked version?
Not unlike how a package~=1.0 can release v1.1 but my lockfile can still stay at 1.0 until I'm ready to upgrade.


text:
Support URL and path dependencies without a package name

Apparently this works with pip?
git+https://github.com/pallets/flask.git@refs/pull/5313/head

As opposed to:
flask @ git+https://github.com/pallets/flask.git@refs/pull/5313/head

We could decide not to support these. I don't know if they're spec-compliant.

It seems like this is also an issue for installing a local whl file?
% uv pip install ./streamlit-1.31.1-py2.py3-none-any.whl
error: Failed to parse `./streamlit-1.31.1-py2.py3-none-any.whl`
  Caused by: Expected package name starting with an alphanumeric character, found '.'
./streamlit-1.31.1-py2.py3-none-any.whl
^

% uv pip install "streamlit @ ./streamlit-1.31.1-py2.py3-none-any.whl"
Resolved 40 packages in 680ms
Downloaded 40 packages in 1.74s
Installed 40 packages in 97ms
...

BTW uv seems awesome!! Thank you!!!

Yup, all the same issue! Although we can probably support local wheels "trivially" since the file name is required to be encoded in the wheel.

This is probably the biggest blocker to experimenting with uv in Meltano since dependencies of the type git+https://... are very widely used by plugins.

👍 I want to support this, requires a bunch of internal refactors but definitely doable.

Hopefully not to add to the confusion - I've been running scenarios against integrating with pdm.
While investigating my own feature request, pdm-project/pdm#2641 I discovered pdm is handling requirements.txt-style exports in a way that falls back to pip's behavior...and works with uv if I remove the #egg= fragments.
Here's some quirks I was able to discover. Being able to do uv v --seed for running through was very helpful, I use the .venv/bin/pip for wherever pip install is used. I believe these quirks would be universal, anywhere there's a python package with a pyproject.toml.
I'm using the pdm-example-monorepo below in the latest Python Docker image under a freshly made user in their home directory.
When in a git directory:
pip will end up resolving an editable install (pip install -e 'file://'$PWD'relative/path') of a local path that's inside a git directory differently than one that is not.
When inside a git directory, pip will include an #egg= fragment along with another query param for its relative directory.
e.g.;
# replace .venv
$ uv v --seed
# install the package as editable with relative path
$ .venv/bin/pip install -e 'file://'$PWD'packages/pkg-second'

# ...

# show pip installation
$ .venv/bin/pip freeze | grep pkg-core

-e git+https://github.com/pdm-project/pdm-example-monorepo@b85261555ea063e68eaf744e225804149c27e64f#egg=pkg_core&subdirectory=packages/pkg-core

When it's not a git directory, and it's still an editable install:
# replace .venv
$ uv v --seed
# get rid of .git, so it's not detected as a git repository
$ mv .git .gitold
# install the package as editable with relative installation, again
$ .venv/bin/pip install -e 'file://'$PWD'/packages/pkg-core'

# ...

# show pip installation
$ .venv/bin/pip freeze | grep pkg-core

# Editable install with no version control (pkg-core==0.1.0+editable)
-e /home/python/pdm-example-monorepo/packages/pkg-core

There's also this way that will lend itself to the next example - pkg-name @ file:///..., which cannot be installed as editable, regardless of git directory or not:
# replace .venv
$ uv v --seed
# install relative package, non-editable, pkg @ file://... way
$ .venv/bin/pip install 'pkg-core @ file://'$PWD'/packages/pkg-core'

# ...

# freezes the same way whether in a git repository or not
$ venv/bin/pip freeze | grep pkg-core

pkg-core @ file:///home/python/pdm-example-monorepo/packages/pkg-core

And lastly - pip install 'file://... will result in the same package-name @ file://... expansion regardless if it's in a git directory or not 😅
# replace .venv
$ uv v --seed
# install non-editable, just 'file://...'
$ .venv/bin/pip install 'file://'$PWD'/packages/pkg-core'

# ...

# freezes the same way whether in git repository or not
$ .venv/bin/pip freeze | grep pkg-core
pkg-core @ file:///home/python/pdm-example-monorepo/packages/pkg-core

We have a similar use case; we want to install a package in a local directory without editable.
We have several Python packages in a mono repo. Sometimes we need to create a python venv, install those packages into the venv, then pack the venv and distribute it to CI or production environment.
So we want to be able to install a local package like this:
uv pip install ./path/to/package/dir

We don't want to use -e here because the venv will be redistributed.

@kkpattern - that is supported, but you need to include the package name, like “ uv pip install ‘foo @ ./path/to/package/dir’”. We’ll lift this restriction in term, I’m mostly focused on correctness issues right now.

@charliermarsh  Yes. We figured that out. We have already switched to uv on our main branch. Massive speed up. Thanks for this awesome tool. (And ruff too!)

I could able to install the package as mentioned above ways. but
uv pip sync requirements.txt is failing.  I am running uv pip freeze > requirements.txt  to generate the txt file.
```error: Couldn't parse requirement in requirements.txt at position 384
Caused by: Trailing (from https://<url>/<package>-0.7.1-py3-none-any.whl) is not allowed

@shekharidentv - do you mind opening a new issue for this? We may want to strip those URLs from freeze.

👍  for this feature. I'm liking UV so much that I'm using pip install path/to/my.whl (which is slow) and then uv pip install after.

@jkgenser note you can just provide a package name e.g. pip install foo@path/to/my.whl in the meantime.

@jkgenser note you can just provide a package name e.g. uv pip install "foo@path/to/my.whl" in the meantime.

Wow amazing thank you that worked! I was having trouble because I saw other examples in github issues that referred to package @ path/to/my.whl and it wasn't working me. However removing the spaces was what was needed.

How to install optional deps?
uv pip install xxx@./xxx[yy] dont work and says Distribution not found

How to install optional deps?
uv pip install xxx@./xxx[yy] dont work

I'd guess uv pip install package[extra]@location.

Loving uv so far!
Will supporting this also allow the very basic uv pip install . (non-editable) to work?

Publicly committing to this one.

I've a similar issue with a requirements.txt file that contains a package installed as:
-e git+https://github.com/xxx/package.git@commit_id#egg=package package
at the moment uv pip install fails because -e seems to work only for local files
error: Unsupported URL (expected a `file://` scheme) in requirements.txt
Will this syntax be supported? There is an alternative way to install a specific package in requirements in current folder from a github repo?
Thanks

You can do package @ git+https://github.com/xxx/package.git@commit_id, right?

Yes, but in that case it'll be installed under python path and not under current folder.. also with standard pip the behavior is different

We don't support editable installs for Git and URL dependencies. I'd suggest just cloning the repo and installing it as a file-based editable install (-e ./package).

Okay, this is now in review.

These have all merged. Will be supported in the next release.

Thank you so much for making this, makes a world of a difference !

authors: akx aliencaocao charliermarsh dadokkio edgarrmondragon franciscoafonsoo jeremander jkgenser kkpattern sfc-gh-jcarroll shekharidentv yyolk zanieb


text:
[BUG] Failed to install specific pytorch cuda version with uv pip

The command is as followed:
uv pip install --verbose torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121

Console debug log:
DEBUG uv 0.5.2 (195f4b634 2024-11-14)
DEBUG Searching for default Python interpreter in virtual environments
DEBUG Found `cpython-3.13.0-windows-x86_64-none` at `D:\xxx\.venv\Scripts\python.exe` (active virtual environment)
DEBUG Using Python 3.13.0 environment at .venv
DEBUG Acquired lock for `.venv`
DEBUG At least one requirement is not satisfied: torchaudio==2.3.0
DEBUG Using request timeout of 30s
DEBUG Solving with installed Python version: 3.13.0
DEBUG Solving with target Python version: >=3.13.0
DEBUG Adding direct dependency: torch>=2.3.0, <2.3.0+
DEBUG Adding direct dependency: torchvision>=0.18.0, <0.18.0+
DEBUG Adding direct dependency: torchaudio>=2.3.0, <2.3.0+
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torch/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torchvision/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torchaudio/
DEBUG Searching for a compatible version of torch (>=2.3.0, <2.3.0+)
DEBUG Searching for a compatible version of torch (>=2.3.0, <2.3.0+cu121 | >2.3.0+cu121, <2.3.0+)
DEBUG No compatible version found for: torch
  × No solution found when resolving dependencies:
  ╰─▶ Because only the following versions of torch are available:
          torch<2.3.0
          torch>=2.3.0+cu121
      and torch==2.3.0+cu121 has no wheels with a matching Python ABI tag, we can conclude that torch==2.3.0 cannot be used.
      And because you require torch==2.3.0, we can conclude that your requirements are unsatisfiable.
DEBUG Released lock at `.venv\.lock`

This looks right to me -- you're using Python 3.13, but there are no Python 3.13 builds for PyTorch at those versions. You may want to use --python 3.12 or similar.

authors: ISJDOG charliermarsh


text:
Make < exclusive for non-prerelease markers

Summary
Even when pre-releases are "allowed", per PEP 440, pydantic<2.0.0 should not include pre-releases. This PR modifies the specifier translation to treat pydantic<2.0.0 as pydantic<2.0.0.a0.
There are two blocking issues that I foresee here:

Error messages regress, because we now have .a0 suffixes in places that are unexpected for users.
Pre-release hints regress, because the trick we use to detect whether pre-releases are "available" are now triggered ~every time.

Closes https://github.com/astral-sh/uv/issues/1641.

I think (1) and (2) could be "solved" by only applying this logic when pre-releases are already enabled for a given package.

What if there is a PreRelease { kind: PreReleaseKind::PreReleaseHack, number: 0}`` (find a better name) that behaves as a perfect match to a0but is special cased in rendering. It would show up as2.0.0rather than2.0.0.a0` maybe with an additional indicator about how it considers prerelease versions.
          attrs>20.3.0,<21.2.0 (including pre) cannot be used.
          And because you require attrs>20.3.0,<21.2.0 (including pre), we can conclude that the

\cc @czaki who brought up the idea on GitHub.

Hm. Why is pre-release even triggered by upper constraint? All time when I would like to test pre-release of some package or see such case, the lower bound is used. But my experience may be not so big.
I wil ltry to check code later.

.dev0 comes before .a0 anyway

Within a numeric release (1.0, 2.7.3), the following suffixes are permitted and MUST be ordered as shown:
.devN, aN, bN, rcN, <no suffix>, .postN

And cannot by uploaded to pypi.

And cannot by uploaded to pypi.

alas the world is complicated: pypi is not the only source of distributions
either way, if the intention is to make <2 exclude pre-releases, might just as well exclude .dev releases too.
another way might be to represent this as something like <=1.infinity, which might work better as being something that you could easily recognise when writing it back: no-one could actually write that down, whereas if what you have is <2.0.0.dev0 you cannot be certain that this was not the original constraint all along

This makes sense, I'll likely change to dev.

Have you checked that this also applies to 2.0.0.a0.dev0?

I honestly don't mind representing this (even to users) as <2.0.0.dev. If they see this, then they opted-in to pre-release handling (it doesn't get included otherwise).

Okay, now using @mitsuhiko's suggested approach which I will begrudgingly admit is a better solution :)
Now handles all cases correctly, even:
apache-airflow[otel]
opentelemetry-exporter-prometheus<0.44

From the brilliant @notatallshaw (thank you for that).

authors: Czaki charliermarsh dimbleby konstin mitsuhiko


text:
fix(ci): Run all tests for every non-pr, remove glob check

Summary
Removed a glob check to try and omit running tests for simple markdown changes, and make all tests run when not a pull_request event.
Background
Tests failed, we bypassed tests which should run.
Changes

removed md glob ommission
run all tests on main.

Testing
Lots of iterations and commits to test what runs when on this PR.

The tests are not running on this pr? Is that expected?

The tests are not running on this pr? Is that expected?

Yes, that's why there are lots of commits where I pushed changes to other files to make sure they work. See, for example this run: where I confirmed things would run: https://github.com/astriaorg/astria/pull/450/checks?sha=ae26ab28c0d67381e6d45b31c4a3d79c3ea88dc7

authors: SuperFluffy joroshiba

repo: astriaorg/astria


text:
Remove FreeParameters and set compat

Reflecting upstream changes in SpectralFitting, models no longer need the parameteric FreeParameters argument.

We also need, as in the title, a compat entry in the Project.toml so that we don't end up with incompatible versions being loaded.


text:
Handel the Databricks Operator failures

Handled the failure case properly as per in sync version

In the Jobs API 2.1, we can't call get_run_output on the top-level Run ID because it's
not supported by API - we need to call this function on a specific sub-run of the job, even
if it consists of the single task

closes: #643

@rajaths010494 @pankajastro @pankajkoti @utkarsharma2 @sunank200, Please review this PR

repo: astronomer/astronomer-providers


text:
the relative distance between the object and host vehicle

I would like to know the detected objects' relative x position(meters)  and  y position(meters) related to the host vehicle.I wonder which message and information represent such two values.Thanks so much!

This depends on your configuration.
If you're using a single LUX sensor, the measurements are relative to the origin of the sensor (center of the front of the sensor). In this case, you can publish a static transform (using static_transform_publisher, for example) from the frame of the sensor to the frame of your vehicle (usually base_link). Then, if you apply that transform to the X and Y positions of the detected objects, you'll get the relative offset to the vehicle's origin.
If you're using a fusion system, you can connect to the Fusion box using Ibeo's software and set the location of each Lux relative to the vehicle's origin. The scans will then come out relative to the vehicle.

authors: JWhitleyAStuff melodynk


text:
update less.js to latest 1.2.1

The first example on lesscss.org failed with lesscss-engine master branch due to new method iscolor introduced in last lesscss release.
After replace /src/main/resources/META-INF/less.js with latest[1], the test failed with:
org.mozilla.javascript.EcmaError: ReferenceError: "window" is not defined.
Would be great if lesscss-engine could just work without modify the original less.js.
Thanks!
[1]https://raw.github.com/cloudhead/less.js/master/dist/less-1.2.1.js

Thanks Rostislav for the quick response!
If no possible to make it work without modify the original less.js, would be great have a way (e.g. do a commit with original version then modify to make it work in rhino) to show what's changed to original.
Enjoy the weekend!
-Guo

The first example on lesscss.org works.
Thanks!

repo: asual/lesscss-engine


text:
Running texar on CPU

Hi,
I'm unable to run text_style_transfer/prepare_data.py since I'm running this program on a AMD Radeon  8670M graphics card. Is it possible to make Texar use tensorflow-cpu ?
Thanks

prepare_data.py does not use GPU -- it just downloads data from google drive.
Texar is compatible with TF-CPU.

repo: asyml/texar


text:
Restrict the CLI to create only create file having yml and yaml extension.

Reason/Context
Please try answering a few of those questions

Why do we need this improvement?

Currently, the CLI is creating files of any type of extension like exe or any type of invalid extension it would be to restrict the CLI to create files of invalid extension. It will help in many cases, for example, formatting plugins cannot able to ident invalid files.

How will this change help?

It will increase the developer experience:

What is the motivation?

Description
Please try answering a few of those questions

Will this be a breaking change?

No. it will not break the existing feature

How could it be implemented/designed?

Using Certain checks

@AayushSaini101, Yeah actually this is a bug, You can open a PR for this if you want, I think it would be better to have a check for the --file-name flag  and allow only

yml
yaml
json

repo: asyncapi/cli


text:
Initial stab at traffic action

This is an initial version to solve: https://github.com/at-gmbh/at-python-template/issues/22. It doesn't save the traffic stats in a separate private repository but in the same repository on a branch called "traffic". I think this is fine, the traffic data doesn't contain sensitive information. It runs once per week on Sundays.
I haven't work with GH actions before and cannot imagine how to test this without merging :).

Thanks Simon! I would like to leave the final review of this to @klamann as I don’t have experience with GH actions.
Two questions:

Will there be one file per week in the current setup? How will they be called and which data will they contain? I don’t see any specification of the file name in the action specifications.
Is it possible to trigger this manually on the feature branch for testing?

Thanks Simon! I would like to leave the final review of this to @klamann as I don’t have experience with GH actions.
Two questions:

Will there be one file per week in the current setup? How will they be called and which data will they contain? I don’t see any specification of the file name in the action specifications.
Is it possible to trigger this manually on the feature branch for testing?

we should make a test run to see if this actually works. please add a temporary trigger on this PR like so
on:
  pull_request:
    branches: [ feature/save-traffic ]

we should make a test run to see if this actually works. please add a temporary trigger on this PR like so
on:
  pull_request:
    branches: [ feature/save-traffic ]

tada! :blush:

tada! :blush:

LGTM, thanks @klamann! 👍
@SimonCW, please merge this if you're happy with the result. :)

LGTM, thanks @klamann! 👍
@SimonCW, please merge this if you're happy with the result. :)

Hi @klamann,
thanks for jumping on this so quickly! The only thing still bothering me is the spacing between the subplots and the messed up year in the x-axis date. However, this is minor and needs to be fixed on the action's repo. I submitted a PR there.
Merging ...

Hi @klamann,
thanks for jumping on this so quickly! The only thing still bothering me is the spacing between the subplots and the messed up year in the x-axis date. However, this is minor and needs to be fixed on the action's repo. I submitted a PR there.
Merging ...

authors: SimonCW klamann sbunzel

repo: at-gmbh/at-python-template


text:
Add docker environment setup

[ ] install docker
[ ] add doc

After following this guide https://www.docker.com/toolbox I can only use docker in the docker quick terminal, while in other terminal, I cant run docker command...

and here is how to use it from own shell https://docs.docker.com/installation/mac/#from-your-shell

The right guide is

follow the guide to install the docker toolbox. It won't conflict with the virtual box you installed using brew cask in TODO:link
click the  Docker Quickstart Terminal in Application, wait for it to create the vm and then run docker run hello-world to make sure the quickstart terminal is working. Then close this terminal. (This would be mac's default terminal, not iterm, if you didn't configure TODO: how to replace default terminal with iterm
open iterm. run docker-machine ls, you should see the default machine created by the quickstart terminal. run docker-machine env default to show the environment config for the default vm.
run `eval "$(dockermachine env default)" to config current shell, now it is working
TODO: add this to your .zshrc or .zsh ? TODO: the guide

Still got a problem, after reboot the system, the default vm for docker is not running when start up, so need to run docker-machine start default to start the vm, then open a new tab, and docker command would be avaliable