[Python]: Drop PyPy

GitOrigin-RevId: 41608a5a23f6aa5503fdeb8b37b637c7cb96896c
This commit is contained in:
Ilya.Kazakevich
2024-11-27 16:10:15 +00:00
committed by intellij-monorepo-bot
parent b199e0d6e6
commit 1ef66e99af
13 changed files with 4 additions and 226 deletions
@@ -135,9 +135,6 @@ class PythonUpdater {
}
}
// get PyPy from the current list, we have no update logic for it
releases.addAll(SdksKeeper.sdks.python.filter { it.product == Product.PyPy })
return releases
}
@@ -42,7 +42,6 @@ public final class PythonIcons {
/** 16x16 */ public static final @NotNull Icon Pandas = load("icons/com/jetbrains/pythonCore/python/pandas.svg", -1188443833, 2);
/** 16x16 */ public static final @NotNull Icon Polars = load("icons/com/jetbrains/pythonCore/python/polars.svg", 1700660876, 2);
/** 16x16 */ public static final @NotNull Icon Pycharm = load("icons/com/jetbrains/pythonCore/python/pycharm.svg", 2014186643, 0);
/** 16x16 */ public static final @NotNull Icon Pypy = load("icons/com/jetbrains/pythonCore/python/pypy.svg", 186053200, 0);
/** 16x16 */ public static final @NotNull Icon PythonClosed = load("icons/com/jetbrains/pythonCore/python/expui/pythonClosed.svg", "icons/com/jetbrains/pythonCore/python/pythonClosed.svg", -663368800, 0);
/** 16x16 */ public static final @NotNull Icon PythonConsole = load("icons/com/jetbrains/pythonCore/python/expui/pythonConsole.svg", "icons/com/jetbrains/pythonCore/python/pythonConsole.svg", 2125468440, 0);
/** 13x13 */ public static final @NotNull Icon PythonConsoleToolWindow = load("icons/com/jetbrains/pythonCore/python/expui/pythonConsoleToolWindow.svg", "icons/com/jetbrains/pythonCore/python/pythonConsoleToolWindow.svg", 1833337589, 2);
@@ -836,7 +836,6 @@ The Python plug-in provides smart editing for Python scripts. The feature set of
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.conda.CondaEnvSdkFlavor"/>
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.JythonSdkFlavor"/>
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.MacPythonSdkFlavor"/>
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.PyPySdkFlavor"/>
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.UnixPythonSdkFlavor"/>
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.VirtualEnvSdkFlavor"/>
<pythonSdkFlavor implementation="com.jetbrains.python.sdk.flavors.WinPythonSdkFlavor"/>
@@ -1,18 +0,0 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<defs>
<linearGradient id="pypy-a" x1="10.428%" x2="89.522%" y1="45.224%" y2="44.164%">
<stop offset="0%" stop-color="#5B9FD3"/>
<stop offset="48.719%" stop-color="#A0D64D"/>
<stop offset="100%" stop-color="#FEE873"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<path fill="url(#pypy-a)" fill-rule="nonzero" stroke="#000101" stroke-width=".4" d="M5.72304548,12.8951269 L5.79555755,12.9325003 C6.32060134,13.3581977 7.01261514,13.6 7.75,13.6 C8.39005488,13.6 8.99697035,13.4180734 9.56662938,13.0584509 C12.6184189,12.4967338 14.8,10.3616551 14.8,7.9 C14.8,4.98490042 11.7646722,2.6 8,2.6 C4.23532781,2.6 1.2,4.98490042 1.2,7.9 C1.2,10.152313 3.02780483,12.1476977 5.72304548,12.8951269 Z M5.16550586,9.81102497 C4.06620386,9.29062985 3.4,8.48888958 3.4,7.6 C3.4,6.02552796 5.47397039,4.8 8,4.8 C10.5260296,4.8 12.6,6.02552796 12.6,7.6 C12.6,8.59515384 11.7650158,9.47708414 10.4399118,9.97836694 L10.2933209,10.0338218 L10.2044275,9.90474008 C9.69532706,9.1654773 8.77093151,8.7 7.75,8.7 C6.80243086,8.7 5.9355772,9.10060709 5.40671211,9.75586873 L5.3078206,9.8783949 L5.16550586,9.81102497 Z"/>
<path fill="#2B2B2B" fill-opacity=".1" fill-rule="nonzero" d="M8.04950696,10.1998388 C10.4567521,10.1841568 12.4,9.02617631 12.4,7.6 C12.4,6.16405965 10.4300529,5 8,5 C5.5699471,5 3.6,6.16405965 3.6,7.6 C3.6,8.34158001 4.12540935,9.01064607 4.96826023,9.48430809 C3.88781248,8.91566919 3.2,8.05865157 3.2,7.1 C3.2,5.38791728 5.39380473,4 8.1,4 C10.8061953,4 13,5.38791728 13,7.1 C13,8.81208272 10.8061953,10.2 8.1,10.2 C8.08314898,10.2 8.06631784,10.1999462 8.04950696,10.1998388 Z"/>
<path fill="#000" fill-rule="nonzero" d="M10.22,12.721384 L11.5211619,12.21652 C12,12 12.4752272,11.4274213 12.3788138,10.9061197 C12.3777411,10.900392 12.3777411,10.900392 12.3766164,10.8946726 C12.2753472,10.3857952 11.7397877,10.0479521 11.1804108,10.1400789 L10.22,10.2159064 L10.22,12.721384 Z M10.22,9.83599915 L11.0913391,9.6924936 C11.9224413,9.55561487 12.7181565,10.0575702 12.8686186,10.8136421 C12.8702897,10.8221398 12.8702897,10.8221398 12.8718835,10.8306497 C13.0137126,11.5975111 12.451371,12.225574 11.6102336,12.564105 L10.22,12.99307"/>
<path fill="#2B2B2B" fill-opacity=".1" fill-rule="nonzero" d="M1.5703781,13.3999997 C1.45891818,13.0648919 1.4,12.7157489 1.4,12.3570148 C1.4,9.81650494 4.35492065,7.75701479 8,7.75701479 C11.6450793,7.75701479 14.6,9.81650494 14.6,12.3570148 C14.6,12.5598247 14.5811686,12.7595692 14.544658,12.9554451 C14.3521377,10.7170837 11.5221017,8.94088579 8.0591835,8.94088579 C4.47158678,8.94088579 1.563265,10.8472862 1.563265,13.1989503 C1.563265,13.2663439 1.56565352,13.3333718 1.5703781,13.3999997 Z" transform="matrix(1 0 0 -1 0 21.157)"/>
<circle cx="7.5" cy="10" r="1" fill="#1D1D1D" fill-rule="nonzero"/>
<circle cx="7.5" cy="12" r="1" fill="#1D1D1D" fill-rule="nonzero"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

-36
View File
@@ -424,42 +424,6 @@
}
],
"title": "Python 3.8.10"
},
{
"version": "3.10.7313",
"product": "PyPy",
"sources": [
{
"url": "https://downloads.python.org/pypy/pypy3.10-v7.3.13-src.zip",
"size": 30067315,
"sha256": "828fc66eca1c097e44bc910c78ab773a98747268c7ce264da97022e5aca358dc",
"fileName": "pypy3.10-v7.3.13-src.zip",
"type": "COMPRESSED"
},
{
"url": "https://downloads.python.org/pypy/pypy3.10-v7.3.13-src.tar.bz2",
"size": 23067819,
"sha256": "4ac1733c19d014d3193c804e7f40ffccbf6924bcaaee1b6089b82b9bf9353a6d",
"fileName": "pypy3.10-v7.3.13-src.tar.bz2",
"type": "COMPRESSED"
}
],
"binaries": [
{
"os": "Windows",
"cpuArch": "X86_64",
"resources": [
{
"url": "https://downloads.python.org/pypy/pypy3.10-v7.3.13-win64.zip",
"size": 31510169,
"sha256": "5b99422fb8978b2f4bbf97961bca49963a82dc47c2fa51b7d23c493db3a2e0f0",
"fileName": "pypy3.10-v7.3.13-win64.zip",
"type": "COMPRESSED"
}
]
}
],
"title": "PyPy 3.10.7313"
}
],
"conda": [
@@ -25,11 +25,10 @@ val LOG: Logger = logger<Sdks>()
/**
* Currently only CPython is supported, PyPy was added to check future structure flexibility.
* Currently only CPython is supported
*/
enum class Product(val title: String) {
CPython("Python"),
PyPy("PyPy"),
Miniconda("Miniconda"),
Anaconda("Anaconda");
}
@@ -13,11 +13,6 @@ class SdksTest {
assert(SdksKeeper.pythonReleasesByLanguageLevel().isNotEmpty())
}
@Test
fun testPyPy() {
val releases = SdksKeeper.pythonReleasesByLanguageLevel()[LanguageLevel.PYTHON310]
assert(releases!!.any { it.product == Product.PyPy })
}
@Test
fun testCPythonAvailableFor311and312() {
@@ -1,125 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.sdk.flavors;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.PatternUtil;
import com.jetbrains.python.icons.PythonIcons;
import com.jetbrains.python.psi.LanguageLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class PyPySdkFlavor extends PythonSdkFlavor<PyFlavorData.Empty> {
public static PyPySdkFlavor getInstance() {
return PythonSdkFlavor.EP_NAME.findExtension(PyPySdkFlavor.class);
}
private static final Pattern VERSION_RE = Pattern.compile("\\[(PyPy \\S+).*\\]");
private static final Pattern PYTHON_VERSION_RE = Pattern.compile("(Python \\S+).*");
private static final Pattern VERSION_STRING_RE = Pattern.compile("PyPy (\\S+)( \\[Python (\\S+)\\])?");
private PyPySdkFlavor() {
}
@Override
public @NotNull Class<PyFlavorData.Empty> getFlavorDataClass() {
return PyFlavorData.Empty.class;
}
@Override
public boolean isPlatformIndependent() {
return true;
}
@Override
public boolean isValidSdkPath(@NotNull String pathStr) {
return StringUtil.toLowerCase(FileUtilRt.getNameWithoutExtension(pathStr)).startsWith("pypy");
}
@Override
public @Nullable String getVersionStringFromOutput(@NotNull String output) {
final List<String> lines = Arrays.asList(StringUtil.splitByLines(output));
final String version = PatternUtil.getFirstMatch(lines, VERSION_RE);
final String pythonVersion = PatternUtil.getFirstMatch(lines, PYTHON_VERSION_RE);
if (version != null) {
final StringBuilder builder = new StringBuilder();
builder.append(version);
if (pythonVersion != null) {
builder.append(" [");
builder.append(pythonVersion);
builder.append("]");
}
return builder.toString();
}
return null;
}
@Override
public @NotNull String getVersionOption() {
return "--version";
}
@Override
public @NotNull String getName() {
return "PyPy";
}
@Override
public @NotNull LanguageLevel getLanguageLevel(@NotNull Sdk sdk) {
final String versionString = sdk.getVersionString();
if (versionString != null) {
final Matcher matcher = VERSION_STRING_RE.matcher(versionString);
if (matcher.matches()) {
final String version = matcher.group(1);
final String pythonVersion = matcher.group(3);
if (pythonVersion != null) {
return LanguageLevel.fromPythonVersion(pythonVersion);
}
else if (version != null) {
return LanguageLevel.fromPythonVersion(getPythonVersion(version));
}
}
}
return LanguageLevel.getDefault();
}
private static String getPythonVersion(@NotNull String pypyVersion) {
final String DEFAULT = "2.4";
final String LATEST = "2.7";
final List<String> vs = StringUtil.split(pypyVersion, ".");
try {
if (vs.size() >= 2) {
final int major = Integer.parseInt(vs.get(0));
final int minor = Integer.parseInt(vs.get(1));
if (major > 1) {
return LATEST;
}
else if (major == 1) {
if (minor >= 5) {
return "2.7";
}
else if (minor >= 4) {
return "2.5";
}
}
}
}
catch (NumberFormatException ignored) {
}
return DEFAULT;
}
@Override
public @NotNull Icon getIcon() {
return PythonIcons.Python.Pypy;
}
}
@@ -81,7 +81,7 @@ fun registerPythonSpecificEvent(group: EventLogGroup, eventId: String, vararg ex
}
val PYTHON_VERSION = EventFields.StringValidatedByRegexpReference("python_version", "version")
val PYTHON_IMPLEMENTATION = EventFields.String("python_implementation", listOf("PyPy", "Jython", "Python"))
val PYTHON_IMPLEMENTATION = EventFields.String("python_implementation", listOf("Jython", "Python"))
enum class InterpreterTarget(val value: String) {
+1 -1
View File
@@ -42,7 +42,7 @@ public class PyDebuggerTask extends PyCustomConfigDebuggerTask {
@Nullable
@Override
public Set<String> getTagsToCover() {
return Sets.newHashSet("python2.7", "python3.5", "python3.6", "python3.7", "python3.8", "jython", "IronPython", "pypy");
return Sets.newHashSet("python2.7", "python3.5", "python3.6", "python3.7", "python3.8", "jython");
}
protected boolean usePytestRunner() {
@@ -408,12 +408,6 @@ public class PythonDebuggerTest extends PyEnvTestCase {
eval("z").hasValue("102");
resume();
}
@NotNull
@Override
public Set<String> getTags() {
return Collections.singleton("-pypy"); //TODO: fix that for PyPy
}
});
}
@@ -21,9 +21,7 @@ PyScriptTestProcessRunner<*>> @JvmOverloads constructor(relativePathToTestData:
private val myRerunFailedTests: Int = 0) :
PyProcessWithConsoleTestTask<T>(relativePathToTestData, SdkCreationType.SDK_PACKAGES_ONLY) {
override fun getTagsToCover(): Set<String> = hashSetOf("python2.6", "python2.7", "python3.5", "python3.6", "jython", "pypy",
"IronPython")
override fun getTagsToCover(): Set<String> = hashSetOf("python3.6")
@Throws(Exception::class)
override fun createProcessRunner(): T {
@@ -22,11 +22,9 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkModificator;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.sdk.PySdkUtil;
import com.jetbrains.python.sdk.PythonSdkAdditionalData;
import com.jetbrains.python.sdk.PythonSdkType;
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor;
import com.jetbrains.python.sdk.flavors.PyPySdkFlavor;
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
import com.jetbrains.python.sdk.flavors.UnixPythonSdkFlavor;
import org.jetbrains.annotations.NotNull;
@@ -67,29 +65,7 @@ public class PySdkFlavorTest extends PyTestCase {
assertEquals(LanguageLevel.PYTHON26, flavor.getLanguageLevel(mockSdk));
}
public void testPyPy23VersionString() {
final PythonSdkFlavor flavor = PyPySdkFlavor.getInstance();
final String versionOutput = """
Python 2.7.6 (32f35069a16d819b58c1b6efb17c44e3e53397b2, Jun 10 2014, 00:42:27)
[PyPy 2.3.1 with GCC 4.8.2]
""";
final Sdk mockSdk = createMockSdk(flavor, versionOutput);
assertEquals("PyPy 2.3.1 [Python 2.7.6]", mockSdk.getVersionString());
assertEquals(LanguageLevel.PYTHON27, flavor.getLanguageLevel(mockSdk));
assertEquals("__builtin__.py", PySdkUtil.getBuiltinsFileName(mockSdk));
}
public void testPyPy323VersionString() {
final PythonSdkFlavor flavor = PyPySdkFlavor.getInstance();
final String versionOutput = """
Python 3.4.5 (986752d005bb6c65ce418113e4c3cd115f61a9b4, Jun 23 2014, 00:23:34)
[PyPy 2.3.1 with GCC 4.8.2]
""";
final Sdk mockSdk = createMockSdk(flavor, versionOutput);
assertEquals("PyPy 2.3.1 [Python 3.4.5]", mockSdk.getVersionString());
assertEquals(LanguageLevel.PYTHON34, flavor.getLanguageLevel(mockSdk));
assertEquals("builtins.py", PySdkUtil.getBuiltinsFileName(mockSdk));
}
// TODO: Add tests for MayaPy and IronPython SDK flavors