Skip to content

Initial creation of the IronPython SDK #1928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Lamparter
Copy link
Contributor

This is an initial start at creating IronPython.Sdk, which allows you to enjoy the beautiful SDK-style project feature that modern .NET uses.

This SDK is also compatible with non-IronPython projects.

@Lamparter
Copy link
Contributor Author

Lamparter commented Mar 15, 2025

For example

image

An IronPython project should probably look like:

<Project Sdk="IronPython.Sdk" ToolsVersion="4.0">
  <PropertyGroup>
    <!-- Below is the default, but you can also specify "CPython" -->
    <PythonInterpreter>IronPython</PythonInterpreter>
    <PythonVersion>3.4</PythonVersion>
  </PropertyGroup>
</Project>

@Lamparter
Copy link
Contributor Author

Tell me this isn't awesome 😁
image

@BCSharp
Copy link
Member

BCSharp commented Mar 17, 2025

Is it intended to work on macOS/Linux too? If it supports the debugger in VSCode it will be awesome! I have noticed many people were struggling with IronPython debugging.

On a more practical side, how about placing the SDK in src/tooling/IronPython.Sdk (i.e. rename sdk to tooling). In this way the directory can logically contain other, non-SDK tooling. For example, I am working (well, was working) on IPython/Jupyter support. So far it works without significant workarounds, but the version for Python 3.4 is no longer supported, so it is conceivable that some dedicated fork for IronPython will be needed. Another project idea is scaffolding for pylint or another linter) that understands CLR and .NET namespaces.

@Lamparter
Copy link
Contributor Author

I know some Visual Studio engineers as well and I've been wondering about creating a Visual Studio/VS Code extension for using IronPython easily.

In VS Code the experience should be the same as with Python, and interacting with IronPython projects should be kept minimal - perhaps via a CLI to make it easiest

@Lamparter
Copy link
Contributor Author

And yes, SDK style projects are supported by the dotnet.exe command, meaning that they can build on macOS/Linux in theory.

@Lamparter
Copy link
Contributor Author

Another project idea is scaffolding for pylint or another linter) that understands CLR and .NET namespaces.

Unless I remember wrong, PTVS included this as well.

@slozier
Copy link
Contributor

slozier commented Mar 17, 2025

Neat. I guess this is meant to be a replacement for the PTVS pyproj? The pyproj support in Visual Studio isn't too bad (though it's using the old ugly non-SDK style projects). Although no debugging for IronPython. 🤷

For my personal use case being able to easily pick interpreters/environments is important. PTVS does something like this to define interpreters:

  <ItemGroup>
    <InterpreterReference Include="Global|IronPython|3.4" />
    <InterpreterReference Include="Global|PythonCore|3.9" />
  </ItemGroup>
  <ItemGroup>
    <Interpreter Include="env\">
      <Id>env</Id>
      <Version>3.4</Version>
      <Description>env (IronPython 3.4 (64-bit))</Description>
      <InterpreterPath>Scripts\ipy.exe</InterpreterPath>
      <WindowsInterpreterPath>Scripts\ipy.exe</WindowsInterpreterPath>
      <PathEnvironmentVariable>IRONPYTHONPATH</PathEnvironmentVariable>
      <Architecture>X64</Architecture>
    </Interpreter>
  </ItemGroup>

Not saying it's the best thing to do... I like auto-detect that VSCode does to detect interpreters (although it doesn't handle IronPython very well).

@Lamparter
Copy link
Contributor Author

The project extension will still be pyproj (I think this will work, there's no actual way of knowing until the SDK gets published)

<Import Project="FileIncludes.props" />
<PropertyGroup>
<!-- Default -->
<InterpreterId>Global|$(PythonInterpreter)|$(PythonVersion)</InterpreterId>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works

@Lamparter
Copy link
Contributor Author

This will be ready soon, no idea why the CI is suddenly failing.
I want to split this into multiple PRs.
I'm also interested in adding support for the built-in Visual Studio "Build" and "Rebuild" commands using ipyc.

@Lamparter
Copy link
Contributor Author

I also want to add proper support for PackageReference.

@GeorgeS2019
Copy link

Question: will there a plan to continue ironclad3?

@BCSharp
Copy link
Member

BCSharp commented Mar 30, 2025

Update your main to the new main tip from the IronPython repo, then rebase your branch (starting from commit a5b0c4f) onto the new main tip. The rebase should proceed without conflicts.

@Lamparter
Copy link
Contributor Author

Yep, just strange that it happened.

@BCSharp
Copy link
Member

BCSharp commented Mar 30, 2025

It's because I force-pushed the main branch, apologies. You will need to force-push your rebased branch too.

@Lamparter Lamparter marked this pull request as ready for review April 1, 2025 17:51
@Lamparter
Copy link
Contributor Author

@slozier this PR is ready for review

@Lamparter
Copy link
Contributor Author

@slozier?

@@ -70,7 +70,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuget", "nuget", "{EE77D917
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronPython.Console32", "src\executables\IronPython.Console32\IronPython.Console32.csproj", "{AD21022F-E7C1-4B74-97C1-0A0E48EFF992}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronPython.Analyzer", "src\roslyn\IronPython.Analyzer\IronPython.Analyzer.csproj", "{DA3415F3-6922-42D0-93D7-BEE2E8603A18}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IronPython.Analyzer", "src\tooling\IronPython.Analyzer\IronPython.Analyzer.csproj", "{DA3415F3-6922-42D0-93D7-BEE2E8603A18}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're changing the path you also need to update the csproj that are referencing it.

@slozier
Copy link
Contributor

slozier commented Apr 10, 2025

@slozier?

Sorry, I just need to find more than 5 minutes to sit down and properly try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants