Subscribe to this thread
Home - General / All posts - version of IronPython
julmou29 post(s)
#10-Oct-23 04:19

Hi,

In the Release 9 Base Plus of Manifold:

https://manifold.net/updates/download_9.shtml#:~:text=RELEASE%209%20BASE%20PLUS%20%C2%B7%20PORTABLE%20(SELF%2DCONTAINED%20ZIP%20FILE)

The DLLs for IronPython that we get are those of IronPython 2.7.9

Is there a reason for this? Is this the latest version compatible with Manifold 9?

On ironpython.net, they seem to be at version 3.4.1 now, which uses Python 3.4.

Python 2 is bit outdated.

Dimitri


7,464 post(s)
#10-Oct-23 06:27

I don't think it's anything more than the default package prioritizing backwards compatibility and reliability. IronPython 3 had a fairly long gestation period before it was ready for prime time. Anybody who wants to use IronPython 3 can do that by downloading it.

Going forward, Manifold is more interested in CPython than IronPython. There's a lot of work going on with CPython, so I'd expect that to be the priority.

tjhb
10,098 post(s)
#11-Oct-23 06:56

I would hesitate to try using IronPython 3.x with Manifold 8 or 9.

IronPython 3 is a fundamentally different language from IronPython 2, just as Python 3 is from Python 2, only more so because of the hard dependency on .NET Core.

AFAIK Manifold has not tested any flavour of Python 3 or IronPython 3, or .NET Core (currently incompatible, again AFAIK), so I would expect things to break all over the place.

On the other hand, IronPython 2.7.12 “should” be just as safe as 2.7.9. I have used .10 and .11, though not extensively.

I suggest reading the release notes for those successive IronPython releases (2.7.x) and look for (a) compelling reasons to upgrade from 2.7.9 and (b) breaking changes. AFAIK sets (a) and (b) are both empty or near enough to empty for my usage.

(Having CPython available at some stage will be a whole nother story. Many more fundamentsl libraries, much wider integration. Thanks Dimitri.)

tjhb
10,098 post(s)
#11-Oct-23 08:42

I just checked and I was wrong.

IronPython 3.x has maintained support for .NET Framework (targeting version 4.6.2). So there “should” be no mismatch with Manifold .NET assumptions (though who knows).

Though what versions of C# and IL does ipy 3 translate/precompile to, and what compiler stack does it assume?

The whole idea behind .NET was to enable “one ring” to mix and match not only versions but languages.

Yet that was before the .NET Framework -> .NET Core -> .NET [tout court] evolution, and before Roslyn.

So to be more honest than before, the reason why I would hesitate to try IronPython 3 with Manifold 8 or 9, is that I don’t understand the likely new .NET dependencies.

The language differences between Python 2.x and 3.x I would expect to lie mainly between IronPython and .NET, not between .NET and Manifold.

But there probably are some cases where wholly different .NET objects and classes have been used to implement changed Python types. What would Manifold do then? Just roll with it? I expect so, but.

rk
635 post(s)
#12-Oct-23 12:53

I believe we can use IronPython 3.4.1 with Manifold 9 just fine. Yes, we have to use the variant targeting .NET Framework 4.6.2.

I attach my notes:

#python

### In Powershell

# goto somewhere you can download files

cd C:\Downloads

# download zip

Invoke-WebRequest -Uri https://github.com/IronLanguages/ironpython3/releases/download/v3.4.1/IronPython.3.4.1.zip -OutFile IronPython.3.4.1.zip

# unzip

Expand-Archive -Path IronPython.3.4.1.zip -DestinationPath IronPython-unzipped

# install IronPython binaries for .NET Framework 4.6.2 (4.6.2 is the lower bound, good for 4.8.x)

./IronPython-unzipped/Scripts/Install-IronPython.ps1 -Path c:\Apps\ipy341net4 -ZipFile .\IronPython.3.4.1.zip -Framework net462

# enter IronPython environment

C:\Apps\ipy341net4\Enter-IronPythonEnvironment.ps1

# install pip

ipy -m ensurepip

# (don't) upgrade pip

# ipy -m pip install --upgrade pip

# run ipy repl

ipy.exe

### In Ipy repl

# determine important paths 

>>> import sys

>>> sys.path

# ['.', 'C:\\Apps\\ipy341net4\\lib', 'C:\\Apps\\ipy341net4\\DLLs','C:\\Apps\\ipy341net4', 'C:\\Apps\\ipy341net4\\lib\\site-packages']

# install your favourite package (e.g. pathlib)

ipy -m pip install pathlib

### Manually 

# copy these files to <manifold>/extras/ironpython

# DLLs\IronPython.SQLite.dll

# DLLs\IronPython.Wpf.dll

# IronPython.dll

# IronPython.Modules.dll

# Microsoft.Dynamic.dll

# Microsoft.Scripting.dll

# System.Buffers.dll

# System.Memory.dll

# System.Numerics.Vectors.dll

# System.Runtime.CompilerServices.Unsafe.dll

### In Manifold

# View -> New Command Window -> IronPython

# check paths

import sys

sys.path

# add paths

sys.path.extend(['C:\\Apps\\ipy341net4\\lib', 'C:\\Apps\\ipy341net4\\lib\\site-packages'])

# try things and explore

from pathlib import WindowsPath

import html

import sysconfig

sysconfig.get_config_vars()

Attachments:
README-Manifold-IronPython.txt

oeaulong

531 post(s)
#12-Oct-23 14:26

very nice walkthru. notes --> pseudo-code --> comments + goods. it's a practice I've let get dusty.

Dimitri


7,464 post(s)
#13-Oct-23 11:41

Super! Thanks for posting. Some notes for anyone new to IronPython...

1. The powershell commands / installation scripts might require some tinkering depending on your Windows system setup. For example, by default running scripts in powershell is not allowed in Windows 11 (10, too, I think). You can check how that is in your system by running in powershell:

Get -ExecutionPolicy

If that reports "Restricted," the default, you'll probably have to change that to allow scripts to be executed. You can do that with

Set -ExecutionPolicy Bypass

Don't forget to change it back to restricted after installation, with

Set -ExecutionPolicy Restricted

2. The Install-IronPython.ps1 script called in one of the command lines may fail with a "positional parameter cannot be found... " error. In that case, you can examine what the script does and manually put files, etc. in place. I think the problem is here:

# Copy files into place

Copy-Item -Path (Join-Path $unzipDir $Framework "*") -Destination $Path -Recurse

I just moved the files manually into the target folder.

3. Could be wrong, but I think pathlib is now part of the standard libraries for IronPython 3.4 and later, so no need to pip install pathlib?

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.