Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
5a4e4cb
:arrow_up: bump dependencies for all projects
sebastianMindee Jan 22, 2026
b16466d
bumped libs, tests not working
sebastianMindee Jan 23, 2026
b74db84
fix tests
sebastianMindee Jan 23, 2026
6f16276
fix deps?
sebastianMindee Jan 23, 2026
5af617f
trim down un-needed dependencies
sebastianMindee Jan 26, 2026
da893e8
try removing additional csharp dependency (might break 472/48)
sebastianMindee Jan 26, 2026
b79a590
add 472 tests in integration suite just in case
sebastianMindee Jan 26, 2026
b9e40d3
restore csharp dep for 472/48
sebastianMindee Jan 26, 2026
1850325
fix broken paths for integration testing
sebastianMindee Jan 26, 2026
7aa5305
fix paths
sebastianMindee Jan 26, 2026
b8fede6
refix paths
sebastianMindee Jan 26, 2026
7fb97a6
fix wrong location for test folder
sebastianMindee Jan 26, 2026
1bbd158
fix net error in 472
sebastianMindee Jan 26, 2026
0bbf058
try with a pinned version?
sebastianMindee Jan 26, 2026
e48d8a9
fix syntax
sebastianMindee Jan 26, 2026
55ad526
try random suggestion...?
sebastianMindee Jan 26, 2026
7d9e5f1
try conditional restsharp just to see?
sebastianMindee Jan 26, 2026
8bb0ae2
bump broken restsharp
sebastianMindee Jan 26, 2026
fb17a48
fix missing dependency
sebastianMindee Jan 26, 2026
7848a69
try fix again...?
sebastianMindee Jan 26, 2026
8dbf7df
fix dependencies
sebastianMindee Jan 27, 2026
4092084
mess with dependencies again?
sebastianMindee Jan 27, 2026
47f5a5b
downgrade deps for 472?
sebastianMindee Jan 27, 2026
c34b6a8
try separate deps?
sebastianMindee Jan 27, 2026
825efe0
try targetted downgrades?
sebastianMindee Jan 27, 2026
71c2ddd
fix broken path?
sebastianMindee Jan 27, 2026
01f27a5
idk
sebastianMindee Jan 27, 2026
572abf0
try yet again?
sebastianMindee Jan 27, 2026
4b3c00a
try to import from main
sebastianMindee Jan 29, 2026
70cb289
fix duplicate import
sebastianMindee Jan 29, 2026
c6d575a
restart from earlier
sebastianMindee Feb 3, 2026
1087c37
fix version
sebastianMindee Feb 3, 2026
80f6e40
restore follow redirects?
sebastianMindee Feb 3, 2026
d17e3fe
fix?
sebastianMindee Feb 4, 2026
1f0e469
test dubious fix
sebastianMindee Feb 4, 2026
f1eab0e
fix slop
sebastianMindee Feb 5, 2026
1ad58de
downgrade - 1
sebastianMindee Feb 6, 2026
94ae9ad
re-mutualize dependencies
sebastianMindee Feb 6, 2026
adf7416
downgrade - 2
sebastianMindee Feb 6, 2026
eaf1304
huh?
sebastianMindee Feb 6, 2026
bf3e25d
downgrade - 4
sebastianMindee Feb 6, 2026
1c11f69
downgrade xunit?
sebastianMindee Feb 6, 2026
0c2d29d
re-upgrade some stuff
sebastianMindee Feb 6, 2026
a11b043
re-align dependencyinjection version
sebastianMindee Feb 6, 2026
36a37f4
remove unneeded dep
sebastianMindee Feb 6, 2026
03932d0
fix deps, again...
sebastianMindee Feb 11, 2026
69cd39e
fix dependency injection version
sebastianMindee Feb 11, 2026
633a69f
restore to EXACT pre-PR-deps
sebastianMindee Feb 11, 2026
f54529d
restore minimal deps
sebastianMindee Feb 11, 2026
7df487f
try downgrade restsharp?
sebastianMindee Feb 11, 2026
305aa37
move stuff
sebastianMindee Feb 11, 2026
644f600
fix unit tests deps too?
sebastianMindee Feb 11, 2026
09a4698
bump system.text.json
sebastianMindee Feb 11, 2026
6828e00
what
sebastianMindee Feb 11, 2026
81ecc29
shenanigans
sebastianMindee Feb 11, 2026
e0c86c7
idk what I'm doing at this point
sebastianMindee Feb 11, 2026
da01bdd
idk
sebastianMindee Feb 11, 2026
47f9bca
switch ordering + prioritize integration
sebastianMindee Feb 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/_test-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
os:
- "windows-2022"
dotnet-version:
- "net482"
- "net472"
- "net48"
- "net6.0"
- "net10.0"
runs-on: ${{ matrix.os }}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ jobs:
actions: read
security-events: write
contents: read
test-units:
uses: ./.github/workflows/_test-units.yml
needs:
- static-analysis
- codeql
# test-units:
# uses: ./.github/workflows/_test-units.yml
# needs:
# - static-analysis
# - codeql
# - qodana-code-quality
secrets: inherit
test-integrations:
uses: ./.github/workflows/_test-integrations.yml
needs: test-units
secrets: inherit
test-code-samples:
uses: ./.github/workflows/_test-code-samples.yml
Expand Down
40 changes: 40 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,44 @@
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>

