From 74b04d284b85be1c80f51642790bf0db9136865d Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Fri, 5 Oct 2018 07:34:09 +0300 Subject: [PATCH 01/37] Add an activestate.yaml for `shnewto/learn-python` (and update docs with `state activate` command) --- README.md | 41 +++++++++++-------- activestate.yaml | 4 ++ ...t_file_methdos.py => test_file_methods.py} | 0 src/modules/test_modules.py | 17 ++++++++ src/modules/test_packages.py | 23 ++++++++--- 5 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 activestate.yaml rename src/files/{test_file_methdos.py => test_file_methods.py} (100%) diff --git a/README.md b/README.md index b5da6a3c..dcd67f13 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ [![Build Status](https://travis-ci.org/trekhleb/learn-python.svg?branch=master)](https://travis-ci.org/trekhleb/learn-python) -> This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain +> This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. -It is a **playground** because you may change or add the code to see how it works -and [test it out](#testing-the-code) using assertions. It also allows you +It is a **playground** because you may change or add the code to see how it works +and [test it out](#testing-the-code) using assertions. It also allows you to [lint the code](#linting-the-code) you've wrote and check if it fits to Python code style guide. -Altogether it might make your learning process to be more interactive and it might help you to keep +Altogether it might make your learning process to be more interactive and it might help you to keep code quality pretty high from very beginning. -It is a **cheatsheet** because you may get back to these code examples once you want to recap the -syntax of [standard Python statements and constructions](#table-of-contents). Also because the +It is a **cheatsheet** because you may get back to these code examples once you want to recap the +syntax of [standard Python statements and constructions](#table-of-contents). Also because the code is full of assertions you'll be able to see expected functions/statements output right away without launching them. @@ -31,14 +31,14 @@ Here might go more detailed explanation of the current topic (i.e. general info def test_list_type(): """Explanation of sub-topic goes here. - + Each file contains test functions that illustrate sub-topics (i.e. lists type, lists methods). """ - + # Here is an example of how to build a list. <-- Comments here explain the action squares = [1, 4, 9, 16, 25] - - # Lists can be indexed and sliced. + + # Lists can be indexed and sliced. # Indexing returns the item. assert squares[0] == 1 # <-- Assertions here illustrate the result. # Slicing returns a new list. @@ -48,10 +48,10 @@ def test_list_type(): So normally you might want to do the following: - [Find the topic](#table-of-contents) you want to learn or recap. -- Read comments and/or documentation that is linked in each script's docstring (as in example above). +- Read comments and/or documentation that is linked in each script's docstring (as in example above). - Look at code examples and assertions to see usage examples and expected output. - Change code or add new assertions to see how things work. -- [Run tests](#testing-the-code) and [lint the code](#linting-the-code) to see if it work and is +- [Run tests](#testing-the-code) and [lint the code](#linting-the-code) to see if it work and is written correctly. ## Table of Contents @@ -107,10 +107,10 @@ written correctly. - [Packages](src/modules/test_packages.py) 8. **Errors and Exceptions** - [Handling Exceptions](src/exceptions/test_handle_exceptions.py) (`try` statement) - - [Raising Exceptions](src/exceptions/test_raise_exceptions.py) (`raise` statement) + - [Raising Exceptions](src/exceptions/test_raise_exceptions.py) (`raise` statement) 9. **Files** - [Reading and Writing](src/files/test_file_reading.py) (`with` statement) - - [Methods of File Objects](src/files/test_file_methdos.py) + - [Methods of File Objects](src/files/test_file_methods.py) 10. **Additions** - [The `pass` statement](src/additions/test_pass.py) - [Generators](src/additions/test_generators.py) (`yield` statement) @@ -122,6 +122,7 @@ written correctly. - [Dates and Times](src/standard_libraries/test_datetime.py) (`datetime` library) - [Data Compression](src/standard_libraries/test_zlib.py) (`zlib` library) + ## Prerequisites **Installing Python** @@ -129,8 +130,8 @@ written correctly. Make sure that you have [Python3 installed](https://realpython.com/installing-python/) on your machine. You might want to use [venv](https://docs.python.org/3/library/venv.html) standard Python library -to create virtual environments and have Python, pip and all dependent packages to be installed and -served from the local project directory to avoid messing with system wide packages and their +to create virtual environments and have Python, pip and all dependent packages to be installed and +served from the local project directory to avoid messing with system wide packages and their versions. Depending on your installation you might have access to Python3 interpreter either by @@ -153,6 +154,12 @@ Install all dependencies that are required for the project by running: pip install -r requirements.txt ``` +**Alternative approach** + +On Linux and have ActiveState's [state tool](http://docs.activestate.com/platform/start/state.html)? +- After cloning this repository, just `cd` into it and run `state activate` + + ## Testing the Code Tests are made using [pytest](https://docs.pytest.org/en/latest/) framework. @@ -185,7 +192,7 @@ to [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide please run: pylint ./src/ ``` -In case if linter will detect error (i.e. `missing-docstring`) you may want to read more about +In case if linter will detect error (i.e. `missing-docstring`) you may want to read more about specific error by running: ```bash diff --git a/activestate.yaml b/activestate.yaml new file mode 100644 index 00000000..b3a6003a --- /dev/null +++ b/activestate.yaml @@ -0,0 +1,4 @@ +name: learn-python +owner: ActiveState +languages: +- name: python diff --git a/src/files/test_file_methdos.py b/src/files/test_file_methods.py similarity index 100% rename from src/files/test_file_methdos.py rename to src/files/test_file_methods.py diff --git a/src/modules/test_modules.py b/src/modules/test_modules.py index 9160446e..7f919d61 100644 --- a/src/modules/test_modules.py +++ b/src/modules/test_modules.py @@ -14,6 +14,23 @@ A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended. Within a module, the module’s name (as a string) is available as the value of the global variable __name__. + +When the interpreter executes the import statement, it searches for module in a list of +directories assembled from the following sources: + +- The directory from which the input script was run or the current directory if the interpreter is +being run interactively +- The list of directories contained in the PYTHONPATH environment variable, if it is set. (The +format for PYTHONPATH is OS-dependent but should mimic the PATH environment variable.) +- An installation-dependent list of directories configured at the time Python is installed + +The resulting search path is accessible in the Python variable sys.path, which is obtained from a +module named sys: + +>>> import sys +>>> sys.path + +@see: https://realpython.com/python-modules-packages/ """ # This does not enter the names of the functions defined in fibonacci_module directly in the diff --git a/src/modules/test_packages.py b/src/modules/test_packages.py index 6fec2ec1..74db9448 100644 --- a/src/modules/test_packages.py +++ b/src/modules/test_packages.py @@ -13,13 +13,24 @@ valid modules that occur later on the module search path. In the simplest case, __init__.py can just be an empty file, but it can also execute initialization code for the package or set the __all__ variable, described later. -""" -# The __init__.py files are required to make Python treat the directories as containing packages; -# this is done to prevent directories with a common name, such as string, from unintentionally -# hiding valid modules that occur later on the module search path. In the simplest case, -# __init__.py can just be an empty file, but it can also execute initialization code for the -# package or set the __all__ variable, described later. +When the interpreter executes the import statement, it searches for module in a list of +directories assembled from the following sources: + +- The directory from which the input script was run or the current directory if the interpreter is +being run interactively +- The list of directories contained in the PYTHONPATH environment variable, if it is set. (The +format for PYTHONPATH is OS-dependent but should mimic the PATH environment variable.) +- An installation-dependent list of directories configured at the time Python is installed + +The resulting search path is accessible in the Python variable sys.path, which is obtained from a +module named sys: + +>>> import sys +>>> sys.path + +@see: https://realpython.com/python-modules-packages/ +""" # Users of the package can import individual modules from the package, for example. import sound_package.effects.echo From edb9854234e3e9f9ba9d590af7a12c5ac3ae4843 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 14:14:36 -0700 Subject: [PATCH 02/37] update activestate.yaml to reflect current requirements of the state tool --- activestate.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/activestate.yaml b/activestate.yaml index b3a6003a..2d6907c0 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,3 @@ -name: learn-python -owner: ActiveState +project: https://platform.activestate.com/shnewto/learn-python?commitID=c3e759c8-6b60-441c-ad84-7628a4fb542f languages: - name: python From 9d657ae09ae7768f0d5d8253654ce34f81ddbf42 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 15:27:28 -0700 Subject: [PATCH 03/37] see about setting the state tool up on travis --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b4c45a7e..630bdfd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,10 @@ python: # Install dependencies. install: - - pip install -r requirements.txt + - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) + +before_script: + - state activate # Run linting and tests. script: From 1fa7ed04a85c1cf98d540c8b459a71955e6b895a Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 15:48:01 -0700 Subject: [PATCH 04/37] don't prompt for info on CI state tool install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 630bdfd3..1aba6d58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ python: # Install dependencies. install: - - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) + - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh -n) before_script: - state activate From 12764980e5c4e81fbadbd7de816e00176d0b1b86 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 15:55:30 -0700 Subject: [PATCH 05/37] got the -n flag wrong --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1aba6d58..7659b1e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ python: # Install dependencies. install: - - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh -n) + - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n before_script: - state activate From 22b175287645c586780931e3b4b3037c4dc49883 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 16:10:29 -0700 Subject: [PATCH 06/37] get some verbose reporting --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7659b1e9..6ed1aaf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ install: - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n before_script: + - export VERBOSE=true - state activate # Run linting and tests. From b008225f55cb61d22317b3367e7668fb0e4fcb51 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 17:03:21 -0700 Subject: [PATCH 07/37] don't state activate, state run instead --- .travis.yml | 7 ++----- activestate.yaml | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ed1aaf2..e6cca574 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,11 @@ install: - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n before_script: - - export VERBOSE=true - - state activate # Run linting and tests. script: - - pylint ./src - - flake8 ./src --statistics --count - - pytest + - state run lints + - state run tests # Turn email notifications off. notifications: diff --git a/activestate.yaml b/activestate.yaml index 2d6907c0..e2e130a0 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,3 +1,10 @@ project: https://platform.activestate.com/shnewto/learn-python?commitID=c3e759c8-6b60-441c-ad84-7628a4fb542f languages: - name: python +scripts: + - name: tests + value: pytest + - name: lints + value: | + pylint ./src + flake8 ./src --statistics --count \ No newline at end of file From 11d56f5ffdad518bbd9245df0dfdbe72702183ab Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 17:28:15 -0700 Subject: [PATCH 08/37] don't point to python 3.6 in travis file --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e6cca574..8be5f873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,3 @@ -language: python -python: - - "3.6" - # Install dependencies. install: - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n From 6875d07607450a65172f42371b5cbe25baf51ddd Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 17:37:19 -0700 Subject: [PATCH 09/37] replace badge link so I don't mistake a broken experiment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcd67f13..6994077c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Playground and Cheatsheet for Learning Python -[![Build Status](https://travis-ci.org/trekhleb/learn-python.svg?branch=master)](https://travis-ci.org/trekhleb/learn-python) +[![Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) > This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. From 655611a62857b24622e98d5ae45a2b8d44d363bd Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 1 Nov 2019 17:52:11 -0700 Subject: [PATCH 10/37] Add windows build status just to see if we can get it --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6994077c..983cc39a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Playground and Cheatsheet for Learning Python -[![Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) +[![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) +[![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t?svg=true)](https://ci.appveyor.com/project/shnewto/learn-python) > This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. From c37c4471fbbebe635b387af77c54bf7fff2c887a Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 22 Nov 2019 10:43:21 -0800 Subject: [PATCH 11/37] Update activestate.yaml --- activestate.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/activestate.yaml b/activestate.yaml index e2e130a0..b77d71a7 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -3,8 +3,10 @@ languages: - name: python scripts: - name: tests - value: pytest + value: | + where pytest + pytest - name: lints value: | pylint ./src - flake8 ./src --statistics --count \ No newline at end of file + flake8 ./src --statistics --count From 5471dc9f6e2403266163213778ae54eb4a4608d2 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 22 Nov 2019 11:25:13 -0800 Subject: [PATCH 12/37] Update activestate.yaml --- activestate.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index b77d71a7..a2e91ec5 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -4,7 +4,6 @@ languages: scripts: - name: tests value: | - where pytest pytest - name: lints value: | From 507cdbfb8f404dba36232e5ebabe4f5bfb11a967 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Sat, 2 Nov 2019 16:23:29 -0700 Subject: [PATCH 13/37] test out some windows builds using an appveyor script --- activestate.yaml | 11 ++++++---- appveyor.yml | 21 +++++++++++++++++++ src/additions/test_pass.py | 5 +++-- src/classes/test_instance_objects.py | 2 +- .../test_function_documentation_string.py | 1 + src/standard_libraries/test_glob.py | 9 +++++--- 6 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 appveyor.yml diff --git a/activestate.yaml b/activestate.yaml index e2e130a0..01ae7672 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,10 +1,13 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=c3e759c8-6b60-441c-ad84-7628a4fb542f +project: https://platform.activestate.com/shnewto/learn-python?commitID=2d0ab259-6bfa-40ac-8e8d-823fa9a2afeb languages: - name: python scripts: + - name: noop + value: rundll32 - name: tests - value: pytest + value: | + pytest - name: lints value: | - pylint ./src - flake8 ./src --statistics --count \ No newline at end of file + pylint src + flake8 src --statistics --count diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..e53567c8 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,21 @@ +version: 1.0.{build} +image: Visual Studio 2019 +init: +- ps: '' +environment: + ACTIVESTATE_API_KEY: + secure: QJFsdrY+1/HG+FmPJAAEvecizAWmG1b3aCqk5ab7Cb7QeJOX+shcoG/i33D7NLQHQWXyrfhTjyqT7kbtzLdv1xwFeIqjNyNnJwEVctW4iAM= + ACTIVESTATE_PRIVATE_KEY: + secure: DxsFsAuLfURBInq/G5c6GWTSEDfCmw7/blgS3Ft14R1w3JU7D3KhL5mqDucEe3LVIBLMtKe8BGkVOQj0xWcEIcYtgorPVq75La02O8zJdV00RH8MhKadz9IoSvHg4WuotCi5g7KemBkvaV1cV22rKRyrvzt+x3XBHU4c73nqjYWqHF+IcfpM2Fw8QnaF0MyWTV7/it8Ucfnid+9HL7K3z4lp5QCww0dg7dZ+Kj7QiO2hYosgQw/223OZgE3mjBeqlilcdjV0Irwu7SJgBiuBWKe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PA7bEea7eHDUxxI13LHuza8CCcLfPVdZ7wKv2d4LgQIfSoEnhZjqd0Bh7e+KK+LtcbshfCkkdxvbtdlwZhhPuKrax+9I6Ida5Ws5sXEJTLDbs6D8xHcSoQ/KBRJZBGAMzkGDkdbvftMdWRwv25iUOGw1TZjApcv0y00f78JtERaBcddQvufrsYquumMLbc7eAvBysZWZ33T11RJ2D+CqEboaiCkL49FDPq6iaRWbQVroCHEQEIUYP8dPvypOtA9kfcTY+RDUKOpvv0mBsUsUubF9dVk6TnctYtZRlROUxyRjdBOts4Dx9P9sngLUJYmLyDtXpte0rpdHS5NS5uDbAUqorMuSjdLuajGWopBCkZJOVFw7aYA1/E597w3ngjDcUNxcr0FXU3dSiwNJOLlOVSgJEzLsGQ7qinHkC499NYyAIaxciV6jk5VtS4fxSvY38/wjVLBPPRU2yALkVBFm00VM4ogwlHPTdpuo7cEYMZvBkNdmtzdzSM1WEes10uc0XMayU4btb/efGmfYSgIHs3fh6Xm0sQfctiS2L3cbTgPKhTHpFcVP/UCHkxs3W5Sb0IZXYT2yUQzSey6ydlqiusthWjwF9umvR3MqG5sCBX5t++MNTYnM60IXUyBOEBuRszwyY94kPANpoYp+qofewerOhC26qzQS81/VZIM+1y82NV20t6WU60XrIyx9UyF+fS3Hw== +install: +- ps: >- + (New-Object Net.WebClient).DownloadFile('https://platform.activestate.com/dl/cli/install.ps1', 'install.ps1') + + Invoke-Expression "install.ps1 -n" +build_script: +- cmd: state --version +test_script: +- cmd: >- + state run lints + + state run tests diff --git a/src/additions/test_pass.py b/src/additions/test_pass.py index 57a6de9b..2654ec72 100644 --- a/src/additions/test_pass.py +++ b/src/additions/test_pass.py @@ -7,6 +7,7 @@ """ +# pylint: disable=unnecessary-pass def test_pass_in_function(): """PASS statement in function @@ -25,7 +26,7 @@ def test_pass_in_loop(): action. For example: """ - # pylint: disable=unused-variable + # pylint: disable=unused-variable, unnecessary-pass for number in range(100): # It just don't do anything but for loop is still valid. pass @@ -37,7 +38,7 @@ def test_pass_in_loop(): # pass # Busy-wait for keyboard interrupt (Ctrl+C) -# pylint: disable=too-few-public-methods +# pylint: disable=too-few-public-methods, unnecessary-pass class MyEmptyClass: """PASS statement in class diff --git a/src/classes/test_instance_objects.py b/src/classes/test_instance_objects.py index e58dc343..7c85c75d 100644 --- a/src/classes/test_instance_objects.py +++ b/src/classes/test_instance_objects.py @@ -17,7 +17,7 @@ def test_instance_objects(): # they are first assigned to. For example, if x is the instance of MyCounter created above, # the following piece of code will print the value 16, without leaving a trace. - # pylint: disable=too-few-public-methods + # pylint: disable=too-few-public-methods, unnecessary-pass class DummyClass: """Dummy class""" pass diff --git a/src/functions/test_function_documentation_string.py b/src/functions/test_function_documentation_string.py index b20d11a9..7e66c6d2 100644 --- a/src/functions/test_function_documentation_string.py +++ b/src/functions/test_function_documentation_string.py @@ -15,6 +15,7 @@ """ +# pylint: disable=unnecessary-pass def do_nothing(): """Do nothing, but document it. diff --git a/src/standard_libraries/test_glob.py b/src/standard_libraries/test_glob.py index c236f73c..ae6d5200 100644 --- a/src/standard_libraries/test_glob.py +++ b/src/standard_libraries/test_glob.py @@ -6,6 +6,7 @@ """ import glob +import os def test_glob(): @@ -15,7 +16,9 @@ def test_glob(): # In some cases (like on Linux Mint, python3.6) the glob() function returns list # in reverse order then it might be expected. Thus lets sort both lists before comparison # using sorted() built-in function. - assert sorted(glob.glob('src/standard_libraries/glob_files/*.txt')) == sorted([ - 'src/standard_libraries/glob_files/first_file.txt', - 'src/standard_libraries/glob_files/second_file.txt' + + path = os.path.join('src', 'standard_libraries', 'glob_files') + assert sorted(glob.glob(os.path.join(path, '*.txt'))) == sorted([ + os.path.join(path, 'first_file.txt'), + os.path.join(path, 'second_file.txt') ]) From 7dde0ef064d959d4c83c2b02293f389fa5430757 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 13:02:06 -0800 Subject: [PATCH 14/37] some build configurations changed and required a new build, this commit updated the project to point at that new build --- activestate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index e2e130a0..f6e4c084 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=c3e759c8-6b60-441c-ad84-7628a4fb542f +project: https://platform.activestate.com/shnewto/learn-python?commitID=3ea64485-11cc-45a0-9b5e-5f32ecbe973e languages: - name: python scripts: From 6c70c1a5fbda13d5d68afbc76baf2e283a4c0295 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 15:12:19 -0800 Subject: [PATCH 15/37] Update activestate.yaml --- activestate.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index f549d5eb..7663c6a6 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=3ea64485-11cc-45a0-9b5e-5f32ecbe973e +project: https://platform.activestate.com/shnewto/learn-python?commitID=2d0ab259-6bfa-40ac-8e8d-823fa9a2afeb languages: - name: python scripts: @@ -11,3 +11,6 @@ scripts: value: | pylint src flake8 src --statistics --count + + + From 8ade54ee4d689b794a0c4f635cf5e292d0da6a00 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 15:14:49 -0800 Subject: [PATCH 16/37] Update appveyor.yml --- appveyor.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e53567c8..0236d1f1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,20 +2,13 @@ version: 1.0.{build} image: Visual Studio 2019 init: - ps: '' -environment: - ACTIVESTATE_API_KEY: - secure: QJFsdrY+1/HG+FmPJAAEvecizAWmG1b3aCqk5ab7Cb7QeJOX+shcoG/i33D7NLQHQWXyrfhTjyqT7kbtzLdv1xwFeIqjNyNnJwEVctW4iAM= - ACTIVESTATE_PRIVATE_KEY: - secure: DxsFs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GWSNYaSrlDK6i6C79cck8FEcWQhM5EmJNPOn8O9vY5tlT+y4p+k1fpSNOZDr/8Sdb2AF06IbPBkTcP7DbGjnsSmMiHQydClQMSzto3XDE+wh82YV1ilfLNjFy+Yc5iAk2l97YbkIk+ubPpZaOgKSSR3II9LzxYvkoHT4RDYLIaJ4sv7Bfy7v6hBLd7dKx1W6nFLFt6n1N9OuJNLTrPiLnsd6iZOFzot3Lwh6I5ObD/vlRjqnwsGklXmscL2SiWfbZ5asNrH3PA7bEea7eHDUxxI13LHuza8CCcLfPVdZ7wKv2d4LgQIfSoEnhZjqd0Bh7e+KK+LtcbshfCkkdxvbtdlwZhhPuKrax+9I6Ida5Ws5sXEJTLDbs6D8xHcSoQ/KBRJZBGAMzkGDkdbvftMdWRwv25iUOGw1TZjApcv0y00f78JtERaBcddQvufrsYquumMLbc7eAvBysZWZ33T11RJ2D+CqEboaiCkL49FDPq6iaRWbQVroCHEQEIUYP8dPvypOtA9kfcTY+RDUKOpvv0mBsUsUubF9dVk6TnctYtZRlROUxyRjdBOts4Dx9P9sngLUJYmLyDtXpte0rpdHS5NS5uDbAUqorMuSjdLuajGWopBCkZJOVFw7aYA1/E597w3ngjDcUNxcr0FXU3dSiwNJOLlOVSgJEzLsGQ7qinHkC499NYyAIaxciV6jk5VtS4fxSvY38/wjVLBPPRU2yALkVBFm00VM4ogwlHPTdpuo7cEYMZvBkNdmtzdzSM1WEes10uc0XMayU4btb/efGmfYSgIHs3fh6Xm0sQfctiS2L3cbTgPKhTHpFcVP/UCHkxs3W5Sb0IZXYT2yUQzSey6ydlqiusthWjwF9umvR3MqG5sCBX5t++MNTYnM60IXUyBOEBuRszwyY94kPANpoYp+qofewerOhC26qzQS81/VZIM+1y82NV20t6WU60XrIyx9UyF+fS3Hw== install: - ps: >- (New-Object Net.WebClient).DownloadFile('https://platform.activestate.com/dl/cli/install.ps1', 'install.ps1') - Invoke-Expression "install.ps1 -n" build_script: - cmd: state --version test_script: - cmd: >- state run lints - state run tests From 42533306fa9a510628574966a82db3bb78098522 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 15:16:31 -0800 Subject: [PATCH 17/37] Update appveyor.yml --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 0236d1f1..01f832fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,10 +5,12 @@ init: install: - ps: >- (New-Object Net.WebClient).DownloadFile('https://platform.activestate.com/dl/cli/install.ps1', 'install.ps1') + Invoke-Expression "install.ps1 -n" build_script: - cmd: state --version test_script: - cmd: >- state run lints + state run tests From 8e93bc8c62edd1ddd4439117d58e16cc5227b398 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 15:18:44 -0800 Subject: [PATCH 18/37] Update activestate.yaml --- activestate.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/activestate.yaml b/activestate.yaml index 7663c6a6..01ae7672 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -11,6 +11,3 @@ scripts: value: | pylint src flake8 src --statistics --count - - - From cfd24545219ba6a4862f0e14838499f8af0c81f4 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 16:36:55 -0800 Subject: [PATCH 19/37] Update activestate.yaml --- activestate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index 01ae7672..0efc23e4 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=2d0ab259-6bfa-40ac-8e8d-823fa9a2afeb +project: https://platform.activestate.com/shnewto/learn-python?commitID=cefb137b-df52-4825-a2a4-8e9563f22bf1 languages: - name: python scripts: From 341d3a6c93a6ec171296499a0a72ba3cb78e2089 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Thu, 5 Dec 2019 17:13:11 -0800 Subject: [PATCH 20/37] Update activestate.yaml --- activestate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index 0efc23e4..026697a7 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=cefb137b-df52-4825-a2a4-8e9563f22bf1 +project: https://platform.activestate.com/shnewto/learn-python?commitID=acdf14c9-6f90-4c19-8649-ac53175298fb languages: - name: python scripts: From 14f7c2b3b08a05247442be4d92a114bb75782342 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 6 Dec 2019 13:31:14 -0800 Subject: [PATCH 21/37] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 983cc39a..d11ee217 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Playground and Cheatsheet for Learning Python [![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) -[![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t?svg=true)](https://ci.appveyor.com/project/shnewto/learn-python) +[![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t?svg=true)](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t/branch/activestate-platform-and-state-tool-setup +) > This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. From 3577faf25b0b637a97abe5c88f17364345915428 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 6 Dec 2019 13:33:33 -0800 Subject: [PATCH 22/37] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d11ee217..e546a212 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Playground and Cheatsheet for Learning Python [![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) -[![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t?svg=true)](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t/branch/activestate-platform-and-state-tool-setup -) +[![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t/branch/activestate-platform-and-state-tool-setup?svg=true)](https://ci.appveyor.com/project/shnewto/learn-python/branch/activestate-platform-and-state-tool-setup) > This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. From 115e6ebb7d65fc03565720ceac7a8b516cd586c8 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 13 Dec 2019 12:24:50 -0800 Subject: [PATCH 23/37] Update activestate.yaml --- activestate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index 026697a7..349dbbf8 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=acdf14c9-6f90-4c19-8649-ac53175298fb +project: https://platform.activestate.com/shnewto/learn-python?commitID=126bf98a-850d-4800-b7c6-7c394eefe483 languages: - name: python scripts: From e80088c39dfe330f5057d6a1815e0d2abe6b434a Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Fri, 27 Mar 2020 15:48:41 -0700 Subject: [PATCH 24/37] Adding new CI support (Github Actions and Jenkins) (#11) * Updating state tool install command * Fix extra quotation mark at end * Separate commands on 2 lines * Revert "Separate commands on 2 lines" This reverts commit 01822052328a785925956f73c1cdc251a379fdec. * Revert "Fix extra quotation mark at end" This reverts commit 1e27af0b9451d361a8726928bfb21666fd672d8b. * Revert "Updating state tool install command" This reverts commit 9426eb2897ca137cd107d80eb9ce7dc4f43c0a4c. * Create pythonapp.yml * Update pythonapp.yml * remove flake8 and pytest from pythonapp.yml * First try with state tool * Add env variable * Indent * powershell? * poweshell again * updated runs-on * add IEX * Try with custom shell command * two liner * Invoke-Expression * Try cmd * two liner again * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Remove macOS * Update pythonapp.yml * Add secrets * Create cloudbuild.yaml * Update pythonapp.yml * Update ${{ github.workspace }} * Update pythonapp.yml * workflow-level env variables * Update pythonapp.yml * Update activestate.yaml * added standalone * try separate activate * Activate after cache * Update pythonapp.yml * cleanup script * add hash to cache * Update pythonapp.yml * Add state pull * Remove multiple restore-keys * No changes * Update pythonapp.yml * Add Comments * More updates to comments * Try setpath * Remove windows-specific tests * ActivePython CI Script * Revert "Update activestate.yaml" This reverts commit 2e6cd0935325cce40e511e3a0b38df168fa86f4d. * Update pythonapp.yml * Update pythonapp.yml * ActivePython * Latest commit * First commit of Jenkinsfile * Update PATH * Remove $PATH * Remove shell * Remove sh * Update state pull * not Windows * Add tests * Add shell back * change shell to bash * Add cleanup * Uninstall State Tool * Add env * Update path * Added Jenkinsfile * No env * add env * test * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Remove Cleanup * Added Jenkinsfile * Added Jenkinsfile * Fixed extra ' around credentials * Update Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Update Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Update Jenkinsfile * Added Jenkinsfile * Testing * Test again * Update commit id --- .github/workflows/pythonapp.yml | 54 +++++++++++++++++++++++++++++++++ Jenkinsfile | 41 +++++++++++++++++++++++++ activestate.yaml | 2 +- cloudbuild.yaml | 16 ++++++++++ 4 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pythonapp.yml create mode 100644 Jenkinsfile create mode 100644 cloudbuild.yaml diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml new file mode 100644 index 00000000..47cdc57e --- /dev/null +++ b/.github/workflows/pythonapp.yml @@ -0,0 +1,54 @@ +# This is a basic workflow to help you get started with GitHub CI using ActivePython +name: ActivePython application on GitHub CI + +# Setting up Cache directory and ActiveState Platform API key +env: + ACTIVESTATE_CLI_CACHEDIR: ${{ github.workspace }}/.cache + ACTIVESTATE_API_KEY: ${{ secrets.ACTIVESTATE_API_KEY }} + +# Controls when the action will run. Triggers the workflow on push events on the default branch +on: [push] + +# A CI workflow is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on (this one is a matrix build) + runs-on: ${{ matrix.os }} + strategy: + matrix: + # Building on both Windows and Linux(Ubuntu) simultaneously + os: [windows-latest, ubuntu-latest] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + # Installing State Tool on Windows via Powershell + - name: Install State Tool (Windows) + if: matrix.os == 'windows-latest' + run: | + (New-Object Net.WebClient).DownloadFile('https://platform.activestate.com/dl/cli/install.ps1', 'install.ps1'); + Invoke-Expression -Command "$Env:GITHUB_WORKSPACE\install.ps1 -n -t $Env:GITHUB_WORKSPACE" + echo "::add-path::$Env:GITHUB_WORKSPACE" + # Installing State Tool on Linux with default shell behavior + - name: Install State Tool (Linux) + if: matrix.os != 'windows-latest' + run: sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n + # Checking ActiveState Platform for project updates + - name: Update project + run: state pull + # Caching downloaded build using GitHub CI cache + - name: Cache state tool cache + uses: actions/cache@v1 + env: + cache-name: cache-platform-build + with: + path: ${{ env.ACTIVESTATE_CLI_CACHEDIR }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('activestate.yaml') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }} + # Execute linting of the project on ActivePython + - name: Lint with flake8 + run: state run lints + # Running project tests using pytest on ActivePython + - name: Test with pytest + run: state run tests diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..d87d4199 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,41 @@ +pipeline { + agent any + stages { + stage('Install State Tool') { + steps { + sh '''curl -q https://platform.activestate.com/dl/cli/install.sh -o install.sh +chmod +x install.sh +./install.sh -n -t $WORKSPACE || true''' + } + } + + stage('Authenticate with Platform') { + steps { + sh '$WORKSPACE/state auth --token $ACTIVESTATE_API_KEY' + } + } + + stage('Update Project') { + steps { + sh '$WORKSPACE/state pull' + } + } + + stage('Lint') { + steps { + sh '$WORKSPACE/state run lints' + } + } + + stage('Test') { + steps { + sh '$WORKSPACE/state run tests' + } + } + + } + environment { + SHELL = '/bin/bash' + ACTIVESTATE_API_KEY = credentials('api-key') + } +} \ No newline at end of file diff --git a/activestate.yaml b/activestate.yaml index 349dbbf8..620c1c58 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=126bf98a-850d-4800-b7c6-7c394eefe483 +project: https://platform.activestate.com/shnewto/learn-python?commitID=a826e5ab-d2e7-4275-a0b7-00639847ae32 languages: - name: python scripts: diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 00000000..627a7cf9 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,16 @@ +steps: +- name: docker.io/activestate/state_gcb + args: ['state', 'run', 'prepare'] +- name: docker.io/activestate/state_gcb + args: ['state', 'run', 'recipe'] +- name: docker.io/activestate/state_gcb + args: ['state', 'auth'] +artifacts: + objects: + location: 'gs://activestate_test_artifacts/' + paths: ['output'] +options: + env: + - 'ACTIVESTATE_CLI_DISABLE_UPDATES=true' + - 'ACTIVESTATE_CLI_CONFIGDIR=/workspace/.cfg' + - 'ACTIVESTATE_CLI_CACHEDIR=/workspace/.cache' From d540833403634ecbed5d05951c9a50d91508ed40 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Wed, 29 Apr 2020 10:10:27 -0700 Subject: [PATCH 25/37] Make it clear that this repo is a fork --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e546a212..bd43af41 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +## A fork of the [learn-python](https://github.com/trekhleb/learn-python) project used to explore ways to use the ActiveState Platform and its CLI the State Tool. +If you're here to explore and experiment with he ActiveState Platform and its CLI the State Tool, welcome! If you didn't know you were interested but are now, welcome! + +But if you're looking to learn python or contribute to the learn-python project, [the original repo](https://github.com/trekhleb/learn-python) is the right place for you. It'll always be up to date, the maintainer is able to tackle issues and PRs, and it for sure deserves all the credit for the value it provides to the community :smile: + + # Playground and Cheatsheet for Learning Python [![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) From b0bbbf738624705a25d4da002150e3db2811fbe2 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Wed, 29 Apr 2020 10:14:17 -0700 Subject: [PATCH 26/37] links to state tool and platform Provide links to the platform and the state tool where we're qualifying the reason for the fork --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd43af41..63c665fd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ## A fork of the [learn-python](https://github.com/trekhleb/learn-python) project used to explore ways to use the ActiveState Platform and its CLI the State Tool. -If you're here to explore and experiment with he ActiveState Platform and its CLI the State Tool, welcome! If you didn't know you were interested but are now, welcome! +If you're here to explore and experiment with he [ActiveState Platform](https://platform.activestate.com/shnewto/learn-python) and its CLI the [State Tool](https://www.activestate.com/products/platform/state-tool), welcome! If you didn't know you were interested but are now, welcome! But if you're looking to learn python or contribute to the learn-python project, [the original repo](https://github.com/trekhleb/learn-python) is the right place for you. It'll always be up to date, the maintainer is able to tackle issues and PRs, and it for sure deserves all the credit for the value it provides to the community :smile: From 77298788340d26ace86572f83e5d329b286c2fbe Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Wed, 29 Apr 2020 10:15:00 -0700 Subject: [PATCH 27/37] small working change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63c665fd..7e201683 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## A fork of the [learn-python](https://github.com/trekhleb/learn-python) project used to explore ways to use the ActiveState Platform and its CLI the State Tool. If you're here to explore and experiment with he [ActiveState Platform](https://platform.activestate.com/shnewto/learn-python) and its CLI the [State Tool](https://www.activestate.com/products/platform/state-tool), welcome! If you didn't know you were interested but are now, welcome! -But if you're looking to learn python or contribute to the learn-python project, [the original repo](https://github.com/trekhleb/learn-python) is the right place for you. It'll always be up to date, the maintainer is able to tackle issues and PRs, and it for sure deserves all the credit for the value it provides to the community :smile: +But if you're simply looking to learn python or contribute to the learn-python project, [the original repo](https://github.com/trekhleb/learn-python) is the right place for you. It'll always be up to date, the maintainer is able to tackle issues and PRs, and it for sure deserves all the credit for the value it provides to the community :smile: # Playground and Cheatsheet for Learning Python From 808ab57848976db07ce1ce0050d1a2e69839f7d2 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Wed, 29 Apr 2020 10:24:14 -0700 Subject: [PATCH 28/37] don't need linux qualification the state tool and the platform work on Mac OS and Windows now. Also we've got a better link for getting started with / learning about the state tool. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e201683..8ee2340b 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ pip install -r requirements.txt **Alternative approach** -On Linux and have ActiveState's [state tool](http://docs.activestate.com/platform/start/state.html)? +Have ActiveState's [State Tool](https://www.activestate.com/products/platform/state-tool/)? - After cloning this repository, just `cd` into it and run `state activate` From 2fafeebaa4684d4629c970ebc0e77079c97f3000 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Fri, 15 May 2020 13:58:07 -0700 Subject: [PATCH 29/37] New CI support (#13) * Updating state tool install command * Fix extra quotation mark at end * Separate commands on 2 lines * Revert "Separate commands on 2 lines" This reverts commit 01822052328a785925956f73c1cdc251a379fdec. * Revert "Fix extra quotation mark at end" This reverts commit 1e27af0b9451d361a8726928bfb21666fd672d8b. * Revert "Updating state tool install command" This reverts commit 9426eb2897ca137cd107d80eb9ce7dc4f43c0a4c. * Create pythonapp.yml * Update pythonapp.yml * remove flake8 and pytest from pythonapp.yml * First try with state tool * Add env variable * Indent * powershell? * poweshell again * updated runs-on * add IEX * Try with custom shell command * two liner * Invoke-Expression * Try cmd * two liner again * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Remove macOS * Update pythonapp.yml * Add secrets * Create cloudbuild.yaml * Update pythonapp.yml * Update ${{ github.workspace }} * Update pythonapp.yml * workflow-level env variables * Update pythonapp.yml * Update activestate.yaml * added standalone * try separate activate * Activate after cache * Update pythonapp.yml * cleanup script * add hash to cache * Update pythonapp.yml * Add state pull * Remove multiple restore-keys * No changes * Update pythonapp.yml * Add Comments * More updates to comments * Try setpath * Remove windows-specific tests * ActivePython CI Script * Revert "Update activestate.yaml" This reverts commit 2e6cd0935325cce40e511e3a0b38df168fa86f4d. * Update pythonapp.yml * Update pythonapp.yml * ActivePython * Latest commit * First commit of Jenkinsfile * Update PATH * Remove $PATH * Remove shell * Remove sh * Update state pull * not Windows * Add tests * Add shell back * change shell to bash * Add cleanup * Uninstall State Tool * Add env * Update path * Added Jenkinsfile * No env * add env * test * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Remove Cleanup * Added Jenkinsfile * Added Jenkinsfile * Fixed extra ' around credentials * Update Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Update Jenkinsfile * Added Jenkinsfile * Added Jenkinsfile * Update Jenkinsfile * Added Jenkinsfile * Testing * Test again * Update commit id * Add GitHub CI badge * Update README.md * Update README.md * add state pull * Remove commit id * Add state pull * Update testing steps * Try state deploy support * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * Update cloudbuild.yaml * With no options * Create .gitlab-ci.yml * Use state deploy * Try alpine image * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Revert "Update .gitlab-ci.yml" This reverts commit 9f382f8f18d95a6c412f4e3f3d3fcecd9537d5c8. * Revert back to state deploy * Put ls after state deploy * Try again * Can only cache local dirs * Update .gitlab-ci.yml * Maybe we need full path for state deploy * Add --force * Try editor * No cache * Try with default GitLab python * Change python version * Try with 3.8.1 * Back to 3.7 * Revert to state tool install * Delete pip version * Change platform project * Add macos * Revert "Add macos" This reverts commit fcd49546d0d8c08ce089294a8dccbc36fba37e53. * Clean up activestate.yaml Single line linting with && is required to account for the error returning behaviour difference between cmd and bash * test failing build * test failing build * windows only * Revert back to normal * Revert to normal * Try state deploy * Try workaround * Try mac again * Update pythonapp.yml * Add cmd * Deploy to workspace on mac * Set fail-fast to false * Try deploying into Workspace * OS-dependent deploys * Update pythonapp.yml * Fix mac path * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Update pythonapp.yml * Verify cause of failure * Remove commented out options from state deploy * Revert changes * Not needed for this PR * Delete Jenkinsfile * Delete pythonapp.yml * Update README.md Co-authored-by: Nathan Rijksen Co-authored-by: Shea Newton --- .gitlab-ci.yml | 27 +++++++++++++++++++++++++++ .travis.yml | 2 +- README.md | 3 ++- activestate.yaml | 17 +++++++---------- appveyor.yml | 2 +- cloudbuild.yaml | 19 +++++++------------ 6 files changed, 45 insertions(+), 25 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..2d0dcbf7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,27 @@ +# Use Alpine + glibc image from Docker Hub +image: frolvlad/alpine-glibc + +# Optionally use caching (currenty it slows down instead of speeding up, so not using) +#cache: +# key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" +# paths: +# - workspace/.state/ + +before_script: +# Install state tool +# - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n +# We need to use the commands below due to install.sh having non-alpine dependencies (no curl) + - wget https://platform.activestate.com/dl/cli/install.sh + - chmod +x ./install.sh + - ./install.sh -n -t /usr/local/bin +# Authenticate with the platform using preset env variable (only required for private projects) +# - state auth +# Download and install the language runtime + - state deploy shnewto/learn-python +test: + script: +# Lint code + - pylint src + - flake8 src --statistics --count +# Test code + - pytest diff --git a/.travis.yml b/.travis.yml index 8be5f873..b13aea76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ install: - sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n before_script: - + - state pull # Run linting and tests. script: - state run lints diff --git a/README.md b/README.md index 8ee2340b..cc17c15c 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ But if you're simply looking to learn python or contribute to the learn-python p # Playground and Cheatsheet for Learning Python -[![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=master)](https://travis-ci.org/shnewto/learn-python) +[![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=activestate-platform-and-state-tool-setup)](https://travis-ci.org/shnewto/learn-python) [![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t/branch/activestate-platform-and-state-tool-setup?svg=true)](https://ci.appveyor.com/project/shnewto/learn-python/branch/activestate-platform-and-state-tool-setup) +[![Github Build Status](https://github.com/shnewto/learn-python/workflows/ActivePython%20application%20on%20GitHub%20CI/badge.svg?branch=activestate-platform-and-state-tool-setup)] > This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. diff --git a/activestate.yaml b/activestate.yaml index 620c1c58..a2ae009f 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,13 +1,10 @@ -project: https://platform.activestate.com/shnewto/learn-python?commitID=a826e5ab-d2e7-4275-a0b7-00639847ae32 +project: https://platform.activestate.com/shnewto/learn-python languages: - name: python scripts: - - name: noop - value: rundll32 - - name: tests - value: | - pytest - - name: lints - value: | - pylint src - flake8 src --statistics --count +- name: tests + description: Executes tests + value: pytest +- name: lints + description: Executes linting tools + value: pylint src && flake8 src --statistics --count diff --git a/appveyor.yml b/appveyor.yml index 01f832fb..4a1d7067 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ install: Invoke-Expression "install.ps1 -n" build_script: -- cmd: state --version +- cmd: state pull test_script: - cmd: >- state run lints diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 627a7cf9..2894c6ca 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -1,16 +1,11 @@ steps: - name: docker.io/activestate/state_gcb - args: ['state', 'run', 'prepare'] + args: ['state','auth'] - name: docker.io/activestate/state_gcb - args: ['state', 'run', 'recipe'] + args: ['state', 'deploy', 'shnewto/learn-python', '--path', '/workspace/.state'] - name: docker.io/activestate/state_gcb - args: ['state', 'auth'] -artifacts: - objects: - location: 'gs://activestate_test_artifacts/' - paths: ['output'] -options: - env: - - 'ACTIVESTATE_CLI_DISABLE_UPDATES=true' - - 'ACTIVESTATE_CLI_CONFIGDIR=/workspace/.cfg' - - 'ACTIVESTATE_CLI_CACHEDIR=/workspace/.cache' + args: ['pylint','src'] +- name: docker.io/activestate/state_gcb + args: ['flake8','src','--statistics','--count'] +- name: docker.io/activestate/state_gcb + args: ['pytest'] From 7a86c22a350ba0ab6dc7381fea78ec32805ed2f3 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Fri, 15 May 2020 15:04:12 -0600 Subject: [PATCH 30/37] Update README.md tweak github ci status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc17c15c..a12dbeda 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ But if you're simply looking to learn python or contribute to the learn-python p [![Linux Build Status](https://travis-ci.org/shnewto/learn-python.svg?branch=activestate-platform-and-state-tool-setup)](https://travis-ci.org/shnewto/learn-python) [![Windows Build status](https://ci.appveyor.com/api/projects/status/fgkvuy680gre708t/branch/activestate-platform-and-state-tool-setup?svg=true)](https://ci.appveyor.com/project/shnewto/learn-python/branch/activestate-platform-and-state-tool-setup) -[![Github Build Status](https://github.com/shnewto/learn-python/workflows/ActivePython%20application%20on%20GitHub%20CI/badge.svg?branch=activestate-platform-and-state-tool-setup)] +![ActivePython application on GitHub CI](https://github.com/shnewto/learn-python/workflows/ActivePython%20application%20on%20GitHub%20CI/badge.svg) > This is a collection of Python scripts that are split by [topics](#table-of-contents) and contain code examples with explanations, different use cases and links to further readings. From bed2c25f18aba2e82ceba53ab48520cf4c73d8c6 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Fri, 12 Jun 2020 09:55:55 -0700 Subject: [PATCH 31/37] Add Azure Pipelines --- azure-pipelines.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..4424690b --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,53 @@ +# Python application example with ActiveState Platform +trigger: +- activestate-platform-and-state-tool-setup +jobs: +- job: Linux + pool: + vmImage: 'ubuntu-latest' + steps: + - script: sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n + displayName: 'Install State Tool' + - script: state deploy shnewto/learn-python + displayName: 'Deploy project' + - script: pylint src + displayName: 'Lint with pylint' + - script: flake8 src --statistics --count + displayName: 'Lint with flake8' + - script: pytest + displayName: 'Test with pytest' +- job: macOS + pool: + vmImage: 'macOS-latest' + steps: + - script: sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n + displayName: 'Install State Tool' + - script: state deploy --force shnewto/learn-python + displayName: 'Deploy project' + - script: pylint src + displayName: 'Lint with pylint' + - script: flake8 src --statistics --count + displayName: 'Lint with flake8' + - script: pytest + displayName: 'Test with pytest' +- job: Windows + pool: + vmImage: 'windows-latest' + steps: + - powershell: | + (New-Object Net.WebClient).DownloadFile('https://platform.activestate.com/dl/cli/install.ps1', 'install.ps1') + Invoke-Expression -Command "$env:PIPELINE_WORKSPACE\install.ps1 -n -t $env:AGENT_TOOLSDIRECTORY/bin" + Write-Host "##vso[task.prependpath]$env:AGENT_TOOLSDIRECTORY\bin" + workingDirectory: $(Pipeline.Workspace) + displayName: 'Install State Tool' + - script: | + state deploy shnewto/learn-python --path %AGENT_TEMPDIRECTORY% + echo ##vso[task.prependpath]%AGENT_TEMPDIRECTORY%\bin + echo ##vso[task.setvariable variable=PATHEXT]%PATHEXT%;.LNK + displayName: 'Deploy project' + - script: pylint src + displayName: 'Lint with pylint' + - script: flake8 src --statistics --count + displayName: 'Lint with flake8' + - script: pytest + displayName: 'Test with pytest' From e2a994e2d6afffe17ce1530b83d51aa293bc4fa0 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Fri, 31 Jul 2020 18:26:29 -0700 Subject: [PATCH 32/37] Update activestate.yaml --- activestate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index a2ae009f..08645869 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/shnewto/learn-python +project: https://platform.activestate.com/activestate/learn-python languages: - name: python scripts: From 584046bbb600f9c026cbf070c8e1ddbbfdc8e237 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:31:02 -0700 Subject: [PATCH 33/37] Update with new Platform project link --- activestate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activestate.yaml b/activestate.yaml index 08645869..c2dcc3db 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,4 +1,4 @@ -project: https://platform.activestate.com/activestate/learn-python +project: https://platform.activestate.com/ActiveState-Labs/learn-python languages: - name: python scripts: From 2f4dc35310e436512d8288add10d85730af33622 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:33:49 -0700 Subject: [PATCH 34/37] Update with new Platform project --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d0dcbf7..d9284955 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ before_script: # Authenticate with the platform using preset env variable (only required for private projects) # - state auth # Download and install the language runtime - - state deploy shnewto/learn-python + - state deploy ActiveState-Labs/learn-python test: script: # Lint code From d96b1ec644fa1d38bce1df5a6043ec9112a0bc88 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:35:45 -0700 Subject: [PATCH 35/37] Update with latest Platform project --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4424690b..3960af89 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,7 +8,7 @@ jobs: steps: - script: sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n displayName: 'Install State Tool' - - script: state deploy shnewto/learn-python + - script: state deploy ActiveState-Labs/learn-python displayName: 'Deploy project' - script: pylint src displayName: 'Lint with pylint' @@ -22,7 +22,7 @@ jobs: steps: - script: sh <(curl -q https://platform.activestate.com/dl/cli/install.sh) -n displayName: 'Install State Tool' - - script: state deploy --force shnewto/learn-python + - script: state deploy --force ActiveState-Labs/learn-python displayName: 'Deploy project' - script: pylint src displayName: 'Lint with pylint' @@ -41,7 +41,7 @@ jobs: workingDirectory: $(Pipeline.Workspace) displayName: 'Install State Tool' - script: | - state deploy shnewto/learn-python --path %AGENT_TEMPDIRECTORY% + state deploy ActiveState-Labs/learn-python --path %AGENT_TEMPDIRECTORY% echo ##vso[task.prependpath]%AGENT_TEMPDIRECTORY%\bin echo ##vso[task.setvariable variable=PATHEXT]%PATHEXT%;.LNK displayName: 'Deploy project' From fa7f48938d4240d499b1978f8f56480072ab58e9 Mon Sep 17 00:00:00 2001 From: Aleks Pamir <50921497+pamirale@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:36:20 -0700 Subject: [PATCH 36/37] Update with latest Platform project --- cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 2894c6ca..295fa736 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -2,7 +2,7 @@ steps: - name: docker.io/activestate/state_gcb args: ['state','auth'] - name: docker.io/activestate/state_gcb - args: ['state', 'deploy', 'shnewto/learn-python', '--path', '/workspace/.state'] + args: ['state', 'deploy', 'ActiveState-Labs/learn-python', '--path', '/workspace/.state'] - name: docker.io/activestate/state_gcb args: ['pylint','src'] - name: docker.io/activestate/state_gcb From 443d6990e911c4313ed2eeb59451ded6a2cfe673 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Mon, 30 Jan 2023 12:02:39 -0800 Subject: [PATCH 37/37] Update activestate.yaml --- activestate.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/activestate.yaml b/activestate.yaml index c2dcc3db..2360bf95 100644 --- a/activestate.yaml +++ b/activestate.yaml @@ -1,6 +1,4 @@ project: https://platform.activestate.com/ActiveState-Labs/learn-python -languages: -- name: python scripts: - name: tests description: Executes tests