From ad19ac8046937c58f8f9ed71488741771f5a1897 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Thu, 4 Oct 2018 08:13:46 +0300 Subject: [PATCH 01/66] Block help, license and exit from shell. Fix #113 --- pythonturtle/turtleprocess.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pythonturtle/turtleprocess.py b/pythonturtle/turtleprocess.py index 242fb7e..c335454 100644 --- a/pythonturtle/turtleprocess.py +++ b/pythonturtle/turtleprocess.py @@ -7,6 +7,7 @@ import multiprocessing import sys import time +import builtins from . import shelltoprocess from .misc import smartsleep @@ -49,7 +50,10 @@ def send_report(self): # log(self.turtle.__dict__) def run(self): - + + builtins.help = builtins.license = builtins.exit = \ + lambda *args, **kwargs: print('Not supported') + self.turtle = Turtle() def go(distance): From 5bc33a0811dd1eb306306f2c1c96bdaa7ca77f59 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 2 Oct 2018 11:15:26 +0200 Subject: [PATCH 02/66] Use absolute import in __main__ for PyInstaller to work Add AppVeyor CI configuration (draft) --- appveyor.yml | 20 ++++++++++++++++++++ pythonturtle/__init__.py | 2 +- pythonturtle/__main__.py | 3 +++ pythonturtle/application.py | 2 +- setup.py | 2 +- 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..9f33343 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,20 @@ +--- +image: +- Visual Studio 2017 +- Ubuntu + +environment: + matrix: + - PYTHON: "C:\\Python36" + +install: +- "%PYTHON%\\python.exe -m pip install PyInstaller" + +build_script: +- "%PYTHON%\\python.exe -m PyInstaller --name PythonTurtle --onefile --windowed --icon pythonturtle\\resources\\icon.ico pythonturtle\\__main__.py" + +artifacts: +- path: dist + +on_success: +- dir dist diff --git a/pythonturtle/__init__.py b/pythonturtle/__init__.py index a3c697f..a245236 100644 --- a/pythonturtle/__init__.py +++ b/pythonturtle/__init__.py @@ -10,6 +10,6 @@ basics of Python programming. """ name = 'PythonTurtle' -__version__ = '0.3.0' +__version__ = '0.3.1' __license__ = 'MIT' __url__ = 'http://pythonturtle.org' diff --git a/pythonturtle/__main__.py b/pythonturtle/__main__.py index eeefeb5..ab2e067 100644 --- a/pythonturtle/__main__.py +++ b/pythonturtle/__main__.py @@ -1,5 +1,8 @@ """ Main entry point for executing the PythonTurtle application. + +We need an absolute import here for PyInstaller to work. +See https://github.com/pyinstaller/pyinstaller/issues/2560 """ from pythonturtle import application diff --git a/pythonturtle/application.py b/pythonturtle/application.py index 03b0e60..74f4066 100644 --- a/pythonturtle/application.py +++ b/pythonturtle/application.py @@ -220,6 +220,6 @@ def on_about(self, event=None): def run(): multiprocessing.freeze_support() app = wx.App() - ApplicationWindow(None, -1, "PythonTurtle", size=(600, 600)) + ApplicationWindow(None, -1, pythonturtle.name, size=(600, 600)) # import cProfile; cProfile.run("app.MainLoop()") app.MainLoop() diff --git a/setup.py b/setup.py index b1391e1..c8b3902 100755 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ def read_file(filename): tests_require=['tox'], entry_points={ 'console_scripts': [ - 'PythonTurtle = pythonturtle.__main__:run', + 'PythonTurtle = pythonturtle.__main__:application.run', ], }, ) From f8ff50947c4600a5917c6333e6eefe6a42e99d43 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Wed, 3 Oct 2018 09:50:23 +0200 Subject: [PATCH 03/66] Add clean and bundle commands to setup.py --- README.md | 6 ++++ setup.py | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- tox.ini | 6 ++-- 3 files changed, 91 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8364e41..d4ef1d0 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ cd PythonTurtle python3 -m pythonturtle ``` +Build application bundles like this: + +```bash +python3 setup.py clean bundle +``` + Please [open a pull request](https://github.com/cool-RR/PythonTurtle/pulls ) for contributions or bug fixes. If you can, please also add tests. diff --git a/setup.py b/setup.py index c8b3902..5bb8781 100755 --- a/setup.py +++ b/setup.py @@ -2,15 +2,89 @@ """ Packaging implementation for PythonTurtle. """ -from os.path import dirname, join +from glob import glob +import os +import os.path +import shutil + +from setuptools.command.test import test from setuptools import setup, find_packages import pythonturtle as package +class Bundle(test): + """A setuptools command to build application bundles for all platforms""" + + def run(self): + import PyInstaller.__main__ + + resources_folder = os.path.join('pythonturtle', 'resources') + + def resource_path(file_glob): + return os.path.join(resources_folder, file_glob) + + def include_resources(file_glob): + return '{src}{separator}{dest}'.format( + src=resource_path(file_glob), + separator=os.pathsep, + dest=resources_folder) + + PyInstaller.__main__.run([ + '--name=%s' % package.name, + '--onefile', + '--windowed', + '--add-binary=%s' % include_resources('*.ic*'), + '--add-binary=%s' % include_resources('*.png'), + '--add-data=%s' % include_resources('*.txt'), + '--icon=%s' % resource_path('icon.ico'), + os.path.join('pythonturtle', '__main__.py'), + ]) + + +class Clean(test): + """A setuptools command to remove build files and folders""" + + def run(self): + delete_in_root = [ + 'build', + 'dist', + '.eggs', + '*.egg-info', + '.pytest_cache', + '*.spec', + '.tox', + ] + delete_everywhere = [ + '*.pyc', + '__pycache__', + ] + for candidate in delete_in_root: + rmtree_glob(candidate) + for visible_dir in glob('[A-Za-z0-9_]*'): + for candidate in delete_everywhere: + rmtree_glob(os.path.join(visible_dir, candidate)) + rmtree_glob(os.path.join(visible_dir, '*', candidate)) + rmtree_glob(os.path.join(visible_dir, '*', '*', candidate)) + + +def rmtree_glob(file_glob): + """Platform independent rmtree, which also allows wildcards (globbing)""" + for item in glob(file_glob): + try: + shutil.rmtree(item) + print('%s/ removed ...' % item) + except OSError: + try: + os.remove(item) + print('%s removed ...' % item) + except OSError as err: + print(err) + + def read_file(filename): """Source the contents of a file""" - with open(join(dirname(__file__), filename)) as file: + with open(os.path.join(os.path.dirname(__file__), filename)) as file: return file.read() @@ -49,6 +123,11 @@ def read_file(filename): zip_safe=True, # install_requires=['wxPython'], tests_require=['tox'], + test_suite='tests', + cmdclass={ + 'bundle': Bundle, + 'clean': Clean, + }, entry_points={ 'console_scripts': [ 'PythonTurtle = pythonturtle.__main__:application.run', diff --git a/tox.ini b/tox.ini index 83770a8..0a3605c 100644 --- a/tox.ini +++ b/tox.ini @@ -27,10 +27,12 @@ commands = flake8 {posargs} [testenv:pylint] basepython = python3.6 -deps = pylint +deps = + pyinstaller + pylint commands = pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython - pylint --rcfile tox.ini {posargs:pythonturtle} + pylint --rcfile tox.ini {posargs:pythonturtle setup} [behave] # default_format = progress From b1bbe23e4829596ce3d3dc8840cdc9478a4c240b Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Wed, 3 Oct 2018 15:17:06 +0200 Subject: [PATCH 04/66] Build Linux bundle w/ Travis, Windows bundle w/ AppVeyor, add badge --- .travis.yml | 13 ++++++++++++- README.md | 7 ++++--- appveyor.yml | 6 ++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4cfb2b8..3272222 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,8 @@ jobs: - { stage: lint, python: 3.6, env: TOXENV=flake8 } - { stage: lint, python: 3.6, env: TOXENV=pylint } - - stage: publish + - name: PyPI + stage: publish deploy: provider: pypi user: coolRR @@ -36,3 +37,13 @@ jobs: script: skip on: tags: true + + - name: Linux bundle + stage: publish + install: + - pip install PyInstaller + - pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + script: + - ./setup.py clean bundle + on: + tags: true diff --git a/README.md b/README.md index d4ef1d0..7ded975 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ Python Turtle ============= -[![Build Status](https://img.shields.io/travis/cool-RR/PythonTurtle/master.svg)](https://travis-ci.org/cool-RR/PythonTurtle +[![Travis CI](https://img.shields.io/travis/cool-RR/PythonTurtle/master.svg)](https://travis-ci.org/cool-RR/PythonTurtle +) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle.svg)](https://ci.appveyor.com/project/cool-RR/PythonTurtle ) [![GitHub issues](https://img.shields.io/github/issues-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/issues ) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/pulls -) [![Python Versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ -) [![MIT License](https://img.shields.io/github/license/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/blob/master/LICENSE) +) [![Python versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ +) [![MIT license](https://img.shields.io/github/license/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/blob/master/LICENSE) An educational environment for learning Python, suitable for beginners and children. Inspired by LOGO. diff --git a/appveyor.yml b/appveyor.yml index 9f33343..fb409fa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,10 +8,12 @@ environment: - PYTHON: "C:\\Python36" install: -- "%PYTHON%\\python.exe -m pip install PyInstaller" +- "%PYTHON%\\python.exe -m pip install PyInstaller wxPython" + +build: off build_script: -- "%PYTHON%\\python.exe -m PyInstaller --name PythonTurtle --onefile --windowed --icon pythonturtle\\resources\\icon.ico pythonturtle\\__main__.py" +- "%PYTHON%\\python.exe setup.py clean bundle" artifacts: - path: dist From bf00d934af1f7d57c638db72bf8c873c786c6a2e Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Wed, 3 Oct 2018 16:16:12 +0200 Subject: [PATCH 05/66] Release Linux bundle on GitHub --- .travis.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3272222..449f368 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,24 +26,33 @@ jobs: - { stage: lint, python: 3.6, env: TOXENV=flake8 } - { stage: lint, python: 3.6, env: TOXENV=pylint } - - name: PyPI + - name: PyPI package stage: publish + python: 3.6 + install: skip + script: skip deploy: provider: pypi user: coolRR password: secure: fdbhH+rsqfG9WfILlBZXlNNSXZVHrfBH9zWa7kKiUY55GMYKli+u/MzG1i6Ezn53Vg1wL1NTQMm5rFbbUfBE2l5/+S191saBZGApEhQZhulSkG702FCbpuGs1a26Zm+dhjyiRvuNdnPB8BA61uHSpWFzDgpLurGsZB0TyB2hZqv7LFL1eG56mKh70LTIDO5XmDh5/yDEXfc23M2nS7Zwx2xJEM047Fay/yeZSjo+LEYgCoTM/z9TftyxkyuLOGsiRoBMwL7eb7wKJzk79vSAvgZP/fSuAqc8ut1lrk1S9OIO4I9s7Zpi1QneJSGDJu4IHfV3nlge/+tlN8aeLA6GsSy/RrrzueBdtYTpbt34vO5rVfhJwjHIKTQa4GUF0R6gCiQ0JjJiXLC+UAbePZxzAKQWaxJWWpqq8L9e+LlHWpEtuB4jEqncFs6FeTT7mTWz2HMTQvvIVAsI2xFkItY4yCpE3P5+5f6UgqwqFpuKCXWF6ohQ090wTlNxN5cikNSYdPPQj7hypKzWrYcH5z4Z4pU63mnO2fZgTEZomvYKXa9mcdtZcCBhPNJW9WTgxqKSouPcjYc4me9wk4wv4ncJaCPLlxbuW7T/Nv+Xy/HYn7eljRapnu7/XcVQgB6gG4vxbRkkLkr1Ybj0xcR2neAQcxhBBqzfCyQezh210dPGqF8= - install: skip - script: skip - on: - tags: true + distributions: 'sdist bdist_wheel' + skip_cleanup: true + on: + tags: true - name: Linux bundle stage: publish + python: 3.6 install: - pip install PyInstaller - pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython script: - ./setup.py clean bundle - on: - tags: true + deploy: + provider: releases + api_key: "GITHUB OAUTH TOKEN" + file: dist/PythonTurtle + skip_cleanup: true + on: + tags: true From 9191e4fc1cd043bb8c7df92584d53a92176842ab Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 00:50:20 +0200 Subject: [PATCH 06/66] Build macOS bundle on Travis --- .travis.yml | 18 ++++++++++++++++++ appveyor.yml | 4 +--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 449f368..719e9d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,3 +56,21 @@ jobs: skip_cleanup: true on: tags: true + + - name: macOS bundle + stage: publish + os: osx + language: generic + install: + - python3 --version + - python3 -m pip install --upgrade pip + - python3 -m pip install PyInstaller wxPython + script: + - ./setup.py clean bundle + deploy: + provider: releases + api_key: "GITHUB OAUTH TOKEN" + file: dist/PythonTurtle + skip_cleanup: true + on: + tags: true diff --git a/appveyor.yml b/appveyor.yml index fb409fa..306dfd6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,5 @@ --- -image: -- Visual Studio 2017 -- Ubuntu +image: Visual Studio 2017 environment: matrix: From d61578c3906849fd6b00039fb06ca9ea5493ce58 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 12:16:57 +0200 Subject: [PATCH 07/66] Use proper base class for setuptools commands Fix Pylint and flake8 issues introduced w/ commit ad19ac8 --- pythonturtle/turtleprocess.py | 6 +++--- setup.py | 29 ++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/pythonturtle/turtleprocess.py b/pythonturtle/turtleprocess.py index c335454..a816f86 100644 --- a/pythonturtle/turtleprocess.py +++ b/pythonturtle/turtleprocess.py @@ -50,10 +50,10 @@ def send_report(self): # log(self.turtle.__dict__) def run(self): - + builtins.help = builtins.license = builtins.exit = \ - lambda *args, **kwargs: print('Not supported') - + lambda *args, **kwargs: print('Not supported') + self.turtle = Turtle() def go(distance): diff --git a/setup.py b/setup.py index 5bb8781..05d2446 100755 --- a/setup.py +++ b/setup.py @@ -7,16 +7,29 @@ import os.path import shutil -from setuptools.command.test import test +from setuptools import Command from setuptools import setup, find_packages import pythonturtle as package -class Bundle(test): - """A setuptools command to build application bundles for all platforms""" +class SimpleCommand(Command): + """A simple setuptools command (implementation of abstract base class)""" + user_options = [] - def run(self): + def initialize_options(self): + pass + + def finalize_options(self): + pass + + +class Bundle(SimpleCommand): + """Build an application bundle for the current platform""" + description = __doc__ + + @staticmethod + def run(): import PyInstaller.__main__ resources_folder = os.path.join('pythonturtle', 'resources') @@ -42,10 +55,12 @@ def include_resources(file_glob): ]) -class Clean(test): - """A setuptools command to remove build files and folders""" +class Clean(SimpleCommand): + """Remove build files and folders, including Python byte-code""" + description = __doc__ - def run(self): + @staticmethod + def run(): delete_in_root = [ 'build', 'dist', From 11f98f4a9aa0168678e4c852bf9827130aa4158f Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 13:08:32 +0200 Subject: [PATCH 08/66] Add Shippable CI config for Windows builds --- README.md | 3 ++- shippable.yml | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 shippable.yml diff --git a/README.md b/README.md index 7ded975..dd15850 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ Python Turtle ============= [![Travis CI](https://img.shields.io/travis/cool-RR/PythonTurtle/master.svg)](https://travis-ci.org/cool-RR/PythonTurtle -) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle.svg)](https://ci.appveyor.com/project/cool-RR/PythonTurtle +) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle/master.svg)](https://ci.appveyor.com/project/cool-RR/PythonTurtle +) [![Shippable](https://img.shields.io/shippable/5bb5a1f6d8769507003ac8c7/master.svg)](https://app.shippable.com/github/cool-RR/PythonTurtle/dashboard ) [![GitHub issues](https://img.shields.io/github/issues-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/issues ) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/pulls ) [![Python versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ diff --git a/shippable.yml b/shippable.yml new file mode 100644 index 0000000..aa797d6 --- /dev/null +++ b/shippable.yml @@ -0,0 +1,21 @@ +--- +language: python +python: 3.6 + +jobs: +- name: Build on Windows + type: runSh + runtime: + nodePool: custom__x86_64__WindowsServer_2016 + steps: + - TASK: + name: Windows EXE file + runtime: + options: + imageName: microsoft/windowsservercore + imageTag: 10.0.14393.1884 + script: + - python3 --version + - python3 -m pip install PyInstaller wxPython + - python3 setup.py clean bundle + - dir dist From 56d450def118813b51e16fa225c6905b4ee746ce Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 13:43:12 +0200 Subject: [PATCH 09/66] Use CI config provided by Shippable support --- shippable.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/shippable.yml b/shippable.yml index aa797d6..f479a46 100644 --- a/shippable.yml +++ b/shippable.yml @@ -2,19 +2,27 @@ language: python python: 3.6 +resources: +- name: pythonturtle_repo + type: gitRepo + integration: github + pointer: + sourceName: cool-RR/PythonTurtle + jobs: -- name: Build on Windows +- name: Windows build type: runSh + allowPublicAccess: true runtime: - nodePool: custom__x86_64__WindowsServer_2016 + nodePool: dyn_win16 steps: + - IN: pythonturtle_repo - TASK: name: Windows EXE file - runtime: - options: - imageName: microsoft/windowsservercore - imageTag: 10.0.14393.1884 script: + - systeminfo + - Get-Process + - pushd $(shipctl get_resource_state "pythonturtle_repo") - python3 --version - python3 -m pip install PyInstaller wxPython - python3 setup.py clean bundle From a919b5e0fd844980fcfdf9246bb63238bf9e2360 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Sep 2018 17:51:09 +0200 Subject: [PATCH 10/66] Migrate tests to pytest --- .gitignore | 1 + tests/unit/test_import.py | 57 +++++++++++++++++++++++++++++++++++++++ tox.ini | 4 +-- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 tests/unit/test_import.py diff --git a/.gitignore b/.gitignore index 2120f2d..0d3ca64 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__/ *.wpu # testing artifacts +/.pytest_cache/ /.tox/ /tests/reports/ diff --git a/tests/unit/test_import.py b/tests/unit/test_import.py new file mode 100644 index 0000000..b98d3dd --- /dev/null +++ b/tests/unit/test_import.py @@ -0,0 +1,57 @@ +""" +Tests for application. +""" + + +def test_import_turtle(): + """ + Try to import PythonTurtle module and perform some stupid verifications. + """ + import pythonturtle + assert pythonturtle.__version__ is not None + + from pythonturtle import application + assert application is not None + + from pythonturtle import helppages + assert helppages is not None + + from pythonturtle import my_turtle + assert my_turtle is not None + + from pythonturtle import turtleprocess + assert turtleprocess is not None + + from pythonturtle import turtlewidget + assert turtlewidget is not None + + +def test_import_misc(): + """ + Try to import the misc submodule and perform some stupid verifications. + """ + from pythonturtle.misc import helpers + assert helpers is not None + + from pythonturtle.misc import smartsleep + assert smartsleep is not None + + from pythonturtle.misc import vector + assert vector is not None + + +def test_import_shelltoprocess(): + """ + Try to import the misc submodule and perform some stupid verifications. + """ + from pythonturtle import shelltoprocess + assert shelltoprocess is not None + + from pythonturtle.shelltoprocess import console + assert console is not None + + from pythonturtle.shelltoprocess import forkedpyshell + assert forkedpyshell is not None + + from pythonturtle.shelltoprocess import shell + assert shell is not None diff --git a/tox.ini b/tox.ini index 0a3605c..fdfea7a 100644 --- a/tox.ini +++ b/tox.ini @@ -15,10 +15,10 @@ envlist = py37 [testenv] -deps = behave +deps = pytest commands = pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython - behave + pytest [testenv:flake8] basepython = python3.6 From aa596dd7a8f590f661372feb333c8d032df2594a Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Sep 2018 18:14:57 +0200 Subject: [PATCH 11/66] Run tests with site-packages --- tox.ini | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index fdfea7a..15a2667 100644 --- a/tox.ini +++ b/tox.ini @@ -16,9 +16,8 @@ envlist = [testenv] deps = pytest -commands = - pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython - pytest +commands = pytest +sitepackages = true [testenv:flake8] basepython = python3.6 From 840e4513cd29dd48df8fe94c19b5d4a88f4fa9e4 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 19:29:28 +0200 Subject: [PATCH 12/66] Run all commands w/ test env's interpreter explicitly Install pre-requisites for wxPython (on Xenial) --- .travis.yml | 1 + tox.ini | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 719e9d8..af90310 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ python: install: - pip install tox-travis +- sudo apt-get install libsdl-ttf2.0-0 script: - tox diff --git a/tox.ini b/tox.ini index 15a2667..cd37764 100644 --- a/tox.ini +++ b/tox.ini @@ -15,14 +15,18 @@ envlist = py37 [testenv] -deps = pytest -commands = pytest -sitepackages = true +deps = + pytest +commands = + {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + {envpython} -m pytest [testenv:flake8] basepython = python3.6 -deps = flake8 -commands = flake8 {posargs} +deps = + flake8 +commands = + {envpython} -m flake8 {posargs} [testenv:pylint] basepython = python3.6 @@ -30,8 +34,8 @@ deps = pyinstaller pylint commands = - pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython - pylint --rcfile tox.ini {posargs:pythonturtle setup} + {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + {envpython} -m pylint --rcfile tox.ini {posargs:pythonturtle setup} [behave] # default_format = progress From 119bd8240ff63181ed3e3b538dcdea9fd78277b2 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 20:16:08 +0200 Subject: [PATCH 13/66] Remove Gherkin/BDD tests (powered by behave) Make pytest output more varbose --- .../features/module-imports.feature | 9 --------- tests/acceptance/steps/given.py | 12 ----------- tests/acceptance/steps/then.py | 20 ------------------- tests/acceptance/steps/when.py | 20 ------------------- tox.ini | 11 +++------- 5 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 tests/acceptance/features/module-imports.feature delete mode 100644 tests/acceptance/steps/given.py delete mode 100644 tests/acceptance/steps/then.py delete mode 100644 tests/acceptance/steps/when.py diff --git a/tests/acceptance/features/module-imports.feature b/tests/acceptance/features/module-imports.feature deleted file mode 100644 index c5e172b..0000000 --- a/tests/acceptance/features/module-imports.feature +++ /dev/null @@ -1,9 +0,0 @@ -Feature: Basic verification of Python version support - As a PythonTurtle developer - I want Python to import modules successfully - So that I can prove that the program would start up - - Scenario: Try to import major modules - Given PythonTurtle is installed - When I import major modules - Then the modules loaded correctly diff --git a/tests/acceptance/steps/given.py b/tests/acceptance/steps/given.py deleted file mode 100644 index 26ade46..0000000 --- a/tests/acceptance/steps/given.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -'Given' step implementations for acceptance tests. Powered by behave. -""" -from behave import given - - -@given(u'PythonTurtle is installed') -def step_impl(context): - """ - Running the test with Tox this should be taken for granted - """ - pass diff --git a/tests/acceptance/steps/then.py b/tests/acceptance/steps/then.py deleted file mode 100644 index 5efd016..0000000 --- a/tests/acceptance/steps/then.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -'Then' step implementations for acceptance tests. Powered by behave. -""" -from behave import then - - -@then(u'the modules loaded correctly') -def step_impl(context): - """ - Do some ultra-basic verifications - """ - [ - pythonturtle, - pythonturtle_misc, - pythonturtle_shelltoprocess - ] = context.imported_modules - - assert pythonturtle.__version__ is not None - assert pythonturtle_misc is not None - assert pythonturtle_shelltoprocess is not None diff --git a/tests/acceptance/steps/when.py b/tests/acceptance/steps/when.py deleted file mode 100644 index d94380a..0000000 --- a/tests/acceptance/steps/when.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -'When' step implementations for acceptance tests. Powered by behave. -""" -from behave import when - - -@when(u'I import major modules') -def step_impl(context): - """ - Try to import PythonTurtle module - """ - import pythonturtle - import pythonturtle.misc - import pythonturtle.shelltoprocess - - context.imported_modules = [ - pythonturtle, - pythonturtle.misc, - pythonturtle.shelltoprocess, - ] diff --git a/tox.ini b/tox.ini index cd37764..65e3065 100644 --- a/tox.ini +++ b/tox.ini @@ -37,14 +37,6 @@ commands = {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython {envpython} -m pylint --rcfile tox.ini {posargs:pythonturtle setup} -[behave] -# default_format = progress -junit = yes -junit_directory = tests/reports -paths = tests/acceptance -show_skipped = no -summary = no - [flake8] exclude = .cache @@ -56,3 +48,6 @@ exclude = [pylint] disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument reports = no + +[pytest] +addopts = --junitxml=tests/reports/unittests.xml --strict --verbose From dd361b5f7357dfbe7a5986e1afcbdfae2f14823b Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 4 Oct 2018 20:23:33 +0200 Subject: [PATCH 14/66] Use recursive glob() available in Python 3.5+ --- setup.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 05d2446..7dd979c 100755 --- a/setup.py +++ b/setup.py @@ -78,21 +78,19 @@ def run(): rmtree_glob(candidate) for visible_dir in glob('[A-Za-z0-9_]*'): for candidate in delete_everywhere: - rmtree_glob(os.path.join(visible_dir, candidate)) - rmtree_glob(os.path.join(visible_dir, '*', candidate)) - rmtree_glob(os.path.join(visible_dir, '*', '*', candidate)) + rmtree_glob(os.path.join(visible_dir, '**', candidate)) def rmtree_glob(file_glob): """Platform independent rmtree, which also allows wildcards (globbing)""" - for item in glob(file_glob): + for item in glob(file_glob, recursive=True): try: - shutil.rmtree(item) - print('%s/ removed ...' % item) + os.remove(item) + print('%s removed ...' % item) except OSError: try: - os.remove(item) - print('%s removed ...' % item) + shutil.rmtree(item) + print('%s/ removed ...' % item) except OSError as err: print(err) From 3cf6c9a7aaa4bddaa22791d71ae01e3979e2fff8 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 5 Oct 2018 00:11:09 +0300 Subject: [PATCH 15/66] Fix #124 --- pythonturtle/shelltoprocess/forkedpyshell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonturtle/shelltoprocess/forkedpyshell.py b/pythonturtle/shelltoprocess/forkedpyshell.py index 81a2756..36fb94d 100644 --- a/pythonturtle/shelltoprocess/forkedpyshell.py +++ b/pythonturtle/shelltoprocess/forkedpyshell.py @@ -774,7 +774,7 @@ def OnShowCompHistory(self): joined = " ".join(his) # sort out only "good" words - newlist = re.split("[ \.\[\]=}(\)\,0-9\"]", joined) + newlist = re.split(r'[ \.\[\]=}(\)\,0-9"]', joined) # length > 1 (mix out "trash") thlist = [] From a32c09d4972a3c4f8a1c1e247fe7337f6874a20a Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Fri, 5 Oct 2018 01:41:51 +0200 Subject: [PATCH 16/66] Run tests on Windows before building EXE Install Python modules missing for Windows build --- appveyor.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 306dfd6..bb65ad7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,18 +3,26 @@ image: Visual Studio 2017 environment: matrix: - - PYTHON: "C:\\Python36" + - PYTHON: C:\Python36 + +build: off install: -- "%PYTHON%\\python.exe -m pip install PyInstaller wxPython" +- set PATH=C:\Python36\Scripts;%PATH% +- '%PYTHON%\python.exe -m pip install PyInstaller wxPython pypiwin32' -build: off +before_test: +- '%PYTHON%\python.exe -m pip install tox' + +test_script: +- '%PYTHON%\python.exe -m tox -e flake8' +- '%PYTHON%\python.exe -m tox -e py36' -build_script: -- "%PYTHON%\\python.exe setup.py clean bundle" +after_test: +- '%PYTHON%\python.exe setup.py clean bundle' artifacts: -- path: dist +- path: dist\PythonTurtle.exe on_success: - dir dist From 448b53247c55ff8fc0b0948bcb921440114afbfd Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Fri, 5 Oct 2018 03:04:01 +0200 Subject: [PATCH 17/66] Run tests on macOS before building app bundle --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index af90310..4144bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,9 @@ python: install: - pip install tox-travis -- sudo apt-get install libsdl-ttf2.0-0 +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + sudo apt-get install libsdl-ttf2.0-0 + ; fi script: - tox @@ -22,10 +24,12 @@ jobs: allow_failures: - env: TOXENV=pylint - python: 3.7 + - { os: osx, stage: publish } include: - { stage: lint, python: 3.6, env: TOXENV=flake8 } - { stage: lint, python: 3.6, env: TOXENV=pylint } + - { stage: test, os: osx, language: generic, env: TOXENV=py36 } - name: PyPI package stage: publish From 66d12e891ddf72d4929713f702b94fc976ef423f Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 10:58:11 +0300 Subject: [PATCH 18/66] Fix #128, lint issues --- pythonturtle/misc/vector.py | 5 --- pythonturtle/shelltoprocess/console.py | 18 +++++----- pythonturtle/turtleprocess.py | 46 ++++++++++++-------------- tox.ini | 2 +- 4 files changed, 30 insertions(+), 41 deletions(-) diff --git a/pythonturtle/misc/vector.py b/pythonturtle/misc/vector.py index d094336..e7444a8 100644 --- a/pythonturtle/misc/vector.py +++ b/pythonturtle/misc/vector.py @@ -63,11 +63,6 @@ def __and__(self, other): if not isinstance(other, Vector): raise VectorError("trying to do dot product of Vector " "with non-Vector") - """ - if self.dim()!=other.dim(): - raise("trying to do dot product of Vectors of unequal " - "dimension!") - """ d = self.dim() s = 0. for i in range(d): diff --git a/pythonturtle/shelltoprocess/console.py b/pythonturtle/shelltoprocess/console.py index cb5ac29..5cea073 100644 --- a/pythonturtle/shelltoprocess/console.py +++ b/pythonturtle/shelltoprocess/console.py @@ -118,16 +118,14 @@ def interact(self, banner=None): sys.ps2 except AttributeError: sys.ps2 = "... " - """ - cprt = 'Type "help", "copyright", "credits" or "license" ' \ - 'for more information.' - if banner is None: - self.write("Python %s on %s\n%s\n(%s)\n" % - (sys.version, sys.platform, cprt, - self.__class__.__name__)) - else: - self.write("%s\n" % str(banner)) - """ + # cprt = 'Type "help", "copyright", "credits" or "license" ' \ + # 'for more information.' + # if banner is None: + # self.write("Python %s on %s\n%s\n(%s)\n" % + # (sys.version, sys.platform, cprt, + # self.__class__.__name__)) + # else: + # self.write("%s\n" % str(banner)) more = 0 while True: try: diff --git a/pythonturtle/turtleprocess.py b/pythonturtle/turtleprocess.py index a816f86..107b68a 100644 --- a/pythonturtle/turtleprocess.py +++ b/pythonturtle/turtleprocess.py @@ -198,23 +198,21 @@ def clear(): self.turtle.clear = False self.send_report() - """ - Had trouble implementing `home`. - I couldn't control when the turtle would actually draw a line home. - - def home(): - #\""" - Places the turtle at the center of the screen, facing upwards. - #\""" - old_pen_down = self.turtle.pen_down - pen_up() # Sends a report as well - self.send_report() - self.turtle.pos = Vector((0, 0)) - self.turtle.orientation = 180 - self.send_report() - time.sleep(3) - pen_down(old_pen_down) - """ + # Had trouble implementing `home`. + # I couldn't control when the turtle would actually draw a line home. + + # def home(): + # #\""" + # Places the turtle at the center of the screen, facing upwards. + # #\""" + # old_pen_down = self.turtle.pen_down + # pen_up() # Sends a report as well + # self.send_report() + # self.turtle.pos = Vector((0, 0)) + # self.turtle.orientation = 180 + # self.send_report() + # time.sleep(3) + # pen_down(old_pen_down) def reset(): """ @@ -241,14 +239,12 @@ def reset(): "reset": reset, } - """ - A little thing I tried doing for checking if a color is - valid before setting it to the turtle. Didn't work. - import wx; app=wx.App(); - def valid_color(color): - return not wx.Pen(color).GetColour() == \ - wx.Pen("malformed").GetColour() - """ + # A little thing I tried doing for checking if a color is + # valid before setting it to the turtle. Didn't work. + # import wx; app=wx.App(); + # def valid_color(color): + # return not wx.Pen(color).GetColour() == \ + # wx.Pen("malformed").GetColour() self.console = shelltoprocess.Console(queue_pack=self.queue_pack, locals=locals_for_console) diff --git a/tox.ini b/tox.ini index 65e3065..632b4db 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,7 @@ exclude = dist [pylint] -disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument +disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument,fixme,no-self-use,arguments-differ reports = no [pytest] From e895fc4cf1ba8a95c6e45595cb9b792f5ece7950 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 12:05:30 +0300 Subject: [PATCH 19/66] Add excludes to Wing project --- pythonturtle.wpr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pythonturtle.wpr b/pythonturtle.wpr index c7eb7eb..e60ea14 100644 --- a/pythonturtle.wpr +++ b/pythonturtle.wpr @@ -5,8 +5,9 @@ ################################################################## [project attributes] proj.directory-list = [{'dirloc': loc('.'), - 'excludes': (), - 'filter': u'*', + 'excludes': [u'PythonTurtle.egg-info', + u'.tox'], + 'filter': '*', 'include_hidden': False, 'recursive': True, 'watch_for_changes': True}] From feab9bba7d994db9ca31b3175e57fe3d11e60347 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 12:07:04 +0300 Subject: [PATCH 20/66] Normalize comment style --- pythonturtle/shelltoprocess/console.py | 10 +++++----- pythonturtle/turtleprocess.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pythonturtle/shelltoprocess/console.py b/pythonturtle/shelltoprocess/console.py index 5cea073..d05c819 100644 --- a/pythonturtle/shelltoprocess/console.py +++ b/pythonturtle/shelltoprocess/console.py @@ -119,13 +119,13 @@ def interact(self, banner=None): except AttributeError: sys.ps2 = "... " # cprt = 'Type "help", "copyright", "credits" or "license" ' \ - # 'for more information.' + # 'for more information.' # if banner is None: - # self.write("Python %s on %s\n%s\n(%s)\n" % - # (sys.version, sys.platform, cprt, - # self.__class__.__name__)) + # self.write("Python %s on %s\n%s\n(%s)\n" % + # (sys.version, sys.platform, cprt, + # self.__class__.__name__)) # else: - # self.write("%s\n" % str(banner)) + # self.write("%s\n" % str(banner)) more = 0 while True: try: diff --git a/pythonturtle/turtleprocess.py b/pythonturtle/turtleprocess.py index 107b68a..91a8f70 100644 --- a/pythonturtle/turtleprocess.py +++ b/pythonturtle/turtleprocess.py @@ -243,8 +243,8 @@ def reset(): # valid before setting it to the turtle. Didn't work. # import wx; app=wx.App(); # def valid_color(color): - # return not wx.Pen(color).GetColour() == \ - # wx.Pen("malformed").GetColour() + # return not wx.Pen(color).GetColour() == \ + # wx.Pen("malformed").GetColour() self.console = shelltoprocess.Console(queue_pack=self.queue_pack, locals=locals_for_console) From 14e11294620b5cc05b6f7b33cabd357cfd6dad59 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 12:34:28 +0300 Subject: [PATCH 21/66] Get ready for enforcing Pylint and flake --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4144bf5..1c4dffb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ stages: jobs: allow_failures: - - env: TOXENV=pylint - python: 3.7 - { os: osx, stage: publish } From 3601f3b8294ba3ba4e8e4e4e5011fbd1ed46c394 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 12:36:09 +0300 Subject: [PATCH 22/66] Test commit --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 632b4db..dda48a6 100644 --- a/tox.ini +++ b/tox.ini @@ -51,3 +51,4 @@ reports = no [pytest] addopts = --junitxml=tests/reports/unittests.xml --strict --verbose + \ No newline at end of file From 129d311313ba056410dc950b9923eff692ef708a Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 12:37:02 +0300 Subject: [PATCH 23/66] Test commit 2 --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index dda48a6..63890c2 100644 --- a/tox.ini +++ b/tox.ini @@ -50,5 +50,4 @@ disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-membe reports = no [pytest] -addopts = --junitxml=tests/reports/unittests.xml --strict --verbose - \ No newline at end of file +addopts = --junitxml=tests/reports/unittests.xml --strict --verbose \ No newline at end of file From 200f94f125cce750a0c29e18f702fb34572cf59a Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Oct 2018 12:37:28 +0300 Subject: [PATCH 24/66] Test commit 3 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 63890c2..632b4db 100644 --- a/tox.ini +++ b/tox.ini @@ -50,4 +50,4 @@ disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-membe reports = no [pytest] -addopts = --junitxml=tests/reports/unittests.xml --strict --verbose \ No newline at end of file +addopts = --junitxml=tests/reports/unittests.xml --strict --verbose From 9fb6b349a0f2a7a881b8e59699326a15b0e5a14f Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 7 Oct 2018 00:07:40 +0200 Subject: [PATCH 25/66] Add Gitter badge to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd15850..fa5ab98 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ Python Turtle ) [![GitHub issues](https://img.shields.io/github/issues-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/issues ) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/pulls ) [![Python versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ -) [![MIT license](https://img.shields.io/github/license/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/blob/master/LICENSE) +) [![MIT license](https://img.shields.io/github/license/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/blob/master/LICENSE +) [![Gitter](https://img.shields.io/gitter/room/PythonTurtle/Lobby.svg)](https://gitter.im/PythonTurtle/Lobby) An educational environment for learning Python, suitable for beginners and children. Inspired by LOGO. From 30f12f6b76fc2adffdd767c2c90104dc9f62b5d0 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 7 Oct 2018 01:12:29 +0200 Subject: [PATCH 26/66] Fix no-self-use Pylint warning (instead of disabling it) --- pythonturtle/misc/vector.py | 3 ++- pythonturtle/shelltoprocess/console.py | 3 ++- tox.ini | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pythonturtle/misc/vector.py b/pythonturtle/misc/vector.py index e7444a8..c21863e 100644 --- a/pythonturtle/misc/vector.py +++ b/pythonturtle/misc/vector.py @@ -51,7 +51,8 @@ def __truediv__(self, other): raise VectorError("right hand side is illegal") return Vector(map(lambda x: x / other, self)) - def __rdiv__(self, other): + @staticmethod + def __rdiv__(other): raise VectorError("you sick pervert! " "you tried to divide something by a vector!") diff --git a/pythonturtle/shelltoprocess/console.py b/pythonturtle/shelltoprocess/console.py index d05c819..1cf38e6 100644 --- a/pythonturtle/shelltoprocess/console.py +++ b/pythonturtle/shelltoprocess/console.py @@ -42,7 +42,8 @@ def write(self, output): # self.log(output) return self.writefunc(output) - def log(self, output): + @staticmethod + def log(output): print(output) sys.stdout.flush() diff --git a/tox.ini b/tox.ini index 632b4db..5411e8a 100644 --- a/tox.ini +++ b/tox.ini @@ -46,7 +46,7 @@ exclude = dist [pylint] -disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument,fixme,no-self-use,arguments-differ +disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument,fixme,arguments-differ reports = no [pytest] From e55ce4b293e704d42fd9f540b1f350a555f227a0 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 7 Oct 2018 02:22:42 +0200 Subject: [PATCH 27/66] Remove some offensive wording, fix a few Pylint complaints --- pythonturtle/misc/helpers.py | 4 ++-- pythonturtle/misc/smartsleep.py | 1 + pythonturtle/misc/vector.py | 29 ++++++++++++++--------------- setup.py | 10 ++++++++-- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/pythonturtle/misc/helpers.py b/pythonturtle/misc/helpers.py index 607f7ab..47bad91 100644 --- a/pythonturtle/misc/helpers.py +++ b/pythonturtle/misc/helpers.py @@ -52,7 +52,7 @@ def resource_string(filename): return text.decode() -def log(x): +def log(message): """A very simple logging function""" - print(x) + print(message) sys.stdout.flush() diff --git a/pythonturtle/misc/smartsleep.py b/pythonturtle/misc/smartsleep.py index 3cdb430..3437bf4 100644 --- a/pythonturtle/misc/smartsleep.py +++ b/pythonturtle/misc/smartsleep.py @@ -20,6 +20,7 @@ class Sleeper: def __init__(self, interval): self.interval = interval + self.starting_time = None def __enter__(self, *args, **kwargs): self.starting_time = time.time() diff --git a/pythonturtle/misc/vector.py b/pythonturtle/misc/vector.py index c21863e..dedf8cc 100644 --- a/pythonturtle/misc/vector.py +++ b/pythonturtle/misc/vector.py @@ -52,23 +52,22 @@ def __truediv__(self, other): return Vector(map(lambda x: x / other, self)) @staticmethod - def __rdiv__(other): - raise VectorError("you sick pervert! " - "you tried to divide something by a vector!") + def __rdiv__(): + raise VectorError("you can't divide something by a vector") def __and__(self, other): """ this is a dot product, done like this: a&b - must use () around it because of fucked up operator precedence. + must use () around it because of broken operator precedence. """ if not isinstance(other, Vector): - raise VectorError("trying to do dot product of Vector " - "with non-Vector") - d = self.dim() - s = 0. - for i in range(d): - s += self[i] * other[i] - return s + raise VectorError("you can't do dot product of Vector with a " + "non-Vector") + dimension = self.dim() + size = 0. + for i in range(dimension): + size += self[i] * other[i] + return size def __rand__(self, other): return self & other @@ -133,15 +132,15 @@ def copy(self): return Vector(self) -def zeros(n): +def zeros(length): """ Returns a zero Vector of length n. """ - return Vector(map(lambda x: 0., range(n))) + return Vector(map(lambda x: 0., range(length))) -def ones(n): +def ones(length): """ Returns a Vector of length n with all ones. """ - return Vector(map(lambda x: 1., range(n))) + return Vector(map(lambda x: 1., range(length))) diff --git a/setup.py b/setup.py index 7dd979c..d35f64b 100755 --- a/setup.py +++ b/setup.py @@ -18,10 +18,10 @@ class SimpleCommand(Command): user_options = [] def initialize_options(self): - pass + """Abstract method of the base class (required to be overridden)""" def finalize_options(self): - pass + """Abstract method of the base class (required to be overridden)""" class Bundle(SimpleCommand): @@ -30,6 +30,9 @@ class Bundle(SimpleCommand): @staticmethod def run(): + """ + Create an application bundle (using PyInstaller) + """ import PyInstaller.__main__ resources_folder = os.path.join('pythonturtle', 'resources') @@ -61,6 +64,9 @@ class Clean(SimpleCommand): @staticmethod def run(): + """ + Clean up files not meant for version control + """ delete_in_root = [ 'build', 'dist', From e724fd0939783ad2ef8362146355fb2040e2a056 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 9 Oct 2018 10:30:17 +0200 Subject: [PATCH 28/66] Update Shippable config for Windows builds Run Pylint + MSI build on AppVeyor --- appveyor.yml | 3 +++ shippable.yml | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bb65ad7..e51cb2b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,13 +16,16 @@ before_test: test_script: - '%PYTHON%\python.exe -m tox -e flake8' +- '%PYTHON%\python.exe -m tox -e pylint' - '%PYTHON%\python.exe -m tox -e py36' after_test: - '%PYTHON%\python.exe setup.py clean bundle' +- '%PYTHON%\python.exe setup.py bdist_msi' artifacts: - path: dist\PythonTurtle.exe +- path: dist\PythonTurtle-*.msi on_success: - dir dist diff --git a/shippable.yml b/shippable.yml index f479a46..830b8b9 100644 --- a/shippable.yml +++ b/shippable.yml @@ -1,16 +1,15 @@ --- -language: python -python: 3.6 - resources: - name: pythonturtle_repo type: gitRepo integration: github + buildOnPullRequest: true pointer: sourceName: cool-RR/PythonTurtle jobs: -- name: Windows build + +- name: windows_build type: runSh allowPublicAccess: true runtime: @@ -18,12 +17,40 @@ jobs: steps: - IN: pythonturtle_repo - TASK: - name: Windows EXE file + name: System information script: - systeminfo - Get-Process - pushd $(shipctl get_resource_state "pythonturtle_repo") - - python3 --version - - python3 -m pip install PyInstaller wxPython - - python3 setup.py clean bundle + - choco install -y python --version 3.6.3 + - 'C:\Python36\python.exe --version' + - TASK: + name: Install prerequisites + script: + - 'C:\Python36\python.exe -m pip install PyInstaller wxPython pypiwin32' + - TASK: + name: Lint + script: + - 'C:\Python36\python.exe -m tox -e flake8' + - 'C:\Python36\python.exe -m tox -e pylint' + - TASK: + name: Test + script: + - 'C:\Python36\python.exe -m tox -e py36' + - TASK: + name: Windows EXE file + script: + - 'C:\Python36\python.exe setup.py clean bundle' + +- name: push_artifacts + type: runSh + allowPublicAccess: true + runtime: + nodePool: dyn_win16 + steps: + - IN: windows_build + - TASK: + name: push artifacts somewhere + script: + - systeminfo - dir dist From 05608c9b1b5771b511253a626533e5ee6c1428e1 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 9 Oct 2018 11:21:16 +0200 Subject: [PATCH 29/66] Add AppImage build for GNU/Linux --- .travis.yml | 18 ++++++++++++++++++ AppImage.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 AppImage.yml diff --git a/.travis.yml b/.travis.yml index 1c4dffb..4b64c80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,24 @@ jobs: on: tags: true + - name: Linux AppImage + stage: publish + python: 3.6 + install: + - sudo apt-get install desktop-file-utils + - wget https://raw.githubusercontent.com/AppImage/AppImages/master/pkg2appimage + - chmod 755 pkg2appimage + script: + - ./pkg2appimage AppImage.yml + - bash -c "mv -v out/Python*AppImage PythonTurtle.AppImage" + deploy: + provider: releases + api_key: "GITHUB OAUTH TOKEN" + file: PythonTurtle.AppImage + skip_cleanup: true + on: + tags: true + - name: Linux bundle stage: publish python: 3.6 diff --git a/AppImage.yml b/AppImage.yml new file mode 100644 index 0000000..6f2732a --- /dev/null +++ b/AppImage.yml @@ -0,0 +1,31 @@ +app: PythonTurtle + +ingredients: + dist: bionic + sources: + - deb http://archive.ubuntu.com/ubuntu/ bionic main universe + packages: + - python3-minimal + - python3-pip + script: + - python3 -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + - python3 -m pip install setuptools + +script: + - python3 ../../setup.py install --root . + - ln -s /usr/local/bin/PythonTurtle ./usr/bin/ + - cp ../../pythonturtle/resources/turtle.png ./pythonturtle.png + - cat > pythonturtle.desktop < Date: Tue, 9 Oct 2018 11:55:41 +0200 Subject: [PATCH 30/66] Refer to the GNU/Linux OS appropriately --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4b64c80..a436fa9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ jobs: on: tags: true - - name: Linux AppImage + - name: GNU/Linux AppImage stage: publish python: 3.6 install: @@ -63,7 +63,7 @@ jobs: on: tags: true - - name: Linux bundle + - name: GNU/Linux bundle stage: publish python: 3.6 install: From 949f8c34064e5666ae957d538511fa500ca3f0db Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Wed, 10 Oct 2018 00:06:20 +0200 Subject: [PATCH 31/66] Remove spaces from Shippable task names --- shippable.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shippable.yml b/shippable.yml index 830b8b9..ff42aaf 100644 --- a/shippable.yml +++ b/shippable.yml @@ -17,7 +17,7 @@ jobs: steps: - IN: pythonturtle_repo - TASK: - name: System information + name: System_info script: - systeminfo - Get-Process @@ -25,7 +25,7 @@ jobs: - choco install -y python --version 3.6.3 - 'C:\Python36\python.exe --version' - TASK: - name: Install prerequisites + name: Prerequisites script: - 'C:\Python36\python.exe -m pip install PyInstaller wxPython pypiwin32' - TASK: @@ -38,7 +38,7 @@ jobs: script: - 'C:\Python36\python.exe -m tox -e py36' - TASK: - name: Windows EXE file + name: Windows_exe script: - 'C:\Python36\python.exe setup.py clean bundle' @@ -50,7 +50,7 @@ jobs: steps: - IN: windows_build - TASK: - name: push artifacts somewhere + name: push_artifacts_somewhere script: - systeminfo - dir dist From f29aa05f310aeddd423048ec516d66c475c28f19 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sat, 30 Mar 2019 00:41:58 +0100 Subject: [PATCH 32/66] Fix broken link for Ansible install --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa5ab98..fffed41 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ PythonTurtle If you're into automation: -[Ansible tasks](https://github.com/painless-software/ansible-software/blob/master/roles/education/tasks/programming.yml#L11-L34 +[Ansible tasks](https://github.com/painless-software/ansible-role-software/blob/master/tasks/education/programming.yml#L12-L43 ) for setting up PythonTurtle including a desktop shortcut for GNOME. Compatibility From 761bae5017f0174460b305e2d9ad44394ef04864 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 30 Mar 2019 15:35:06 +0300 Subject: [PATCH 33/66] Upgrade from Wing 6 to Wing 7 --- pythonturtle.wpr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pythonturtle.wpr b/pythonturtle.wpr index e60ea14..63d142b 100644 --- a/pythonturtle.wpr +++ b/pythonturtle.wpr @@ -1,7 +1,7 @@ #!wing -#!version=6.0 +#!version=7.0 ################################################################## -# Wing IDE project file # +# Wing project file # ################################################################## [project attributes] proj.directory-list = [{'dirloc': loc('.'), From a6e46fc33a6e5557ae5b08cc3f63234770e99e01 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Tue, 23 Apr 2019 11:48:46 +0300 Subject: [PATCH 34/66] Shameless plug --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fffed41..d250077 100644 --- a/README.md +++ b/README.md @@ -91,4 +91,4 @@ About This project is licensed under the MIT license. PythonTurtle was created by Ram Rachum as a side-project in 2009. I also provide -[freelance Django/Python development services](https://chipmunkdev.com). +[freelance Django/Python development services](https://chipmunkdev.com). I [give Python workshops](http://pythonworkshops.co/) to teach people Python and related topics. ([Hebrew website](http://pythonworkshops.co/).) From 1bea7705fd5f4b1a7a7a86c8343089d30a15581c Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Tue, 23 Apr 2019 11:49:14 +0300 Subject: [PATCH 35/66] Shameless plug 2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d250077..5eeaa07 100644 --- a/README.md +++ b/README.md @@ -91,4 +91,4 @@ About This project is licensed under the MIT license. PythonTurtle was created by Ram Rachum as a side-project in 2009. I also provide -[freelance Django/Python development services](https://chipmunkdev.com). I [give Python workshops](http://pythonworkshops.co/) to teach people Python and related topics. ([Hebrew website](http://pythonworkshops.co/).) +[freelance Django/Python development services](https://chipmunkdev.com). I [give Python workshops](http://pythonworkshops.co/) to teach people Python and related topics. ([Hebrew website](http://pythonworkshops.co.il/).) From e73c7fd390ac352b6d90a5bf2bba765fcd13d9ff Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sat, 10 Aug 2019 13:08:27 +0200 Subject: [PATCH 36/66] Show sweet logos on build badges --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5eeaa07..73112fc 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ Python Turtle ============= -[![Travis CI](https://img.shields.io/travis/cool-RR/PythonTurtle/master.svg)](https://travis-ci.org/cool-RR/PythonTurtle -) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle/master.svg)](https://ci.appveyor.com/project/cool-RR/PythonTurtle -) [![Shippable](https://img.shields.io/shippable/5bb5a1f6d8769507003ac8c7/master.svg)](https://app.shippable.com/github/cool-RR/PythonTurtle/dashboard +[![Travis CI](https://img.shields.io/travis/cool-RR/PythonTurtle/master.svg?logo=travis)](https://travis-ci.org/cool-RR/PythonTurtle +) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle/master.svg?logo=appveyor)](https://ci.appveyor.com/project/cool-RR/PythonTurtle ) [![GitHub issues](https://img.shields.io/github/issues-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/issues ) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/pulls ) [![Python versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ From 4690b079110068c614aee969c4ab6140ae8ce582 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Wed, 21 Aug 2019 00:11:54 +0200 Subject: [PATCH 37/66] Use GITHUB_TOKEN for automatic deployments --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a436fa9..a613a8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ jobs: - bash -c "mv -v out/Python*AppImage PythonTurtle.AppImage" deploy: provider: releases - api_key: "GITHUB OAUTH TOKEN" + api_key: $GITHUB_TOKEN file: PythonTurtle.AppImage skip_cleanup: true on: @@ -73,7 +73,7 @@ jobs: - ./setup.py clean bundle deploy: provider: releases - api_key: "GITHUB OAUTH TOKEN" + api_key: $GITHUB_TOKEN file: dist/PythonTurtle skip_cleanup: true on: @@ -91,7 +91,7 @@ jobs: - ./setup.py clean bundle deploy: provider: releases - api_key: "GITHUB OAUTH TOKEN" + api_key: $GITHUB_TOKEN file: dist/PythonTurtle skip_cleanup: true on: From 8430f85a5790e7ecd585d5aab7271340250ba5d5 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Wed, 21 Aug 2019 18:48:37 +0300 Subject: [PATCH 38/66] Add travis-encrypted PyPI password --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a613a8e..a816d0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ jobs: provider: pypi user: coolRR password: - secure: fdbhH+rsqfG9WfILlBZXlNNSXZVHrfBH9zWa7kKiUY55GMYKli+u/MzG1i6Ezn53Vg1wL1NTQMm5rFbbUfBE2l5/+S191saBZGApEhQZhulSkG702FCbpuGs1a26Zm+dhjyiRvuNdnPB8BA61uHSpWFzDgpLurGsZB0TyB2hZqv7LFL1eG56mKh70LTIDO5XmDh5/yDEXfc23M2nS7Zwx2xJEM047Fay/yeZSjo+LEYgCoTM/z9TftyxkyuLOGsiRoBMwL7eb7wKJzk79vSAvgZP/fSuAqc8ut1lrk1S9OIO4I9s7Zpi1QneJSGDJu4IHfV3nlge/+tlN8aeLA6GsSy/RrrzueBdtYTpbt34vO5rVfhJwjHIKTQa4GUF0R6gCiQ0JjJiXLC+UAbePZxzAKQWaxJWWpqq8L9e+LlHWpEtuB4jEqncFs6FeTT7mTWz2HMTQvvIVAsI2xFkItY4yCpE3P5+5f6UgqwqFpuKCXWF6ohQ090wTlNxN5cikNSYdPPQj7hypKzWrYcH5z4Z4pU63mnO2fZgTEZomvYKXa9mcdtZcCBhPNJW9WTgxqKSouPcjYc4me9wk4wv4ncJaCPLlxbuW7T/Nv+Xy/HYn7eljRapnu7/XcVQgB6gG4vxbRkkLkr1Ybj0xcR2neAQcxhBBqzfCyQezh210dPGqF8= + secure: lQ78pXBQXq2hgrgtlgLak15RVzMGpDJP8ncbenJgpdT0EmTc98MRvQeFsNgiwTKLvkyNZzFs1tG2LjdWX5i7DRwxoAXYObzMiexOfTd6tjQt1/KwuZDWpmMqpBmNGRxzpHbX/0gFWlZ6dY5/y5Wh9FSvXfwYzK1dkscgtdOayB3hHR6y/wOodiZa44k49q+dGKGlJnvbaDK6ngescWX+MIwV3LpiWlooB/S6sPbRg991sfuNc+tbO5LVHvlmDy6oECLqZ6uBLHKrSOZMeKULnJKWHFfUBkeb/ajzrP2O3KYD8rvMaeR9a99iQWRcIs97jLNHtcVx1OR79b49A1HnjjuxYdmksSn7sTF0YbugJJbEq0kQLtoNfOY5C+FnSfj8z2CLLAEOKUHgX/JDHoJmwVpnrY1CVLRIR3zR60RchwGO6Y7WqqjQGbpVJN1H+1kY66EXec28kycalbLVprea9YyMkvVNgu4wwiFu5O+2Td3bptqQstSmUZb+fHt334EISFcA3OEn0JEToNPP3ZjmtwJCTNEt+DViZ5gtatsxptGZr5NzJx3BENPyO3jktga1hw9nmY/pjH9Efu8TRdqzGM7WJMgeO6bBlCncwBQHz60r4AOuTFreZ3Cz7DoVDGKBYOk4oOUvbvv1BINAcRhPijSzhh46atakspBKBk0iEn4= distributions: 'sdist bdist_wheel' skip_cleanup: true on: From 131c5ed65b6ea01c16d6f6d554ede8ea1fcde5ae Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Wed, 21 Aug 2019 18:52:24 +0300 Subject: [PATCH 39/66] Add GitHub token --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a816d0b..8e2215b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ jobs: - bash -c "mv -v out/Python*AppImage PythonTurtle.AppImage" deploy: provider: releases - api_key: $GITHUB_TOKEN + api_key: EY5m706JrxnEaSK7s3knGQj4cO8rHQyIztRq4UhN+zx0xCGuq65rBOPB7/dtthLgpB9cjWHbN3RQZOi9OiPlzaimMaZT4q1rQo+0bMoH61ML/xSXG3xY6dhCdQXvNElDerii6K0tgWJtnOOylvnNv4YWw+IlUMHXHCpwg0ZcDu2yLmpyozqAzSiMIbPa2UQtG0idFKyh59EwAdEohOC9WuqGLdF7ngJCEcF/C0+DHgH1MJsblmognrng2RAjhzbQNjQD5YLLQ7h4ODYGPRqr1aw1TXObmRH6AOVMpGSTFbFwOgTJoYZp2NKDL6ffjxR0YAxkgXLcv1c/xsp1qe3RAYflLGAz2Gw5cSRL1HhB8qtVrfFdXkBO7Gc9dtj+wOOmn9o/9OaaISvYcmXJv63x4oz8As1TXXO+Xf9zRhnxBKeDTlPsOSAzgWMPq2RKTwVjpWfslxqtEFrgYtjf0QArly+XahX244umLd2pFb4mLhmQyHFIhTb2pu+9f/nQkeBNogpB1PVPdLhrySvnR/6kdjsDyMnNIY8ROs4c/ZHfwm3sPAztlbIYByZFR4cjzRGObsZBKbUG1R1w47FYk2uE055V73sktJYsxAe+HBFfN85VSLOi8nLU160MLEWNhzMbGm0rnqLnmVx6Q7Va35KdbrgnXnHyhwUUUUQWNvI7ZTo= file: PythonTurtle.AppImage skip_cleanup: true on: From 961f8d13cd835e55efa8fd04ebbcb0120ec7dec4 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 23 Aug 2019 13:04:21 +0300 Subject: [PATCH 40/66] Revert "Add GitHub token" This reverts commit 131c5ed65b6ea01c16d6f6d554ede8ea1fcde5ae. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8e2215b..a816d0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ jobs: - bash -c "mv -v out/Python*AppImage PythonTurtle.AppImage" deploy: provider: releases - api_key: EY5m706JrxnEaSK7s3knGQj4cO8rHQyIztRq4UhN+zx0xCGuq65rBOPB7/dtthLgpB9cjWHbN3RQZOi9OiPlzaimMaZT4q1rQo+0bMoH61ML/xSXG3xY6dhCdQXvNElDerii6K0tgWJtnOOylvnNv4YWw+IlUMHXHCpwg0ZcDu2yLmpyozqAzSiMIbPa2UQtG0idFKyh59EwAdEohOC9WuqGLdF7ngJCEcF/C0+DHgH1MJsblmognrng2RAjhzbQNjQD5YLLQ7h4ODYGPRqr1aw1TXObmRH6AOVMpGSTFbFwOgTJoYZp2NKDL6ffjxR0YAxkgXLcv1c/xsp1qe3RAYflLGAz2Gw5cSRL1HhB8qtVrfFdXkBO7Gc9dtj+wOOmn9o/9OaaISvYcmXJv63x4oz8As1TXXO+Xf9zRhnxBKeDTlPsOSAzgWMPq2RKTwVjpWfslxqtEFrgYtjf0QArly+XahX244umLd2pFb4mLhmQyHFIhTb2pu+9f/nQkeBNogpB1PVPdLhrySvnR/6kdjsDyMnNIY8ROs4c/ZHfwm3sPAztlbIYByZFR4cjzRGObsZBKbUG1R1w47FYk2uE055V73sktJYsxAe+HBFfN85VSLOi8nLU160MLEWNhzMbGm0rnqLnmVx6Q7Va35KdbrgnXnHyhwUUUUQWNvI7ZTo= + api_key: $GITHUB_TOKEN file: PythonTurtle.AppImage skip_cleanup: true on: From 5d42b8712da571e8ac2b4b8fb81eb0cb649e0d99 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 17 Oct 2019 01:18:49 +0200 Subject: [PATCH 41/66] Fix references to old resources --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 73112fc..178e66d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ Python Turtle ============= -[![Travis CI](https://img.shields.io/travis/cool-RR/PythonTurtle/master.svg?logo=travis)](https://travis-ci.org/cool-RR/PythonTurtle +[![Travis CI](https://img.shields.io/travis/PythonTurtle/PythonTurtle/master.svg?logo=travis)](https://travis-ci.org/PythonTurtle/PythonTurtle ) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle/master.svg?logo=appveyor)](https://ci.appveyor.com/project/cool-RR/PythonTurtle -) [![GitHub issues](https://img.shields.io/github/issues-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/issues -) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/pulls +) [![GitHub issues](https://img.shields.io/github/issues-raw/PythonTurtle/PythonTurtle.svg)](https://github.com/PythonTurtle/PythonTurtle/issues +) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/PythonTurtle/PythonTurtle.svg)](https://github.com/PythonTurtle/PythonTurtle/pulls ) [![Python versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ -) [![MIT license](https://img.shields.io/github/license/cool-RR/PythonTurtle.svg)](https://github.com/cool-RR/PythonTurtle/blob/master/LICENSE +) [![MIT license](https://img.shields.io/github/license/PythonTurtle/PythonTurtle.svg)](https://github.com/PythonTurtle/PythonTurtle/blob/master/LICENSE ) [![Gitter](https://img.shields.io/gitter/room/PythonTurtle/Lobby.svg)](https://gitter.im/PythonTurtle/Lobby) An educational environment for learning Python, suitable for beginners and children. @@ -34,7 +34,7 @@ Installation Installers for Microsoft Windows and macOS are available from [pythonturtle.org](http://pythonturtle.org) and [GitHub]( -https://github.com/cool-RR/PythonTurtle/releases). +https://github.com/PythonTurtle/PythonTurtle/releases). Ubuntu Linux: @@ -70,7 +70,7 @@ Development ----------- ```bash -git clone https://github.com/cool-RR/PythonTurtle.git +git clone https://github.com/PythonTurtle/PythonTurtle.git cd PythonTurtle python3 -m pythonturtle ``` @@ -81,7 +81,7 @@ Build application bundles like this: python3 setup.py clean bundle ``` -Please [open a pull request](https://github.com/cool-RR/PythonTurtle/pulls +Please [open a pull request](https://github.com/PythonTurtle/PythonTurtle/pulls ) for contributions or bug fixes. If you can, please also add tests. About From 7351ad2f6afb4fa6e167d5926db18376f70d65ea Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Thu, 17 Oct 2019 02:32:37 +0200 Subject: [PATCH 42/66] Pin older version of Pylint to make it pass --- .gitignore | 2 ++ README.md | 6 ++++++ tox.ini | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0d3ca64..c5c82e7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,7 @@ __pycache__/ # packaging artifacts /build/ /dist/ +/out/ +/PythonTurtle/ /*.egg-info /*.spec diff --git a/README.md b/README.md index 178e66d..c6aa3a9 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,12 @@ If you're into automation: [Ansible tasks](https://github.com/painless-software/ansible-role-software/blob/master/tasks/education/programming.yml#L12-L43 ) for setting up PythonTurtle including a desktop shortcut for GNOME. +### Troubleshooting + +> ImportError: libpng12.so.0: cannot open shared object file: No such file or directory + +See https://askubuntu.com/a/978338/14650 + Compatibility ------------- diff --git a/tox.ini b/tox.ini index 5411e8a..1b34db7 100644 --- a/tox.ini +++ b/tox.ini @@ -15,6 +15,7 @@ envlist = py37 [testenv] +description = Unit tests deps = pytest commands = @@ -22,6 +23,7 @@ commands = {envpython} -m pytest [testenv:flake8] +description = Static code analysis and code style basepython = python3.6 deps = flake8 @@ -29,10 +31,12 @@ commands = {envpython} -m flake8 {posargs} [testenv:pylint] +description = Check for errors and code smells basepython = python3.6 deps = + astroid<2.2 + pylint<2.4 pyinstaller - pylint commands = {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython {envpython} -m pylint --rcfile tox.ini {posargs:pythonturtle setup} @@ -44,10 +48,17 @@ exclude = .tox build dist + out + PythonTurtle [pylint] disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument,fixme,arguments-differ reports = no [pytest] -addopts = --junitxml=tests/reports/unittests.xml --strict --verbose +addopts = + --color=yes + --ignore=PythonTurtle + --junitxml=tests/reports/unittests.xml + --strict + --verbose From c4302dd29c2672b4689ad312e68faf8eca995fe7 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 15:27:17 +0200 Subject: [PATCH 43/66] Run test suite with GitHub Actions --- .github/workflows/checks.yml | 24 ++++++++++++++++++++++++ .github/workflows/packaging.yml | 24 ++++++++++++++++++++++++ .github/workflows/tests.yml | 28 ++++++++++++++++++++++++++++ tox.ini | 12 +++++++++--- 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/checks.yml create mode 100644 .github/workflows/packaging.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..6ddebc0 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,24 @@ +name: Checks + +on: + pull_request: + branches: [master] + push: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + env: [flake8, pylint] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install prerequisites + run: python -m pip install --upgrade setuptools pip wheel tox + - name: Run ${{ matrix.env }} + run: tox -e ${{ matrix.env }} diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml new file mode 100644 index 0000000..3428c18 --- /dev/null +++ b/.github/workflows/packaging.yml @@ -0,0 +1,24 @@ +name: Publish Python package + +on: + push: + tags: + - "*" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install prerequisites + run: python -m pip install --upgrade pip setuptools twine wheel + - name: Build package + run: python setup.py sdist bdist_wheel + - name: Upload to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: twine upload dist/* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..e6535b5 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,28 @@ +name: Tests + +on: + pull_request: + branches: [master] + push: + branches: [master] + +jobs: + build: + runs-on: ${{ matrix.platform }} + strategy: + fail-fast: false + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.6, 3.7, 3.8] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install prerequisites + run: python -m pip install --upgrade setuptools pip wheel tox-gh-actions + - name: Run tests + run: tox + # Only on GitHub Actions, any Ubuntu release fails for `import wx`: + # libSDL2-2.0.so.0: cannot open shared object file: No such file or directory + continue-on-error: true diff --git a/tox.ini b/tox.ini index 1b34db7..55cbb97 100644 --- a/tox.ini +++ b/tox.ini @@ -13,13 +13,14 @@ envlist = pylint py36 py37 + py38 [testenv] description = Unit tests deps = pytest commands = - {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython {envpython} -m pytest [testenv:flake8] @@ -38,9 +39,15 @@ deps = pylint<2.4 pyinstaller commands = - {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython {envpython} -m pylint --rcfile tox.ini {posargs:pythonturtle setup} +[gh-actions] +python = + 3.6: py36 + 3.7: py37 + 3.8: py38 + [flake8] exclude = .cache @@ -53,7 +60,6 @@ exclude = [pylint] disable = attribute-defined-outside-init,invalid-name,missing-docstring,no-member,self-cls-assignment,too-few-public-methods,too-many-instance-attributes,too-many-locals,too-many-statements,unused-argument,fixme,arguments-differ -reports = no [pytest] addopts = From 78f74102dd89dc7024600c85216a30122a8562a8 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 17:43:08 +0200 Subject: [PATCH 44/66] Use long variable names to make Flake8 happy --- pythonturtle/shelltoprocess/forkedpyshell.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pythonturtle/shelltoprocess/forkedpyshell.py b/pythonturtle/shelltoprocess/forkedpyshell.py index 36fb94d..ed3a299 100644 --- a/pythonturtle/shelltoprocess/forkedpyshell.py +++ b/pythonturtle/shelltoprocess/forkedpyshell.py @@ -1033,11 +1033,11 @@ def write(self, text): def fixLineEndings(self, text): """Return text with line endings replaced by OS-specific endings.""" lines = text.split('\r\n') - for l in range(len(lines)): - chunks = lines[l].split('\r') - for c in range(len(chunks)): - chunks[c] = os.linesep.join(chunks[c].split('\n')) - lines[l] = os.linesep.join(chunks) + for line in range(len(lines)): + chunks = lines[line].split('\r') + for chunk in range(len(chunks)): + chunks[chunk] = os.linesep.join(chunks[chunk].split('\n')) + lines[line] = os.linesep.join(chunks) text = os.linesep.join(lines) return text From a12ad7a232f459d756bb08ffd40f540de1c3a195 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 17:46:52 +0200 Subject: [PATCH 45/66] Remove Shippable CI which never worked as needed --- shippable.yml | 56 --------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 shippable.yml diff --git a/shippable.yml b/shippable.yml deleted file mode 100644 index ff42aaf..0000000 --- a/shippable.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -resources: -- name: pythonturtle_repo - type: gitRepo - integration: github - buildOnPullRequest: true - pointer: - sourceName: cool-RR/PythonTurtle - -jobs: - -- name: windows_build - type: runSh - allowPublicAccess: true - runtime: - nodePool: dyn_win16 - steps: - - IN: pythonturtle_repo - - TASK: - name: System_info - script: - - systeminfo - - Get-Process - - pushd $(shipctl get_resource_state "pythonturtle_repo") - - choco install -y python --version 3.6.3 - - 'C:\Python36\python.exe --version' - - TASK: - name: Prerequisites - script: - - 'C:\Python36\python.exe -m pip install PyInstaller wxPython pypiwin32' - - TASK: - name: Lint - script: - - 'C:\Python36\python.exe -m tox -e flake8' - - 'C:\Python36\python.exe -m tox -e pylint' - - TASK: - name: Test - script: - - 'C:\Python36\python.exe -m tox -e py36' - - TASK: - name: Windows_exe - script: - - 'C:\Python36\python.exe setup.py clean bundle' - -- name: push_artifacts - type: runSh - allowPublicAccess: true - runtime: - nodePool: dyn_win16 - steps: - - IN: windows_build - - TASK: - name: push_artifacts_somewhere - script: - - systeminfo - - dir dist From ae0b6426e8948db1e888f971bd0baddf5105c7c4 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 17:47:21 +0200 Subject: [PATCH 46/66] Fix URL in user error hint --- pythonturtle/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonturtle/application.py b/pythonturtle/application.py index 74f4066..3eed35e 100644 --- a/pythonturtle/application.py +++ b/pythonturtle/application.py @@ -15,7 +15,7 @@ print("wxPython doesn't seem to be installed. You need to install " "the appropriate prerequisites for your operating system.") print("Please consult the installation instructions in the README at " - "https://github.com/cool-RR/PythonTurtle#installation") + "https://github.com/PythonTurtle/PythonTurtle#installation") import sys sys.exit(255) From b63dbc163b10b6a9a15004eff50adff479bcfac5 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 17:59:42 +0200 Subject: [PATCH 47/66] Mention 3.8 as supported, add GitHub Actions badge --- README.md | 2 ++ setup.py | 1 + 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index c6aa3a9..d01b782 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Python Turtle [![Travis CI](https://img.shields.io/travis/PythonTurtle/PythonTurtle/master.svg?logo=travis)](https://travis-ci.org/PythonTurtle/PythonTurtle ) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle/master.svg?logo=appveyor)](https://ci.appveyor.com/project/cool-RR/PythonTurtle +) [![Checks](https://img.shields.io/github/workflow/status/PythonTurtle/PythonTurtle/Checks/master?label=Checks&logo=github)](https://github.com/PythonTurtle/PythonTurtle/actions?query=workflow%3AChecks +) [![Tests](https://img.shields.io/github/workflow/status/PythonTurtle/PythonTurtle/Tests/master?label=Tests&logo=github)](https://github.com/PythonTurtle/PythonTurtle/actions?query=workflow%3ATests ) [![GitHub issues](https://img.shields.io/github/issues-raw/PythonTurtle/PythonTurtle.svg)](https://github.com/PythonTurtle/PythonTurtle/issues ) [![GitHub PRs](https://img.shields.io/github/issues-pr-raw/PythonTurtle/PythonTurtle.svg)](https://github.com/PythonTurtle/PythonTurtle/pulls ) [![Python versions](https://img.shields.io/pypi/pyversions/PythonTurtle.svg)](https://pypi.org/project/PythonTurtle/ diff --git a/setup.py b/setup.py index d35f64b..30a58e8 100755 --- a/setup.py +++ b/setup.py @@ -134,6 +134,7 @@ def read_file(filename): 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Topic :: Education', ], python_requires='>=3', From 2d80f4d1d3b45b3d2b57b999424e8f5376601772 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 18:09:23 +0200 Subject: [PATCH 48/66] Run tests on Ubuntu Bionic on Travis CI --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a816d0b..0d37109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,17 @@ --- -dist: xenial -sudo: true +os: linux +dist: bionic language: python python: - 3.6 - 3.7 +- 3.8 install: - pip install tox-travis - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - sudo apt-get install libsdl-ttf2.0-0 + sudo apt-get install libsdl2-2.0-0 ; fi script: - tox @@ -22,13 +23,11 @@ stages: jobs: allow_failures: - - python: 3.7 - { os: osx, stage: publish } include: - { stage: lint, python: 3.6, env: TOXENV=flake8 } - { stage: lint, python: 3.6, env: TOXENV=pylint } - - { stage: test, os: osx, language: generic, env: TOXENV=py36 } - name: PyPI package stage: publish @@ -68,7 +67,7 @@ jobs: python: 3.6 install: - pip install PyInstaller - - pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython + - pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython script: - ./setup.py clean bundle deploy: From e25f232ffe7996ebb66e509a84df7d97b74d11fc Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Sun, 30 Aug 2020 19:08:52 +0200 Subject: [PATCH 49/66] Install missing library on Ubuntu (GH-Actions) --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6535b5..4200cf8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,21 +8,21 @@ on: jobs: build: - runs-on: ${{ matrix.platform }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] python-version: [3.6, 3.7, 3.8] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies for Ubuntu + run: sudo apt-get install libsdl2-2.0-0 + if: matrix.os == 'ubuntu-latest' - name: Install prerequisites run: python -m pip install --upgrade setuptools pip wheel tox-gh-actions - name: Run tests run: tox - # Only on GitHub Actions, any Ubuntu release fails for `import wx`: - # libSDL2-2.0.so.0: cannot open shared object file: No such file or directory - continue-on-error: true From 5d3361ac69acb16fb24749fd20ce6b7a1d3f66c1 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 21 Sep 2020 03:04:35 +0200 Subject: [PATCH 50/66] Fix typo discovered by codespell (#145) * Fix typos discovered by codespell --- pythonturtle/shelltoprocess/__init__.py | 2 +- pythonturtle/shelltoprocess/forkedpyshell.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pythonturtle/shelltoprocess/__init__.py b/pythonturtle/shelltoprocess/__init__.py index 2a8f791..9502531 100644 --- a/pythonturtle/shelltoprocess/__init__.py +++ b/pythonturtle/shelltoprocess/__init__.py @@ -1,6 +1,6 @@ """ This package implements a wxPython shell, based on PyShell, -which controls a seperate Python process, creating with the +which controls a separate Python process, creating with the `multiprocessing` package. Here is the canonical way to use it: diff --git a/pythonturtle/shelltoprocess/forkedpyshell.py b/pythonturtle/shelltoprocess/forkedpyshell.py index ed3a299..8a08ebb 100644 --- a/pythonturtle/shelltoprocess/forkedpyshell.py +++ b/pythonturtle/shelltoprocess/forkedpyshell.py @@ -1558,7 +1558,7 @@ def OnUpdateUI(self, evt): # self.GetData() # if self.textdo.GetTextLength() > 1: # text = self.textdo.GetText() -# # *** Do somethign with the dragged text here... +# # *** Do something with the dragged text here... # self.textdo.SetText('') # else: # filenames = str(self.filename.GetFilenames()) From bc21241582775330571ed0bce004d6fd5331feea Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 24 Sep 2020 03:46:55 +0200 Subject: [PATCH 51/66] Create build_windows_exe.yml --- .github/workflows/build_windows_exe.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/build_windows_exe.yml diff --git a/.github/workflows/build_windows_exe.yml b/.github/workflows/build_windows_exe.yml new file mode 100644 index 0000000..31e08b3 --- /dev/null +++ b/.github/workflows/build_windows_exe.yml @@ -0,0 +1,19 @@ +name: Build Windows exe + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install pyinstaller + - run: python setup.py clean bundle + - uses: actions/upload-artifact@v2 + with: + name: PythonTurtle for Windows + path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe From 3a96a5e15312ec69b14afe2faaa6f3932296f655 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 24 Sep 2020 03:31:12 +0200 Subject: [PATCH 52/66] Create build_linux_app.yml --- .github/workflows/build_linux_elf.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/build_linux_elf.yml diff --git a/.github/workflows/build_linux_elf.yml b/.github/workflows/build_linux_elf.yml new file mode 100644 index 0000000..541a023 --- /dev/null +++ b/.github/workflows/build_linux_elf.yml @@ -0,0 +1,20 @@ +name: Build Linux ELF + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: sudo apt-get install libsdl2-2.0-0 + - run: python -m pip install pyinstaller + - run: python setup.py clean bundle + - uses: actions/upload-artifact@v2 + with: + name: PythonTurtle for Linux + path: /home/runner/work/PythonTurtle/PythonTurtle/dist/PythonTurtle From 4c1cc425957650d54e79c541c7bf0c37b8823ba6 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Fri, 25 Sep 2020 01:16:18 +0200 Subject: [PATCH 53/66] Release v0.3.2 --- pythonturtle/__init__.py | 5 ++++- setup.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pythonturtle/__init__.py b/pythonturtle/__init__.py index a245236..2046bd5 100644 --- a/pythonturtle/__init__.py +++ b/pythonturtle/__init__.py @@ -10,6 +10,9 @@ basics of Python programming. """ name = 'PythonTurtle' -__version__ = '0.3.1' +__author__ = 'Ram Rachum and contributors' +__author_email__ = 'ram@rachum.com' __license__ = 'MIT' +__source__ = 'https://github.com/PythonTurtle/PythonTurtle' __url__ = 'http://pythonturtle.org' +__version__ = '0.3.2' diff --git a/setup.py b/setup.py index 30a58e8..1cf655d 100755 --- a/setup.py +++ b/setup.py @@ -110,15 +110,15 @@ def read_file(filename): setup( name=package.name, version=package.__version__, - license=package.__license__, - author='Ram Rachum', - author_email='ram@rachum.com', + author=package.__author__, + author_email=package.__author_email__, description=package.__doc__.strip().split('\n')[0], + license=package.__license__, long_description_content_type='text/markdown', long_description=read_file('README.md'), url=package.__url__, project_urls={ - 'Source': 'https://github.com/cool-RR/PythonTurtle', + 'Source': package.__source__, }, keywords=['turtle', 'learning', 'children', 'beginners', 'logo'], classifiers=[ From 6f31c59eeef1109384a23caddd30ed10a86a23ee Mon Sep 17 00:00:00 2001 From: Devansh Tayal Date: Mon, 28 Sep 2020 16:11:57 +0530 Subject: [PATCH 54/66] version changed --- .pydevproject | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pydevproject b/.pydevproject index 42a154a..56a835d 100644 --- a/.pydevproject +++ b/.pydevproject @@ -2,7 +2,7 @@ -python 2.6 +python 3.6 Default /PythonTurtle From 51a14e41b7dec9457f9e0dd7775e5ca3b0b56ee2 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 01:13:18 +0100 Subject: [PATCH 55/66] Consolidate build workflows into a single one --- .../{build_linux_elf.yml => build.yml} | 16 ++++++++++++++-- .github/workflows/build_windows_exe.yml | 19 ------------------- .github/workflows/checks.yml | 10 +++++++--- .github/workflows/tests.yml | 18 +++++++++++++----- 4 files changed, 34 insertions(+), 29 deletions(-) rename .github/workflows/{build_linux_elf.yml => build.yml} (52%) delete mode 100644 .github/workflows/build_windows_exe.yml diff --git a/.github/workflows/build_linux_elf.yml b/.github/workflows/build.yml similarity index 52% rename from .github/workflows/build_linux_elf.yml rename to .github/workflows/build.yml index 541a023..710c6ae 100644 --- a/.github/workflows/build_linux_elf.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Linux ELF +name: Build binaries on: push: @@ -6,7 +6,7 @@ on: - "*" jobs: - build: + linux-elf: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,3 +18,15 @@ jobs: with: name: PythonTurtle for Linux path: /home/runner/work/PythonTurtle/PythonTurtle/dist/PythonTurtle + + windows-exe: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install pyinstaller + - run: python setup.py clean bundle + - uses: actions/upload-artifact@v2 + with: + name: PythonTurtle for Windows + path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe diff --git a/.github/workflows/build_windows_exe.yml b/.github/workflows/build_windows_exe.yml deleted file mode 100644 index 31e08b3..0000000 --- a/.github/workflows/build_windows_exe.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Build Windows exe - -on: - push: - tags: - - "*" - -jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: python -m pip install pyinstaller - - run: python setup.py clean bundle - - uses: actions/upload-artifact@v2 - with: - name: PythonTurtle for Windows - path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6ddebc0..4b207e7 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,9 +2,11 @@ name: Checks on: pull_request: - branches: [master] + branches: + - master push: - branches: [master] + branches: + - master jobs: build: @@ -12,7 +14,9 @@ jobs: strategy: fail-fast: false matrix: - env: [flake8, pylint] + env: + - flake8 + - pylint steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4200cf8..0601295 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,11 @@ name: Tests on: pull_request: - branches: [master] + branches: + - master push: - branches: [master] + branches: + - master jobs: build: @@ -12,16 +14,22 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8] + os: + - ubuntu-latest + - macos-latest + - windows-latest + python-version: + - '3.6' + - '3.7' + - '3.8' steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies for Ubuntu - run: sudo apt-get install libsdl2-2.0-0 if: matrix.os == 'ubuntu-latest' + run: sudo apt-get install libsdl2-2.0-0 - name: Install prerequisites run: python -m pip install --upgrade setuptools pip wheel tox-gh-actions - name: Run tests From d81cfbcfd856e6e6dd4eb8de38c3c85ccf8a563d Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 01:40:32 +0100 Subject: [PATCH 56/66] Install latest Pylint (has dependency issues fixed) --- setup.py | 2 +- tox.ini | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 1cf655d..5caddda 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def run(): """ Create an application bundle (using PyInstaller) """ - import PyInstaller.__main__ + import PyInstaller.__main__ # pylint: disable=import-outside-toplevel resources_folder = os.path.join('pythonturtle', 'resources') diff --git a/tox.ini b/tox.ini index 55cbb97..1679188 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # - Installing wxPython is non-trivial on GNU/Linux. We need to install wheels from a dedicated repository, # located at https://extras.wxpython.org/wxPython4/extras/linux/. For beackground reading see # https://wiki.wxpython.org/How%20to%20install%20wxPython#Installing_wxPython-Phoenix_using_pip -# - The wheel repository specified via --find-links below matches the build environment on Travis CI. +# - The wheel repository specified via --find-links below matches the build environment on GitHub Actions. # - For local Tox runs adapt the wheel repository URLs to match your local environment. [tox] @@ -25,7 +25,6 @@ commands = [testenv:flake8] description = Static code analysis and code style -basepython = python3.6 deps = flake8 commands = @@ -33,10 +32,8 @@ commands = [testenv:pylint] description = Check for errors and code smells -basepython = python3.6 deps = - astroid<2.2 - pylint<2.4 + pylint pyinstaller commands = {envpython} -m pip install --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython From f82ae98fe5724de37bd8804d93f7591843b70235 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 02:13:38 +0100 Subject: [PATCH 57/66] Build macOS app This change bases on engineering efforts in PR #155 --- .github/workflows/build.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 710c6ae..4a28ada 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Build binaries on: + pull_request: + branches: + - master push: tags: - "*" @@ -17,7 +20,19 @@ jobs: - uses: actions/upload-artifact@v2 with: name: PythonTurtle for Linux - path: /home/runner/work/PythonTurtle/PythonTurtle/dist/PythonTurtle + path: ${{ github.workspace }}/dist/PythonTurtle + + macos-app: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install pyinstaller + - run: python setup.py clean bundle + - uses: actions/upload-artifact@v2 + with: + name: PythonTurtle for macOS + path: ${{ github.workspace }}/dist/PythonTurtle.app windows-exe: runs-on: windows-latest @@ -29,4 +44,4 @@ jobs: - uses: actions/upload-artifact@v2 with: name: PythonTurtle for Windows - path: D:\a\PythonTurtle\PythonTurtle\dist\PythonTurtle.exe + path: ${{ github.workspace }}\dist\PythonTurtle.exe From 62575ee3562a829e4669dd3ac597495580699fb3 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 02:36:55 +0100 Subject: [PATCH 58/66] Fix "Unknown Mach-O header" error in macOS builds See https://github.com/NordicSemiconductor/pc-nrfutil/issues/183#issuecomment-670400846 and https://github.com/pyinstaller/pyinstaller/issues/4126 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5caddda..9955f00 100755 --- a/setup.py +++ b/setup.py @@ -50,8 +50,8 @@ def include_resources(file_glob): '--name=%s' % package.name, '--onefile', '--windowed', - '--add-binary=%s' % include_resources('*.ic*'), - '--add-binary=%s' % include_resources('*.png'), + '--add-data=%s' % include_resources('*.ic*'), + '--add-data=%s' % include_resources('*.png'), '--add-data=%s' % include_resources('*.txt'), '--icon=%s' % resource_path('icon.ico'), os.path.join('pythonturtle', '__main__.py'), From b38349184baf27b752e26bfb3f44426c75b1b99d Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 02:57:19 +0100 Subject: [PATCH 59/66] Use short names for artifacts to upload --- .github/workflows/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a28ada..025ae35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: - name: PythonTurtle for Linux + name: PythonTurtle path: ${{ github.workspace }}/dist/PythonTurtle macos-app: @@ -29,10 +29,11 @@ jobs: - uses: actions/setup-python@v2 - run: python -m pip install pyinstaller - run: python setup.py clean bundle + - run: rm ${{ github.workspace }}/dist/PythonTurtle - uses: actions/upload-artifact@v2 with: - name: PythonTurtle for macOS - path: ${{ github.workspace }}/dist/PythonTurtle.app + name: PythonTurtle.app + path: ${{ github.workspace }}/dist/ windows-exe: runs-on: windows-latest @@ -43,5 +44,5 @@ jobs: - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: - name: PythonTurtle for Windows + name: PythonTurtle.exe path: ${{ github.workspace }}\dist\PythonTurtle.exe From fba37e474573ddb14cdb1e92b976ac21250d1f24 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 03:04:24 +0100 Subject: [PATCH 60/66] Chain pipeline workflows --- .github/workflows/build.yml | 11 +++++------ .github/workflows/tests.yml | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 025ae35..8b0d17e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,11 @@ name: Build binaries on: - pull_request: - branches: - - master - push: - tags: - - "*" + workflow_run: + workflows: + - Tests + types: + - completed jobs: linux-elf: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0601295..feb821e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,12 +1,11 @@ name: Tests on: - pull_request: - branches: - - master - push: - branches: - - master + workflow_run: + workflows: + - Checks + types: + - completed jobs: build: From 0d5d8faa073383c20224d70f03020ab08a148c2b Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 03:22:04 +0100 Subject: [PATCH 61/66] Restore parallel execution of all jobs Workflow chaining doesn't work as expected --- .github/workflows/build.yml | 11 ++++++----- .github/workflows/tests.yml | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b0d17e..025ae35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,12 @@ name: Build binaries on: - workflow_run: - workflows: - - Tests - types: - - completed + pull_request: + branches: + - master + push: + tags: + - "*" jobs: linux-elf: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index feb821e..0601295 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,11 +1,12 @@ name: Tests on: - workflow_run: - workflows: - - Checks - types: - - completed + pull_request: + branches: + - master + push: + branches: + - master jobs: build: From a51b7709f42498f6d9bb61f8e9e668e4c33e5420 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 03:37:27 +0100 Subject: [PATCH 62/66] Install wxPython to make built binaries work --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 025ae35..9f370e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,9 @@ jobs: - uses: actions/setup-python@v2 - run: sudo apt-get install libsdl2-2.0-0 - run: python -m pip install pyinstaller + - run: python -m pip install --find-links ${WHEELS} wxPython + env: + WHEELS: https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: @@ -27,7 +30,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: python -m pip install pyinstaller + - run: python -m pip install pyinstaller wxPython - run: python setup.py clean bundle - run: rm ${{ github.workspace }}/dist/PythonTurtle - uses: actions/upload-artifact@v2 @@ -40,7 +43,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - run: python -m pip install pyinstaller + - run: python -m pip install pyinstaller wxPython - run: python setup.py clean bundle - uses: actions/upload-artifact@v2 with: From 929f10892e62ece8d5f230d3e995d380d6493cf3 Mon Sep 17 00:00:00 2001 From: Peter Bittner Date: Tue, 22 Dec 2020 12:20:43 +0100 Subject: [PATCH 63/66] Add stub of releasing binaries to publish workflow Rename workflows using related verbs --- .github/workflows/build.yml | 4 ++-- .github/workflows/{checks.yml => check.yml} | 0 .github/workflows/{packaging.yml => publish.yml} | 9 +++++++-- .github/workflows/{tests.yml => test.yml} | 0 4 files changed, 9 insertions(+), 4 deletions(-) rename .github/workflows/{checks.yml => check.yml} (100%) rename .github/workflows/{packaging.yml => publish.yml} (80%) rename .github/workflows/{tests.yml => test.yml} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f370e1..62ddfec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,8 +5,8 @@ on: branches: - master push: - tags: - - "*" + branches: + - master jobs: linux-elf: diff --git a/.github/workflows/checks.yml b/.github/workflows/check.yml similarity index 100% rename from .github/workflows/checks.yml rename to .github/workflows/check.yml diff --git a/.github/workflows/packaging.yml b/.github/workflows/publish.yml similarity index 80% rename from .github/workflows/packaging.yml rename to .github/workflows/publish.yml index 3428c18..875e451 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish Python package +name: Publish binaries and Python package on: push: @@ -6,7 +6,12 @@ on: - "*" jobs: - deploy: + binaries: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + pypi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/test.yml similarity index 100% rename from .github/workflows/tests.yml rename to .github/workflows/test.yml From c108f31e186e49b9a076594551c77739cbe0c5fd Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 5 Jan 2024 07:06:19 -0800 Subject: [PATCH 64/66] Fix name in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d01b782..baa4554 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Python Turtle +PythonTurtle ============= [![Travis CI](https://img.shields.io/travis/PythonTurtle/PythonTurtle/master.svg?logo=travis)](https://travis-ci.org/PythonTurtle/PythonTurtle From 1d5b4f828dfb1e442eeca521b4fdda871c0ca9c2 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 6 Jan 2024 18:25:24 +0200 Subject: [PATCH 65/66] Add citation --- README.md | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index baa4554..6df0de8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -PythonTurtle -============= +# PythonTurtle [![Travis CI](https://img.shields.io/travis/PythonTurtle/PythonTurtle/master.svg?logo=travis)](https://travis-ci.org/PythonTurtle/PythonTurtle ) [![AppVeyor](https://img.shields.io/appveyor/ci/cool-RR/PythonTurtle/master.svg?logo=appveyor)](https://ci.appveyor.com/project/cool-RR/PythonTurtle @@ -16,8 +15,7 @@ Inspired by LOGO. Homepage: [http://pythonturtle.org](http://pythonturtle.org) -An Appealing Environment to Learn Python ----------------------------------------- +## An Appealing Environment to Learn Python PythonTurtle strives to provide the lowest-threshold way to learn Python. Students command an interactive Python shell (similar to the [IDLE development @@ -31,8 +29,7 @@ to students. ![Screen shot](http://pythonturtle.org/images/screenshot.gif) -Installation ------------- +## Installation Installers for Microsoft Windows and macOS are available from [pythonturtle.org](http://pythonturtle.org) and [GitHub]( @@ -62,20 +59,20 @@ If you're into automation: [Ansible tasks](https://github.com/painless-software/ansible-role-software/blob/master/tasks/education/programming.yml#L12-L43 ) for setting up PythonTurtle including a desktop shortcut for GNOME. -### Troubleshooting +## Troubleshooting > ImportError: libpng12.so.0: cannot open shared object file: No such file or directory See https://askubuntu.com/a/978338/14650 -Compatibility -------------- + +## Compatibility Tested with Python version 3.6 and wxPython version 4.0.1. Reported to run on Windows, macOS, Ubuntu Linux, and Fedora. -Development ------------ + +## Development ```bash git clone https://github.com/PythonTurtle/PythonTurtle.git @@ -92,10 +89,28 @@ python3 setup.py clean bundle Please [open a pull request](https://github.com/PythonTurtle/PythonTurtle/pulls ) for contributions or bug fixes. If you can, please also add tests. -About ------ + + +## Citing PythonTurtle + +If you refer to PythonTurtle in academic work, please use this citation format: + +```bibtex +@misc{rachum2009pythonturtle, + author={Rachum, Ram and Bittner, Peter}, + title={PythonTurtle: A learning environment for Python suited for beginners and children, inspired by Logo}, + month={may}, + year={2009}, + publisher={GitHub}, + doi={10.5281/zenodo.10465283}, + url={https://github.com/PythonTurtle/PythonTurtle/} +} +``` + + +## License This project is licensed under the MIT license. -PythonTurtle was created by Ram Rachum as a side-project in 2009. I also provide -[freelance Django/Python development services](https://chipmunkdev.com). I [give Python workshops](http://pythonworkshops.co/) to teach people Python and related topics. ([Hebrew website](http://pythonworkshops.co.il/).) + + From 4ded6c8678c5caa51cc1c10eecd0bc7b9cd2364f Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sat, 13 Jan 2024 09:28:04 -0800 Subject: [PATCH 66/66] Fix citation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6df0de8..609b454 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ If you refer to PythonTurtle in academic work, please use this citation format: ```bibtex @misc{rachum2009pythonturtle, - author={Rachum, Ram and Bittner, Peter}, + author={Rachum, Ram and Bittner, Peter and others}, title={PythonTurtle: A learning environment for Python suited for beginners and children, inspired by Logo}, month={may}, year={2009},