<!-- Common packages for all frameworks -->
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="3.119.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.1" />
<PackageReference Include="Docnet.Core" Version="2.6.0" />
</ItemGroup>


<!-- .NET 6+ packages -->
<ItemGroup Condition="'$(TargetFramework)' != 'net472' And '$(TargetFramework)' != 'net48'">
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.2"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.2"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.2"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
<PackageReference Include="RestSharp" Version="113.1.0" />
</ItemGroup>

<!-- .NET Framework specific packages -->
<ItemGroup Condition="('$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48') And '$(MSBuildProjectName)' == 'Mindee'">
<PackageReference Include="System.Text.Json" Version="8.0.5"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4"/>
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0"/>
<PackageReference Include="RestSharp" Version="112.0.0"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48'">
<PackageReference Include="Microsoft.CSharp" Version="4.7.0"/>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<Reference Include="System.Net.Http"/>
</ItemGroup>
</Project>
117 changes: 73 additions & 44 deletions src/Mindee.Cli/Commands/PredictCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using System.Text.Json;
using Mindee.Input;
using Mindee.Parsing;
Expand Down Expand Up @@ -31,103 +29,134 @@ class PredictCommand<TInferenceModel, TDoc, TPage> : Command
where TPage : IPrediction, new()
where TInferenceModel : Inference<TDoc, TPage>, new()
{
private readonly Option<OutputType> _outputOption;
private readonly Option<bool>? _allWordsOption;
private readonly Option<bool>? _fullTextOption;
private readonly Option<bool>? _asyncOption;
private readonly Argument<string> _pathArgument;

public PredictCommand(CommandOptions options)
: base(options.Name, options.Description)
{
AddOption(new Option<OutputType>(["-o", "--output", "output"],
"Specify how to output the data. \n" +
"- summary: a basic summary (default)\n" +
"- raw: full JSON object\n"));
_outputOption = new Option<OutputType>("--output", "-o")
{
Description = "Specify how to output the data. \n" +
"- summary: a basic summary (default)\n" +
"- raw: full JSON object\n",
DefaultValueFactory = _ => OutputType.Summary
};
Options.Add(_outputOption);

if (options.AllWords)
{
var option = new Option<bool>(["-w", "--all-words", "allWords"],
"To get all the words in the current document. False by default.");
AddOption(option);
_allWordsOption = new Option<bool>("--all-words", "-w")
{
Description = "To get all the words in the current document. False by default.",
DefaultValueFactory = _ => false
};
Options.Add(_allWordsOption);
}

if (options.FullText)
{
var option = new Option<bool>(["-f", "--full-text", "fullText"],
"To get all the words in the current document. False by default.");
AddOption(option);
_fullTextOption = new Option<bool>("--full-text", "-f")
{
Description = "To get all the words in the current document. False by default.",
DefaultValueFactory = _ => false
};
Options.Add(_fullTextOption);
}

switch (options.Async)
{
case true when !options.Sync:
{
// Inject an "option" not changeable by the user.
// This will set the `Handler.Async` property to always be `true`.
var option = new Option<bool>("async", () => true) { IsHidden = true };
AddOption(option);
_asyncOption = new Option<bool>("async")
{
Hidden = true,
DefaultValueFactory = _ => true
};
Options.Add(_asyncOption);
break;
}
case true when options.Sync:
AddOption(new Option<bool>(["--async"],
"Process the file asynchronously. False by default."));
_asyncOption = new Option<bool>("--async")
{
Description = "Process the file asynchronously. False by default.",
DefaultValueFactory = _ => false
};
Options.Add(_asyncOption);
break;
}

AddArgument(new Argument<string>("path", "The path of the file to parse"));
_pathArgument = new Argument<string>("path") { Description = "The path of the file to parse" };
Arguments.Add(_pathArgument);
}

public new class Handler(MindeeClient mindeeClient) : ICommandHandler
public void ConfigureAction(MindeeClient mindeeClient)
{
private readonly JsonSerializerOptions _jsonSerializerOptions = new() { WriteIndented = true };

public string Path { get; set; } = null!;
public bool AllWords { get; set; } = false;
public bool FullText { get; set; } = false;
public OutputType Output { get; set; } = OutputType.Full;
public bool Async { get; set; } = false;
this.SetAction(parseResult =>
{
var path = parseResult.GetValue(_pathArgument)!;
var allWords = _allWordsOption != null && parseResult.GetValue(_allWordsOption);
var fullText = _fullTextOption != null && parseResult.GetValue(_fullTextOption);
var output = parseResult.GetValue(_outputOption);
var isAsync = _asyncOption != null && parseResult.GetValue(_asyncOption);

var handler = new Handler(mindeeClient);
return handler.InvokeAsync(path, allWords, fullText, output, isAsync).GetAwaiter().GetResult();
});
}

public int Invoke(InvocationContext context)
public class Handler(MindeeClient mindeeClient)
{
private readonly JsonSerializerOptions _jsonSerializerOptions = new()
{
return InvokeAsync(context).GetAwaiter().GetResult();
}
WriteIndented = true,
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};

public async Task<int> InvokeAsync(InvocationContext context)
public async Task<int> InvokeAsync(string path, bool allWords, bool fullText, OutputType output, bool isAsync)
{
var options =
new ParseOptions(Path, AllWords, FullText, Output);
if (Async)
var options = new ParseOptions(path, allWords, fullText, output);
if (isAsync)
{
return await EnqueueAndParseAsync(context, options);
return await EnqueueAndParseAsync(options);
}

return await ParseAsync(context, options);
return await ParseAsync(options);
}

private async Task<int> ParseAsync(InvocationContext context, ParseOptions options)
private async Task<int> ParseAsync(ParseOptions options)
{
var response = await mindeeClient.ParseAsync<TInferenceModel>(
new LocalInputSource(options.Path),
new PredictOptions(AllWords, FullText));
new PredictOptions(options.AllWords, options.FullText));

if (response == null)
{
context.Console.Out.Write("null");
await Console.Out.WriteAsync("null");
return 1;
}

PrintToConsole(context.Console.Out, options, response);
PrintToConsole(Console.Out, options, response);
return 0;
}

private async Task<int> EnqueueAndParseAsync(InvocationContext context, ParseOptions options)
private async Task<int> EnqueueAndParseAsync(ParseOptions options)
{
var response = await mindeeClient.EnqueueAndParseAsync<TInferenceModel>(
new LocalInputSource(options.Path),
new PredictOptions(AllWords, FullText),
new PredictOptions(options.AllWords, options.FullText),
null,
new AsyncPollingOptions());

PrintToConsole(context.Console.Out, options, response);
PrintToConsole(Console.Out, options, response);
return 0;
}

private void PrintToConsole(
IStandardStreamWriter console,
TextWriter console,
ParseOptions options,
PredictResponse<TInferenceModel> response)
{
Expand Down
19 changes: 5 additions & 14 deletions src/Mindee.Cli/Mindee.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Mindee\Mindee.csproj"/>
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand All @@ -28,21 +32,8 @@
</Choose>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.6"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.6"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.6"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.6"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.6"/>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1"/>
<PackageReference Include="System.CommandLine" Version="2.0.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Mindee\Mindee.csproj"/>
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))"/>

<ItemGroup>
Expand Down
Loading
Loading