code stringlengths 9 189k | meta_data.file_name stringclasses 538
values | meta_data.module stringclasses 202
values | meta_data.contains_class bool 2
classes | meta_data.contains_function bool 2
classes | meta_data.file_imports listlengths 0 97 | meta_data.start_line int64 -1 6.71k | meta_data.end_line int64 -1 6.74k |
|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Script for running Spyder tests programmatically.
"""
# Standard library imports
import argparse
import os
# To activate/deactivate certain things for pytests only
# NOTE: Please leave this before ... | runtests.py | spyder | false | false | [
"import argparse",
"import os",
"from qtpy import QtWebEngineWidgets # noqa",
"import pytest"
] | 1 | 29 |
def run_pytest(run_slow=False, extra_args=None):
"""Run pytest tests for Spyder."""
# Be sure to ignore subrepos
pytest_args = ['-vv', '-rw', '--durations=10', '--ignore=./external-deps',
'-W ignore::UserWarning', '--timeout=120']
if CI:
# Show coverage
pytest_args +=... | runtests.py | spyder | false | true | [
"import argparse",
"import os",
"from qtpy import QtWebEngineWidgets # noqa",
"import pytest"
] | 32 | 58 |
def main():
"""Parse args then run the pytest suite for Spyder."""
test_parser = argparse.ArgumentParser(
usage='python runtests.py [-h] [--run-slow] [pytest_args]',
description="Helper script to run Spyder's test suite")
test_parser.add_argument('--run-slow', action='store_true', default=Fa... | runtests.py | spyder | false | true | [
"import argparse",
"import os",
"from qtpy import QtWebEngineWidgets # noqa",
"import pytest"
] | 61 | 73 |
#!/usr/bin/env python3
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Helper script for installing spyder and external-deps locally in editable mode.
"""
import argparse
import os
import sys
from logging import Formatter, StreamHandler, getLogger
from pathlib import Pa... | install_dev_repos.py | spyder | false | false | [
"import argparse",
"import os",
"import sys",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_output",
"from importlib_metadata import PackageNotFoundError, distribution",
"from packaging.requirements import Requirement"
] | 1 | 46 |
try:
dist = distribution(p.name)
except PackageNotFoundError:
dist = None
editable = None
else:
editable = (p == dist._path or p in dist._path.parents)
# This fixes detecting that PyLSP was installed in editable mode under
# some scenarios.
# Fixes spyder... | install_dev_repos.py | spyder | false | false | [
"import argparse",
"import os",
"import sys",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_output",
"from importlib_metadata import PackageNotFoundError, distribution",
"from packaging.requirements import Requirement"
] | 40 | 65 |
def get_python_lsp_version():
"""Get current version to pass it to setuptools-scm."""
req_file = DEVPATH / 'requirements' / 'main.yml'
with open(req_file, 'r', encoding='utf-8') as f:
for line in f:
if 'python-lsp-server' not in line:
continue
line = line.spli... | install_dev_repos.py | spyder | false | true | [
"import argparse",
"import os",
"import sys",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_output",
"from importlib_metadata import PackageNotFoundError, distribution",
"from packaging.requirements import Requirement"
] | 68 | 85 |
def install_repo(name, not_editable=False):
"""
Install a single repo from source located in spyder/external-deps, ignoring
dependencies, in standard or editable mode.
Parameters
----------
name : str
Must be 'spyder' or the distribution name of a repo in
spyder/external-deps.
... | install_dev_repos.py | spyder | false | true | [
"import argparse",
"import os",
"import sys",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_output",
"from importlib_metadata import PackageNotFoundError, distribution",
"from packaging.requirements import Requirement"
] | 88 | 128 |
def main(install=tuple(REPOS.keys()), no_install=tuple(), **kwargs):
"""
Install all subrepos from source.
Parameters
----------
install : iterable (spyder and all repos in spyder/external-deps)
Distribution names of repos to be installed from spyder/external-deps.
no_install : iterable... | install_dev_repos.py | spyder | false | true | [
"import argparse",
"import os",
"import sys",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_output",
"from importlib_metadata import PackageNotFoundError, distribution",
"from packaging.requirements import Requirement"
] | 131 | 174 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder
======
The Scientific Python Development Environment
Spyder is a powerful scientific environment written in Python, for Python,
and designed by and for s... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 1 | 45 |
# =============================================================================
# Constants
# =============================================================================
NAME = 'spyder'
LIBNAME = 'spyder'
WINDOWS_INSTALLER_NAME = os.environ.get('EXE_NAME')
from spyder import __version__, __website_url__ #analysis:i... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 48 | 60 |
def get_package_data(name, extlist):
"""
Return data files for package *name* with extensions in *extlist*.
"""
flist = []
# Workaround to replace os.path.relpath (not available until Python 2.6):
offset = len(name)+len(os.pathsep)
for dirpath, _dirnames, filenames in os.walk(name):
... | setup.py | spyder | false | true | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 61 | 104 |
def get_packages():
"""
Return package list.
"""
packages = get_subpackages(LIBNAME)
return packages
# =============================================================================
# Make Linux detect Spyder desktop file (will not work with wheels)
# ===============================================... | setup.py | spyder | false | true | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 107 | 117 |
class CustomInstallData(install_data):
def run(self):
install_data.run(self)
if sys.platform.startswith('linux'):
try:
subprocess.call(['update-desktop-database'])
except:
print("ERROR: unable to update desktop database",
... | setup.py | spyder | false | true | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 118 | 152 |
# =============================================================================
# Use Readme for long description
# =============================================================================
with io.open('README.md', encoding='utf-8') as f:
LONG_DESCRIPTION = f.read() | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 155 | 159 |
#==============================================================================
# Setup arguments
#==============================================================================
setup_args = dict(
name=NAME,
version=__version__,
description='The Scientific Python Development Environment',
long_descripti... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 162 | 194 |
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Topic :: Scientific/Engineerin... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 192 | 202 |
install_requires = [
'applaunchservices>=0.3.0;platform_system=="Darwin"',
'atomicwrites>=1.2.0',
'chardet>=2.0.0',
'cloudpickle>=0.5.0',
'cookiecutter>=1.6.0',
'diff-match-patch>=20181111',
'intervaltree>=3.0.2',
'ipython>=8.12.2,<8.13.0; python_version=="3.8"',
'ipython>=8.13.0,<9.... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 205 | 251 |
# Loosen constraints to ensure dev versions still work
if 'dev' in __version__:
reqs_to_loosen = {'python-lsp-server[all]', 'qtconsole', 'spyder-kernels'}
install_requires = [req for req in install_requires
if req.split(">")[0] not in reqs_to_loosen]
install_requires.append('python-l... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 253 | 282 |
spyder_plugins_entry_points = [
'appearance = spyder.plugins.appearance.plugin:Appearance',
'application = spyder.plugins.application.plugin:Application',
'completions = spyder.plugins.completion.plugin:CompletionPlugin',
'debugger = spyder.plugins.debugger.plugin:Debugger',
'editor = spyder.plugins... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 285 | 307 |
'profiler = spyder.plugins.profiler.plugin:Profiler',
'project_explorer = spyder.plugins.projects.plugin:Projects',
'pylint = spyder.plugins.pylint.plugin:Pylint',
'pythonpath_manager = spyder.plugins.pythonpath.plugin:PythonpathManager',
'run = spyder.plugins.run.plugin:Run',
'shortcuts = spyder.pl... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 305 | 317 |
spyder_completions_entry_points = [
('fallback = spyder.plugins.completion.providers.fallback.provider:'
'FallbackProvider'),
('snippets = spyder.plugins.completion.providers.snippets.provider:'
'SnippetsProvider'),
('lsp = spyder.plugins.completion.providers.languageserver.provider:'
'Langua... | setup.py | spyder | false | false | [
"from __future__ import print_function",
"from distutils.command.install_data import install_data",
"import io",
"import os",
"import os.path as osp",
"import subprocess",
"import sys",
"from setuptools import setup, find_packages",
"from setuptools.command.install import install",
"from spyder im... | 319 | 344 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Configuration file for Pytest
NOTE: DO NOT add fixtures here. It could generate problems with
QtAwesome being called before a QApplication is created.
"""
import os
import os.path as osp
impo... | conftest.py | spyder | false | true | [
"import os",
"import os.path as osp",
"import re",
"import sys",
"import pytest",
"from spyder.config.manager import CONF",
"from spyder.plugins.completion.api import COMPLETION_ENTRYPOINT",
"from spyder.plugins.completion.plugin import CompletionPlugin",
"from pkg_resources import iter_entry_points... | 1 | 56 |
def pytest_collection_modifyitems(config, items):
"""
Decide what tests to run (slow or fast) according to the --run-slow
option.
"""
passed_tests = get_passed_tests()
slow_option = config.getoption("--run-slow")
skip_slow = pytest.mark.skip(reason="Need --run-slow option to run")
skip_f... | conftest.py | spyder | false | true | [
"import os",
"import os.path as osp",
"import re",
"import sys",
"import pytest",
"from spyder.config.manager import CONF",
"from spyder.plugins.completion.api import COMPLETION_ENTRYPOINT",
"from spyder.plugins.completion.plugin import CompletionPlugin",
"from pkg_resources import iter_entry_points... | 59 | 95 |
for i, item in enumerate(ipyconsole_items):
if i < len(ipyconsole_items) * percentage:
slow_items.append(item)
for item in items:
if slow_option:
if item not in slow_items:
item.add_marker(skip_fast)
else:
if item in slow_items:
... | conftest.py | spyder | false | false | [
"import os",
"import os.path as osp",
"import re",
"import sys",
"import pytest",
"from spyder.config.manager import CONF",
"from spyder.plugins.completion.api import COMPLETION_ENTRYPOINT",
"from spyder.plugins.completion.plugin import CompletionPlugin",
"from pkg_resources import iter_entry_points... | 93 | 109 |
def reset_conf_before_test():
from spyder.config.manager import CONF
CONF.reset_to_defaults(notification=False)
from spyder.plugins.completion.api import COMPLETION_ENTRYPOINT
from spyder.plugins.completion.plugin import CompletionPlugin
# Restore completion clients default settings, since they
... | conftest.py | spyder | false | true | [
"import os",
"import os.path as osp",
"import re",
"import sys",
"import pytest",
"from spyder.config.manager import CONF",
"from spyder.plugins.completion.api import COMPLETION_ENTRYPOINT",
"from spyder.plugins.completion.plugin import CompletionPlugin",
"from pkg_resources import iter_entry_points... | 110 | 139 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Project Contributors
#
# Distributed under the terms of the MIT License
# (see spyder/__init__.py for details)
# ----------------------------------------------------... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 1 | 41 |
# =============================================================================
# ---- Parse command line
# =============================================================================
parser = argparse.ArgumentParser(
usage="python bootstrap.py [options] [-- spyder_options]",
epilog="""\
Arguments for Spyder'... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 44 | 69 |
parser.add_argument('--no-install', action='store_true', default=False,
help="Do not install Spyder or its subrepos")
parser.add_argument('spyder_options', nargs='*') | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 68 | 70 |
args = parser.parse_args()
assert args.gui in (None, 'pyqt5', 'pyside2'), \
"Invalid GUI toolkit option '%s'" % args.gui
# =============================================================================
# ---- Install sub repos
# =============================================================================
inst... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 72 | 108 |
if installed_dev_repo:
logger.info("Restarting bootstrap to pick up installed subrepos")
if '--' in sys.argv:
sys.argv.insert(sys.argv.index('--'), '--no-install')
else:
sys.argv.append('--no-install')
result = subprocess.run([sys.executable, *sys.argv])
sys.exit(result.returncode)
... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 110 | 141 |
# To activate/deactivate certain things for development
os.environ['SPYDER_DEV'] = 'True'
if args.debug:
# safety check - Spyder config should not be imported at this point
if "spyder.config.base" in sys.modules:
sys.exit("ERROR: Can't enable debug mode - Spyder is already imported")
logger.info("S... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 140 | 166 |
# =============================================================================
# ---- Check versions
# =============================================================================
# Checking versions (among other things, this has the effect of setting the
# QT_API environment variable if this has not yet been done ju... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 169 | 193 |
# Reset temporary config directory if starting in --safe-mode
if args.safe_mode or os.environ.get('SPYDER_SAFE_MODE'):
from spyder.config.base import get_conf_path # analysis:ignore
conf_dir = Path(get_conf_path())
if conf_dir.is_dir():
shutil.rmtree(conf_dir)
logger.info("Running Spyder")
from sp... | bootstrap.py | spyder | false | false | [
"import argparse",
"import os",
"import shutil",
"import subprocess",
"import sys",
"import time",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from install_dev_repos import DEVPATH, REPOS, install_repo",
"from spyder import get_versions",
"import PyQt5... | 195 | 211 |
# postinstall script for Spyder
"""Create Spyder start menu and desktop entries"""
from __future__ import print_function
import os
import sys
import os.path as osp
import struct
import winreg
EWS = "Edit with Spyder"
KEY_C = r"Software\Classes\%s"
KEY_C0 = KEY_C % r"Python.%sFile\shell\%s"
KEY_C1 = KEY_C0 + r"\comm... | spyder_win_post_install.py | spyder.scripts | false | false | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 1 | 35 |
# file_created() and directory_created() functions do nothing if post
# install script isn't run from bdist_wininst installer, instead if
# shortcuts and start menu directory exist, they are removed when the
# post install script is called with the -remote option
def file_created(file):
pass
... | spyder_win_post_install.py | spyder.scripts | false | true | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 37 | 67 |
ilink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
pythoncom.CLSCTX_INPROC_SERVER,
shell.IID_IShellLink)
ilink.SetPath(path)
ilink.SetDescription(description)
if arguments:
ilink.SetArg... | spyder_win_post_install.py | spyder.scripts | false | true | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 69 | 92 |
path_names = ['CSIDL_COMMON_STARTMENU', 'CSIDL_STARTMENU',
'CSIDL_COMMON_APPDATA', 'CSIDL_LOCAL_APPDATA',
'CSIDL_APPDATA', 'CSIDL_COMMON_DESKTOPDIRECTORY',
'CSIDL_DESKTOPDIRECTORY', 'CSIDL_COMMON_STARTUP',
'CSIDL_STARTUP', 'CSIDL_CO... | spyder_win_post_install.py | spyder.scripts | false | false | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 94 | 105 |
def install():
"""Function executed when running the script with the -install switch"""
# Create Spyder start menu folder
# Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights
# This is consistent with use of CSIDL_DESKTOPDIRECTORY below
# CSIDL_COMMON_PROGRAMS =
# C:\ProgramData\Mic... | spyder_win_post_install.py | spyder.scripts | false | true | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 108 | 123 |
# Create Spyder start menu entries
python = osp.abspath(osp.join(sys.prefix, 'python.exe'))
pythonw = osp.abspath(osp.join(sys.prefix, 'pythonw.exe'))
script = osp.abspath(osp.join(sys.prefix, 'scripts', 'spyder'))
if not osp.exists(script): # if not installed to the site scripts dir
script = os... | spyder_win_post_install.py | spyder.scripts | false | false | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 125 | 147 |
current = True # only affects current user
root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
winreg.SetValueEx(winreg.CreateKey(root, KEY_C1 % ("", EWS)),
"", 0, winreg.REG_SZ,
'"%s" "%s\Scripts\spyder" "%%1"' % (pythonw, sys.prefix))
winr... | spyder_win_post_install.py | spyder.scripts | false | false | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 149 | 164 |
def remove():
"""Function executed when running the script with the -remove switch"""
current = True # only affects current user
root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
for key in (KEY_C1 % ("", EWS), KEY_C1 % ("NoCon", EWS),
KEY_C0 % ("", EWS), KEY_C0 ... | spyder_win_post_install.py | spyder.scripts | false | true | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 167 | 197 |
'Spyder (Py%i.%i %i bit)' % (sys.version_info[0],
sys.version_info[1],
struct.calcsize('P')*8))
if osp.isdir(start_menu):
for fname in os.listdir(start_menu):
try:
... | spyder_win_post_install.py | spyder.scripts | false | false | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 118 | 138 |
if __name__=='__main__':
if len(sys.argv) > 1:
if sys.argv[1] == '-install':
try:
install()
except OSError:
print("Failed to create Start Menu items.", file=sys.stderr)
elif sys.argv[1] == '-remove':
remove()
else:
... | spyder_win_post_install.py | spyder.scripts | false | false | [
"from __future__ import print_function",
"import os",
"import sys",
"import os.path as osp",
"import struct",
"import winreg",
"import pythoncom",
"from win32com.shell import shell, shellcon # analysis:ignore",
"import pythoncom",
"from win32com.shell import shell, shellcon"
] | 219 | 233 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# Standard library imports
import os
import re
import sys
from argparse import ArgumentParser, RawTextHelpFormatter
from configparser import ConfigParser
from datetim... | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 1 | 44 |
class BuildCondaPkg:
"""Base class for building a conda package for conda-based installer"""
name = None
norm = True
source = None
feedstock = None
shallow_ver = None
def __init__(self, data={}, debug=False, shallow=False):
self.logger = getLogger(self.__class__.__name__)
if... | build_conda_pkgs.py | spyder.installers-conda | true | true | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 47 | 92 |
# Clone from source
kwargs = dict(to_path=self._bld_src)
if shallow:
kwargs.update(shallow_exclude=self.shallow_ver)
self.logger.info(
f"Cloning source shallow from tag {self.shallow_ver}...")
else:
self.logger.info(... | build_conda_pkgs.py | spyder.installers-conda | false | true | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 94 | 140 |
1. Patch meta.yaml
2. Patch build script
"""
if self._recipe_patched:
return
self.logger.info("Patching 'meta.yaml'...")
file = self._fdstk_path / "recipe" / "meta.yaml"
meta = file.read_text()
# Replace jinja variable values
for k, v in sel... | build_conda_pkgs.py | spyder.installers-conda | false | true | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 134 | 175 |
1. Patch the recipe
2. Build the package
3. Remove cloned repositories
"""
t0 = time()
try:
self.patch_recipe()
self.logger.info("Building conda package "
f"{self.name}={self.version}...")
check_call([
... | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 169 | 192 |
class SpyderCondaPkg(BuildCondaPkg):
name = "spyder"
norm = False
source = os.environ.get('SPYDER_SOURCE', HERE.parent)
feedstock = "https://github.com/conda-forge/spyder-feedstock"
shallow_ver = "v5.3.2"
def _patch_source(self):
self.logger.info("Creating Spyder menu file...")
... | build_conda_pkgs.py | spyder.installers-conda | false | true | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 195 | 219 |
# Remove app node
meta = re.sub(r'^app:\n( .*\n)+', '', meta, flags=re.MULTILINE)
# Get current Spyder requirements
yaml = YAML()
current_requirements = ['python']
current_requirements += yaml.load(
REQ_MAIN.read_text())['dependencies']
if os.name == 'nt':
... | build_conda_pkgs.py | spyder.installers-conda | false | true | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 218 | 252 |
return meta
def _patch_build_script(self):
self.logger.info("Patching build script...")
rel_menufile = self.menufile.relative_to(HERE.parent)
if os.name == 'posix':
logomark = "branding/logo/logomark/spyder-logomark-background.png"
file = self._fdstk_path / "recipe... | build_conda_pkgs.py | spyder.installers-conda | false | true | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 125 | 161 |
self.logger.info(f"Patched build script contents:\n{file.read_text()}") | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | -1 | -1 |
class PylspCondaPkg(BuildCondaPkg):
name = "python-lsp-server"
source = os.environ.get('PYTHON_LSP_SERVER_SOURCE')
feedstock = "https://github.com/conda-forge/python-lsp-server-feedstock"
shallow_ver = "v1.4.1"
class QtconsoleCondaPkg(BuildCondaPkg):
name = "qtconsole"
source = os.environ.get(... | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 288 | 299 |
class SpyderKernelsCondaPkg(BuildCondaPkg):
name = "spyder-kernels"
source = os.environ.get('SPYDER_KERNELS_SOURCE')
feedstock = "https://github.com/conda-forge/spyder-kernels-feedstock"
shallow_ver = "v2.3.1"
PKGS = {
SpyderCondaPkg.name: SpyderCondaPkg,
PylspCondaPkg.name: PylspCondaPkg,
... | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 302 | 334 |
Alternatively, any external-deps may be packaged from an arbitrary
git repository (in its checked out state) by setting the
appropriate environment variable from the following:
SPYDER_SOURCE
PYTHON_LSP_SERVER_SOURCE
QDARKSTYLE_SOURCE
... | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 336 | 378 |
for k in args.build:
pkg = PKGS[k](debug=args.debug, shallow=args.shallow)
pkg.build()
specs[k] = "=" + pkg.version
yaml.dump(specs, SPECS)
elapse = timedelta(seconds=int(time() - t0))
logger.info(f"Total build time = {elapse}") | build_conda_pkgs.py | spyder.installers-conda | false | false | [
"import os",
"import re",
"import sys",
"from argparse import ArgumentParser, RawTextHelpFormatter",
"from configparser import ConfigParser",
"from datetime import timedelta",
"from logging import Formatter, StreamHandler, getLogger",
"from pathlib import Path",
"from subprocess import check_call",
... | 375 | 383 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Create Spyder installers using `constructor`.
It creates a `construct.yaml` file with the needed settings
and then runs `constructor`.
Some environment variable... | build_installers.py | spyder.installers-conda | false | false | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 1 | 52 |
# Local imports
from build_conda_pkgs import HERE, BUILD, RESOURCES, SPECS, h, get_version
DIST = HERE / "dist"
logger = getLogger('BuildInstallers')
logger.addHandler(h)
logger.setLevel('INFO')
APP = "Spyder"
SPYREPO = HERE.parent
WINDOWS = os.name == "nt"
MACOS = sys.platform == "darwin"
LINUX = sys.platform.start... | build_installers.py | spyder.installers-conda | false | false | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 45 | 86 |
scientific_packages = {
"cython": "",
"matplotlib": "",
"numpy": "",
"openpyxl": "",
"pandas": "",
"scipy": "",
"sympy": "",
}
# ---- Parse arguments
p = ArgumentParser()
p.add_argument(
"--no-local", action="store_true",
help="Do not use local conda packages"
)
p.add_argument(
... | build_installers.py | spyder.installers-conda | false | false | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 78 | 131 |
yaml = YAML()
yaml.indent(mapping=2, sequence=4, offset=2)
indent4 = partial(indent, prefix=" ")
SPYVER = get_version(SPYREPO, normalize=False).lstrip('v').split("+")[0]
specs = {
"python": "=" + PY_VER,
"spyder": "=" + SPYVER,
}
specs.update(scientific_packages)
if SPECS.exists():
logger.info(f"Readi... | build_installers.py | spyder.installers-conda | false | false | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 133 | 163 |
def _generate_background_images(installer_type):
"""This requires Pillow."""
if installer_type == "sh":
# shell installers are text-based, no graphics
return
from PIL import Image
logo_path = SPYREPO / "img_src" / "spyder.png"
logo = Image.open(logo_path, "r")
if installer_typ... | build_installers.py | spyder.installers-conda | false | true | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 166 | 194 |
def _get_condarc():
# we need defaults for tensorflow and others on windows only
defaults = "- defaults" if WINDOWS else ""
prompt = "[spyder]({default_env}) "
contents = dedent(
f"""
channels: #!final
- conda-forge
{defaults}
repodata_fns: #!final
... | build_installers.py | spyder.installers-conda | false | true | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 197 | 219 |
def _definitions():
condarc = _get_condarc()
definitions = {
"name": APP,
"company": "Spyder-IDE",
"reverse_domain_identifier": "org.spyder-ide.Spyder",
"version": SPYVER,
"channels": [
"napari/label/bundle_tools_3",
"conda-forge/label/spyder_kerne... | build_installers.py | spyder.installers-conda | false | true | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 222 | 260 |
definitions["license_file"] = str(RESOURCES / "bundle_license.rtf")
if args.install_type == "sh":
definitions["license_file"] = str(SPYREPO / "LICENSE.txt")
if LINUX:
definitions.update(
{
"default_prefix": os.path.join(
"$HOME", ".local", INSTALL... | build_installers.py | spyder.installers-conda | false | false | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 258 | 294 |
if args.cert_id:
definitions["signing_identity_name"] = args.cert_id
definitions["notarization_identity_name"] = args.cert_id
if WINDOWS:
definitions["conda_default_channels"].append("defaults")
definitions.update(
{
"welcome_image": str(WELCOME_I... | build_installers.py | spyder.installers-conda | false | false | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 296 | 328 |
def _constructor():
"""
Create a temporary `construct.yaml` input file and
run `constructor`.
"""
constructor = find_executable("constructor")
if not constructor:
raise RuntimeError("Constructor must be installed and in PATH.")
definitions = _definitions()
cmd_args = [construct... | build_installers.py | spyder.installers-conda | false | true | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 331 | 359 |
def licenses():
info_path = BUILD / "info.json"
try:
info = json.load(info_path)
except FileNotFoundError:
print(
"!! Use `constructor --debug` to write info.json and get licenses",
file=sys.stderr,
)
raise
zipname = BUILD / f"licenses.{OS}-{ARCH}... | build_installers.py | spyder.installers-conda | false | true | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 362 | 385 |
def main():
t0 = time()
try:
DIST.mkdir(exist_ok=True)
_constructor()
assert Path(OUTPUT_FILE).exists()
logger.info(f"Created {OUTPUT_FILE}")
finally:
elapse = timedelta(seconds=int(time() - t0))
logger.info(f"Build time: {elapse}")
if __name__ == "__main__"... | build_installers.py | spyder.installers-conda | false | true | [
"from argparse import ArgumentParser",
"from datetime import timedelta",
"from distutils.spawn import find_executable",
"from functools import partial",
"import json",
"from logging import getLogger",
"import os",
"from pathlib import Path",
"import platform",
"import re",
"from subprocess impor... | 388 | 417 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
spyder.py3compat
----------------
Transitional module providing compatibility functions intended to help
migrating from Python 2 to Python 3.
"""
import operato... | py3compat.py | spyder.spyder | false | true | [
"import operator",
"import pickle # noqa. For compatibility with spyder-line-profiler"
] | 1 | 42 |
def is_binary_string(obj):
"""Return True if `obj` is a binary string, False if it is anything else"""
return isinstance(obj, bytes)
def is_string(obj):
"""Return True if `obj` is a text or binary Python string object,
False if it is anything else, like a QString (PyQt API #1)"""
return is_text_str... | py3compat.py | spyder.spyder | false | true | [
"import operator",
"import pickle # noqa. For compatibility with spyder-line-profiler"
] | 40 | 80 |
def iterkeys(d, **kw):
return iter(d.keys(**kw))
def itervalues(d, **kw):
return iter(d.values(**kw))
def iteritems(d, **kw):
return iter(d.items(**kw))
def iterlists(d, **kw):
return iter(d.lists(**kw))
viewkeys = operator.methodcaller("keys")
viewvalues = operator.methodcaller("values")
viewitem... | py3compat.py | spyder.spyder | false | true | [
"import operator",
"import pickle # noqa. For compatibility with spyder-line-profiler"
] | 73 | 93 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Project Contributors
#
# Distributed under the terms of the MIT License
# (see spyder/__init__.py for details)
# --------------------------------------------------------------------------... | pyplot.py | spyder.spyder | false | false | [
"from guiqwt.pyplot import *",
"from matplotlib.pyplot import *"
] | 1 | 18 |
# -*- coding: utf-8 -*-
"""
MIT License
===========
The spyder/images dir and some source files under other terms (see NOTICE.txt).
Copyright (c) 2009- Spyder Project Contributors and others (see AUTHORS.txt)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated... | __init__.py | spyder.spyder | false | false | [
"import os",
"import sys",
"import platform",
"import qtpy",
"import qtpy.QtCore",
"from spyder.utils.conda import is_conda_env",
"from spyder.config.base import is_conda_based_app",
"from spyder.utils import vcs"
] | 1 | 32 |
version_info = (6, 0, 0, "dev0")
__version__ = '.'.join(map(str, version_info))
__installer_version__ = __version__
__title__ = 'Spyder'
__author__ = 'Spyder Project Contributors and others'
__license__ = __doc__
__project_url__ = 'https://github.com/spyder-ide/spyder'
__forum_url__ = 'https://groups.google.com/grou... | __init__.py | spyder.spyder | false | false | [
"import os",
"import sys",
"import platform",
"import qtpy",
"import qtpy.QtCore",
"from spyder.utils.conda import is_conda_env",
"from spyder.config.base import is_conda_based_app",
"from spyder.utils import vcs"
] | 32 | 53 |
def get_versions(reporev=True):
"""Get version information for components used by Spyder"""
import sys
import platform
import qtpy
import qtpy.QtCore
from spyder.utils.conda import is_conda_env
from spyder.config.base import is_conda_based_app
revision = branch = None
if reporev:
... | __init__.py | spyder.spyder | false | true | [
"import os",
"import sys",
"import platform",
"import qtpy",
"import qtpy.QtCore",
"from spyder.utils.conda import is_conda_env",
"from spyder.config.base import is_conda_based_app",
"from spyder.utils import vcs"
] | 56 | 98 |
return versions | __init__.py | spyder.spyder | false | false | [
"import os",
"import sys",
"import platform",
"import qtpy",
"import qtpy.QtCore",
"from spyder.utils.conda import is_conda_env",
"from spyder.config.base import is_conda_based_app",
"from spyder.utils import vcs"
] | -1 | -1 |
def get_versions_text(reporev=True):
"""Create string of version information for components used by Spyder"""
versions = get_versions(reporev=reporev)
# Get git revision for development version
revision = versions['revision'] or ''
return f"""\
* Spyder version: {versions['spyder']} {revision} ({v... | __init__.py | spyder.spyder | false | true | [
"import os",
"import sys",
"import platform",
"import qtpy",
"import qtpy.QtCore",
"from spyder.utils.conda import is_conda_env",
"from spyder.config.base import is_conda_based_app",
"from spyder.utils import vcs"
] | 103 | 116 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Module checking Spyder runtime dependencies"""
# Standard library imports
import os
import os.path as osp
import sys
# Local imports
from spyder.config.base impo... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 1 | 30 |
# =============================================================================
# Versions
# =============================================================================
# Hard dependencies
APPLAUNCHSERVICES_REQVER = '>=0.3.0'
ATOMICWRITES_REQVER = '>=1.2.0'
CHARDET_REQVER = '>=2.0.0'
CLOUDPICKLE_REQVER = '>=0.5.0'
CO... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 33 | 77 |
# Optional dependencies
CYTHON_REQVER = '>=0.21'
MATPLOTLIB_REQVER = '>=3.0.0'
NUMPY_REQVER = '>=1.7'
PANDAS_REQVER = '>=1.1.1'
SCIPY_REQVER = '>=0.17.0'
SYMPY_REQVER = '>=0.7.3' | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 79 | 85 |
# =============================================================================
# Descriptions
# NOTE: We declare our dependencies in **alphabetical** order
# If some dependencies are limited to some systems only, add a 'display' key.
# See 'applaunchservices' for an example.
# =========================================... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 88 | 118 |
'features': _("Create projects from cookiecutter templates"),
'required_version': COOKIECUTTER_REQVER},
{'modname': "diff_match_patch",
'package_name': "diff-match-patch",
'features': _("Compute text file diff changes during edition"),
'required_version': DIFF_MATCH_PATCH_REQVER},
{'modname'... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 115 | 148 |
'required_version': KEYRING_REQVER},
{'modname': "nbconvert",
'package_name': "nbconvert",
'features': _("Manipulate Jupyter notebooks in the Editor"),
'required_version': NBCONVERT_REQVER},
{'modname': "numpydoc",
'package_name': "numpydoc",
'features': _("Improve code completion for o... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 145 | 178 |
'required_version': PSUTIL_REQVER},
{'modname': "pygments",
'package_name': "pygments",
'features': _("Syntax highlighting for a lot of file types in the Editor"),
'required_version': PYGMENTS_REQVER},
{'modname': "pylint",
'package_name': "pylint",
'features': _("Static code analysis")... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 175 | 209 |
'required_version': PYUCA_REQVER},
{'modname': "xdg",
'package_name': "pyxdg",
'features': _("Parse desktop files on Linux"),
'required_version': PYXDG_REQVER,
'display': sys.platform.startswith('linux')},
{'modname': "zmq",
'package_name': "pyzmq",
'features': _("Client for the la... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 205 | 240 |
'package_name': "rtree",
'features': _("Fast access to code snippet regions"),
'required_version': RTREE_REQVER},
{'modname': "setuptools",
'package_name': "setuptools",
'features': _("Determine package versions"),
'required_version': SETUPTOOLS_REQVER},
{'modname': "sphinx",
'pack... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 236 | 267 |
# Optional dependencies
DESCRIPTIONS += [
{'modname': "cython",
'package_name': "cython",
'features': _("Run Cython files in the IPython Console"),
'required_version': CYTHON_REQVER,
'kind': OPTIONAL},
{'modname': "matplotlib",
'package_name': "matplotlib",
'features': _("2D/3D plo... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 270 | 307 |
class Dependency(object):
"""
Spyder's dependency
Version may starts with =, >=, > or < to specify the exact requirement;
multiple conditions may be separated by ',' (e.g. '>=0.13,<1.0')"""
OK = 'OK'
NOK = 'NOK'
def __init__(self, modname, package_name, features, required_version,
... | dependencies.py | spyder.spyder | false | false | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 308 | 332 |
if installed_version is None:
try:
self.installed_version = programs.get_module_version(modname)
if not self.installed_version:
# Use get_package_version and the distribution name
# because there are cases for which the version can't
... | dependencies.py | spyder.spyder | false | true | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 334 | 364 |
def get_installed_version(self):
"""Return dependency status (string)"""
if self.check():
return '%s (%s)' % (self.installed_version, self.OK)
else:
return '%s (%s)' % (self.installed_version, self.NOK)
def get_status(self):
"""Return dependency status (strin... | dependencies.py | spyder.spyder | false | true | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 366 | 381 |
def add(modname, package_name, features, required_version,
installed_version=None, kind=MANDATORY):
"""Add Spyder dependency"""
global DEPENDENCIES
for dependency in DEPENDENCIES:
# Avoid showing an unnecessary error when running our tests.
if running_in_ci() and 'spyder_boilerplate'... | dependencies.py | spyder.spyder | false | true | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 384 | 408 |
def status(deps=DEPENDENCIES, linesep=os.linesep):
"""Return a status of dependencies."""
maxwidth = 0
data = []
# Find maximum width
for dep in deps:
title = dep.modname
if dep.required_version is not None:
title += ' ' + dep.required_version
maxwidth = max([ma... | dependencies.py | spyder.spyder | false | true | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 411 | 447 |
def missing_dependencies():
"""Return the status of missing dependencies (if any)"""
missing_deps = []
for dependency in DEPENDENCIES:
if dependency.kind != OPTIONAL and not dependency.check():
missing_deps.append(dependency)
if missing_deps:
return status(deps=missing_deps,... | dependencies.py | spyder.spyder | false | true | [
"import os",
"import os.path as osp",
"import sys",
"from spyder.config.base import _, running_in_ci, is_conda_based_app",
"from spyder.utils import programs"
] | 450 | 468 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Module checking Spyder installation requirements"""
# Third-party imports
from packaging.version import parse
def show_warning(message):
"""Show warning usi... | requirements.py | spyder.spyder | false | true | [
"from packaging.version import parse",
"import tkinter as tk",
"import qtpy",
"show_warning(\"Failed to import qtpy.\\n\""
] | 1 | 29 |
def check_qt():
"""Check Qt binding requirements"""
qt_infos = dict(
pyqt5=("PyQt5", "5.15"),
pyside2=("PySide2", "5.15"),
pyqt6=("PyQt6", "6.5"),
pyside6=("PySide6", "6.5")
)
try:
import qtpy
package_name, required_ver = qt_infos[qtpy.API]
actual... | requirements.py | spyder.spyder | false | true | [
"from packaging.version import parse",
"import tkinter as tk",
"import qtpy",
"show_warning(\"Failed to import qtpy.\\n\""
] | 32 | 59 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
r"""
Patching PIL (Python Imaging Library) to avoid triggering the error:
AccessInit: hash collision: 3 for both 1 and 1
This error is occurring because of a bug in ... | pil_patch.py | spyder.spyder | false | false | [
"This error is occurring because of a bug in the PIL import mechanism.",
">>> import Image",
">>> from PIL import Image",
">>> import scipy",
">>> from pylab import *",
">>> import Image",
">>> import PIL",
">>> from PIL import Image",
"from PIL import Image",
"import PIL",
"import Image",
"im... | 1 | 24 |
Another example on Windows (actually that's the same, but this is the exact
case encountered with Spyder when the global working directory is the
site-packages directory):
===============================================================================
C:\Python27\Lib\site-packages>python
Python 2.7.2 (default, Jun 12 2... | pil_patch.py | spyder.spyder | false | false | [
"This error is occurring because of a bug in the PIL import mechanism.",
">>> import Image",
">>> from PIL import Image",
">>> import scipy",
">>> from pylab import *",
">>> import Image",
">>> import PIL",
">>> from PIL import Image",
"from PIL import Image",
"import PIL",
"import Image",
"im... | 26 | 61 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder API Version.
The API version should be modified according to the following rules:
1. If a module/class/method/function is added, then the minor version
... | _version.py | spyder.spyder.api | false | false | [] | 1 | 26 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
spyder.api
==========
This package contains base classes, mixins and widgets that can be used
to create third-party plugins to extend Spyder.
This API should be... | __init__.py | spyder.spyder.api | false | false | [
"from ._version import __version__"
] | 1 | 18 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
API to create an entry in Spyder Preferences associated to a given plugin.
"""
# Standard library imports
import types
from typing import Set
# Local imports
fr... | preferences.py | spyder.spyder.api | false | false | [
"import types",
"from typing import Set",
"from spyder.config.manager import CONF",
"from spyder.config.types import ConfigurationKey",
"from spyder.api.utils import PrefixedTuple",
"from spyder.plugins.preferences.widgets.config_widgets import ("
] | 1 | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.