paroxython 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {paroxython-0.7.0 → paroxython-0.7.2}/PKG-INFO +5 -4
- {paroxython-0.7.0 → paroxython-0.7.2}/README.md +3 -3
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/__init__.py +3 -3
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/resources/spec.md +10 -7
- {paroxython-0.7.0 → paroxython-0.7.2}/pyproject.toml +2 -3
- paroxython-0.7.2/setup.py +36 -0
- paroxython-0.7.0/setup.py +0 -36
- {paroxython-0.7.0 → paroxython-0.7.2}/LICENSE +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/assess_costs.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/cli.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/cli_collect.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/cli_recommend.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/cli_tag.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/compare_spans.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/derived_labels_db.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/filter_programs.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/flatten_ast.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/goodies.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/label_programs.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/list_programs.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/make_db.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/map_taxonomy.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/normalize_predicate.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/parse_program.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/preprocess_source.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/recommend_programs.py +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/resources/taxonomy.tsv +0 -0
- {paroxython-0.7.0 → paroxython-0.7.2}/paroxython/user_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: paroxython
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Search Python code for algorithmic features
|
|
5
5
|
Home-page: https://github.com/laowantong/paroxython/
|
|
6
6
|
License: MIT
|
|
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.8
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
22
|
Classifier: Programming Language :: Python :: 3.8
|
|
22
23
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
24
|
Classifier: Programming Language :: SQL
|
|
@@ -31,7 +32,7 @@ Project-URL: Repository, https://github.com/laowantong/paroxython/
|
|
|
31
32
|
Project-URL: issues, https://github.com/laowantong/paroxython/issues
|
|
32
33
|
Description-Content-Type: text/markdown
|
|
33
34
|
|
|
34
|
-
[](https://github.com/laowantong/paroxython/actions/workflows/build.yml)
|
|
35
36
|
[](https://codecov.io/gh/laowantong/paroxython)
|
|
36
37
|
[](http://mypy-lang.org/)
|
|
37
38
|
[](https://www.codacy.com/manual/laowantong/paroxython)
|
|
@@ -41,7 +42,7 @@ Description-Content-Type: text/markdown
|
|
|
41
42
|

|
|
42
43
|
[](https://github.com/laowantong/paroxython/blob/master/paroxython)
|
|
43
44
|
[](https://github.com/laowantong/paroxython/blob/master/tests)
|
|
44
|
-
[](https://github.com/laowantong/paroxython/blob/master/helpers)
|
|
45
46
|
[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md)
|
|
46
47
|
[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/taxonomy.tsv)
|
|
47
48
|

|
|
@@ -238,7 +239,7 @@ As you can see, in this program, Paroxython identifies among others:
|
|
|
238
239
|
- a simple [tuple assignment](https://en.wikibooks.org/wiki/Python_Programming/Tuples#Packing_and_Unpacking) (`var/assignment/explicit/parallel`). Note that we distinguish between explicit (with `=`) and implicit (parameters and iteration variables) assignments;
|
|
239
240
|
- a “sliding” tuple assignment (`var/assignment/explicit/parallel/slide`). If the denomination is unique to us, the pattern itself occurs in a number of programs: implementations of [C-finite sequences](https://en.wikipedia.org/wiki/Constant-recursive_sequence) with C greater than 1, [Greatest Common Divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor), [Quicksort](https://en.wikipedia.org/wiki/Quicksort), etc.
|
|
240
241
|
- four local variables (`var/scope/local`);
|
|
241
|
-
- an estimation of the variety of concepts involved (`meta/count/variety
|
|
242
|
+
- an estimation of the variety of concepts involved (`meta/count/variety/3`), depending on the number of lines, features and distinct features.
|
|
242
243
|
|
|
243
244
|
The magic command `%%paroxython` (corresponding to the subcommand [`tag`](https://laowantong.github.io/paroxython/cli_tag.html)) only scratches the surface of the system. As shown before, to estimate the learning cost of the features and get actionable recommendations, you will need first to construct the tag database with [`collect`](https://laowantong.github.io/paroxython/cli_collect.html), and then call [`recommend`](https://laowantong.github.io/paroxython/cli_recommend.html) on a pipeline of yours.
|
|
244
245
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://github.com/laowantong/paroxython/actions/workflows/build.yml)
|
|
2
2
|
[](https://codecov.io/gh/laowantong/paroxython)
|
|
3
3
|
[](http://mypy-lang.org/)
|
|
4
4
|
[](https://www.codacy.com/manual/laowantong/paroxython)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|

|
|
9
9
|
[](https://github.com/laowantong/paroxython/blob/master/paroxython)
|
|
10
10
|
[](https://github.com/laowantong/paroxython/blob/master/tests)
|
|
11
|
-
[](https://github.com/laowantong/paroxython/blob/master/helpers)
|
|
12
12
|
[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md)
|
|
13
13
|
[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/taxonomy.tsv)
|
|
14
14
|

|
|
@@ -205,7 +205,7 @@ As you can see, in this program, Paroxython identifies among others:
|
|
|
205
205
|
- a simple [tuple assignment](https://en.wikibooks.org/wiki/Python_Programming/Tuples#Packing_and_Unpacking) (`var/assignment/explicit/parallel`). Note that we distinguish between explicit (with `=`) and implicit (parameters and iteration variables) assignments;
|
|
206
206
|
- a “sliding” tuple assignment (`var/assignment/explicit/parallel/slide`). If the denomination is unique to us, the pattern itself occurs in a number of programs: implementations of [C-finite sequences](https://en.wikipedia.org/wiki/Constant-recursive_sequence) with C greater than 1, [Greatest Common Divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor), [Quicksort](https://en.wikipedia.org/wiki/Quicksort), etc.
|
|
207
207
|
- four local variables (`var/scope/local`);
|
|
208
|
-
- an estimation of the variety of concepts involved (`meta/count/variety
|
|
208
|
+
- an estimation of the variety of concepts involved (`meta/count/variety/3`), depending on the number of lines, features and distinct features.
|
|
209
209
|
|
|
210
210
|
The magic command `%%paroxython` (corresponding to the subcommand [`tag`](https://laowantong.github.io/paroxython/cli_tag.html)) only scratches the surface of the system. As shown before, to estimate the learning cost of the features and get actionable recommendations, you will need first to construct the tag database with [`collect`](https://laowantong.github.io/paroxython/cli_collect.html), and then call [`recommend`](https://laowantong.github.io/paroxython/cli_recommend.html) on a pipeline of yours.
|
|
211
211
|
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
import sys
|
|
20
|
-
import
|
|
20
|
+
from importlib.metadata import distribution, PackageNotFoundError
|
|
21
21
|
|
|
22
22
|
try:
|
|
23
|
-
PAROXYTHON_VERSION =
|
|
24
|
-
except
|
|
23
|
+
PAROXYTHON_VERSION = distribution("paroxython").version
|
|
24
|
+
except PackageNotFoundError:
|
|
25
25
|
PAROXYTHON_VERSION = "(unknown version)" # For tests during CI
|
|
26
26
|
|
|
27
27
|
if "ipykernel" in sys.modules:
|
|
@@ -5696,6 +5696,7 @@ Match sequential loops, along with their iteration variable(s).
|
|
|
5696
5696
|
[⬇️ feature `accumulate_some_elements`](#feature-accumulate_some_elements)
|
|
5697
5697
|
[⬇️ feature `find_best_element`](#feature-find_best_element)
|
|
5698
5698
|
[⬇️ feature `find_best_element_index`](#feature-find_best_element_index)
|
|
5699
|
+
[⬇️ feature `find_first_good_element`](#feature-find_first_good_element)
|
|
5699
5700
|
[⬇️ feature `for_range`](#feature-for_range)
|
|
5700
5701
|
[⬇️ feature `nested_for`](#feature-nested_for)
|
|
5701
5702
|
[⬇️ feature `universal_quantification|existential_quantification`](#feature-universal_quantificationexistential_quantification)
|
|
@@ -5881,10 +5882,6 @@ GROUP BY path
|
|
|
5881
5882
|
|
|
5882
5883
|
Iterate over the elements of a (named) collection.
|
|
5883
5884
|
|
|
5884
|
-
##### Derivations
|
|
5885
|
-
|
|
5886
|
-
[⬇️ feature `find_first_good_element`](#feature-find_first_good_element)
|
|
5887
|
-
|
|
5888
5885
|
##### Specification
|
|
5889
5886
|
|
|
5890
5887
|
```re
|
|
@@ -7461,7 +7458,7 @@ Linear search. Return the first element of a sequence satisfying a predicate.
|
|
|
7461
7458
|
|
|
7462
7459
|
##### Derivations
|
|
7463
7460
|
|
|
7464
|
-
[⬆️ feature `
|
|
7461
|
+
[⬆️ feature `for`](#feature-for)
|
|
7465
7462
|
[⬆️ feature `if`](#feature-if)
|
|
7466
7463
|
[⬆️ feature `if_test_atom`](#feature-if_test_atom)
|
|
7467
7464
|
[⬆️ feature `return`](#feature-return)
|
|
@@ -7473,7 +7470,7 @@ SELECT "find_first_good_element",
|
|
|
7473
7470
|
lp.name_suffix,
|
|
7474
7471
|
lp.span,
|
|
7475
7472
|
lp.path
|
|
7476
|
-
FROM
|
|
7473
|
+
FROM t_for lp -- A for each loop...
|
|
7477
7474
|
JOIN t_if ON (t_if.path GLOB lp.path || "*-")-- enclosing an if statement...
|
|
7478
7475
|
JOIN t_if_test_atom x ON (x.span_start = t_if.span_start
|
|
7479
7476
|
AND x.name_suffix = lp.name_suffix)-- which tests the iteration variable...
|
|
@@ -7487,7 +7484,12 @@ JOIN t_return ret ON (ret.path GLOB t_if.path || "*-" -- and returns...
|
|
|
7487
7484
|
1 def search_element(iterable):
|
|
7488
7485
|
2 for element in iterable:
|
|
7489
7486
|
3 if is_good(element):
|
|
7490
|
-
4
|
|
7487
|
+
4 return element
|
|
7488
|
+
5 def largest_prime_below(n):
|
|
7489
|
+
6 for i in range(n - 1, 1, -1):
|
|
7490
|
+
7 if is_prime(i):
|
|
7491
|
+
8 return i
|
|
7492
|
+
9 return None
|
|
7491
7493
|
```
|
|
7492
7494
|
|
|
7493
7495
|
##### Matches
|
|
@@ -7495,6 +7497,7 @@ JOIN t_return ret ON (ret.path GLOB t_if.path || "*-" -- and returns...
|
|
|
7495
7497
|
| Label | Lines |
|
|
7496
7498
|
|:--|:--|
|
|
7497
7499
|
| `find_first_good_element:element` | 2-4 |
|
|
7500
|
+
| `find_first_good_element:i` | 6-8 |
|
|
7498
7501
|
|
|
7499
7502
|
--------------------------------------------------------------------------------
|
|
7500
7503
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "paroxython"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.2"
|
|
4
4
|
description = "Search Python code for algorithmic features"
|
|
5
5
|
authors = ["Aristide Grange"]
|
|
6
6
|
license = "MIT"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
homepage = ""
|
|
8
|
+
homepage = "https://github.com/laowantong/paroxython/"
|
|
9
9
|
repository = "https://github.com/laowantong/paroxython/"
|
|
10
10
|
keywords = ["education",
|
|
11
11
|
"static-analysis",
|
|
@@ -41,7 +41,6 @@ mypy = "^0.782"
|
|
|
41
41
|
pdoc3 = "^0.9.1"
|
|
42
42
|
pre-commit = "^2.20.0"
|
|
43
43
|
pytest = "^7.1.3"
|
|
44
|
-
pytest-icdiff = "^2.4.7"
|
|
45
44
|
sqlparse = "^0.4.2"
|
|
46
45
|
|
|
47
46
|
[build-system]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
packages = \
|
|
5
|
+
['paroxython']
|
|
6
|
+
|
|
7
|
+
package_data = \
|
|
8
|
+
{'': ['*'], 'paroxython': ['resources/*']}
|
|
9
|
+
|
|
10
|
+
install_requires = \
|
|
11
|
+
['docopt>=0.6.2,<0.7.0',
|
|
12
|
+
'regex>=2022.8.17,<2023.0.0',
|
|
13
|
+
'typing-extensions>=4.3.0,<5.0.0']
|
|
14
|
+
|
|
15
|
+
entry_points = \
|
|
16
|
+
{'console_scripts': ['paroxython = paroxython.cli:main']}
|
|
17
|
+
|
|
18
|
+
setup_kwargs = {
|
|
19
|
+
'name': 'paroxython',
|
|
20
|
+
'version': '0.7.2',
|
|
21
|
+
'description': 'Search Python code for algorithmic features',
|
|
22
|
+
'long_description': '[](https://github.com/laowantong/paroxython/actions/workflows/build.yml)\n[](https://codecov.io/gh/laowantong/paroxython)\n[](http://mypy-lang.org/)\n[](https://www.codacy.com/manual/laowantong/paroxython)\n[](https://pyup.io/repos/github/laowantong/paroxython/)\n\n[]()\n\n[](https://github.com/laowantong/paroxython/blob/master/paroxython)\n[](https://github.com/laowantong/paroxython/blob/master/tests)\n[](https://github.com/laowantong/paroxython/blob/master/helpers)\n[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md)\n[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/taxonomy.tsv)\n\n[](https://pepy.tech/project/paroxython/week)\n[](https://github.com/psf/black)\n[](https://opensource.org/licenses/MIT)\n[](https://youtu.be/QcbR1J_4ICg?t=54)\n\n<p align="center">\n <a href="https://laowantong.github.io/paroxython/index.html">\n <img src="docs/resources/logo.png">\n </a>\n</p>\n\n## Introduction\n\nParoxython is a set of command line tools which **tag** and **filter** by algorithmic features your collection of Python programming exercises.\n\n### Audience\n\nYou are a teacher, in charge of an introductory programming course in an educational institution. Over the years, you have accumulated many—far too many—programs and code snippets that may be of interest to your students.\n\nOr, as a seasoned developer, you would like to share your knowledge by helping a loved one learn how to code. A cursory search for pedagogical material yields an overwhelming amount of websites and repositories stuffed with Python programs of various levels (e.g.,\n[1](https://github.com/TheAlgorithms/Python),\n[2](http://rosettacode.org/wiki/Category:Python),\n[3](https://www.programming-idioms.org/about#about-block-language-coverage),\n[4](https://github.com/codebasics/py),\n[5](https://github.com/keon/algorithms),\n[6](https://github.com/OmkarPathak/Python-Programs),\nand a lot more from [Awesome Python in Education](https://github.com/quobit/awesome-python-in-education)).\n\nIn any case, the Python source codes you have gathered are typically\n**numerous** (hundreds or even thousands),\n**reasonably sized** (anything below 100 lines of code),\nand **educational** in nature (e.g., snippets, examples, quizzes, exercise solutions, classic algorithms).\nThe programming concepts you plan to teach remain relatively **low level** (e.g. assignments, nested loops, accumulation patterns, tail recursive functions, etc.).\n\nIf all that sounds familiar, keep reading me.\n\n### Main goals\n\nParoxython aims to help you select, from your collection, the one program that best suits your needs. For instance, it will gladly answer the following questions:\n\n> - How can this concept be illustrated?\n> - What problems use the same algorithmic and data structures as this one?\n> - What homework assignment should I give my students so they can practice the content of the last lesson?\n\nMoreover, since Paroxython knows what your class knows, it can recommend the right program at the right time:\n\n> - What would make a good review exercise?\n> - Which exercises can I give on this exam?\n> - What is the current learning cost of this example?\n\nIn the long run, Paroxython may guide you and somehow make you rethink your course outline:\n\n> - What are the prerequisites for the concept of assignment?\n> - Do I have enough material to introduce subroutines before I even talk about conditionals and loops?\n> - Among the loops, which must come first: the most powerful (`while`), or the most useful (`for`)?\n> - How to logically structure this bunch of usual iterative patterns?\n> - What are the _basics_, exactly?\n\nAll issues on which the author changed his mind since he started to work on this project!\n\nIn an ideal world, Paroxython could even put an end to the deadliest religious wars, with rational, data-driven arguments:\n\n> - Father, is it a sin to exit early?\n> - Should a real byte use a mask?\n\n### How it works\n\n<p align="center">\n <a href="https://laowantong.github.io/paroxython/developer_manual/index.html">\n <img src="docs/resources/waterfall.png">\n </a>\n</p>\n\nParoxython starts from a given folder of **programs**. Its contents is parsed, and all features that meet the provided **specifications** are labelled and associated with their spans (e.g., `"assignment_lhs_identifier:a": 4, 6, 18` or `"loop_with_late_exit:while": 3-7, 20-29`).\n\nThese **labels** constitute only scattered knowledge. The next step is to map them onto a **taxonomy** designed with basic hierarchical constraints in mind (e.g., the fact that the introduction of the concept of early exit must come after that of loop, which itself requires that of control flow, is expressed by the _taxon_ `"flow/loop/exit/early"`).\n\n<p align="center">\n <a href="https://laowantong.github.io/paroxython/user_manual/index.html#taxonomy">\n <img src="docs/resources/tree.png" alt="A taxonomy.">\n </a>\n <br>\n <em>Extract of the taxonomy generated from <a href="https://github.com/TheAlgorithms/Python">The Algorithms - Python</a>.<br>Click to jump to its full dynamic version in the user manual.</em>\n</p>\n\nEverything is then persisted in a tag **database**, which can later be filtered through a **pipeline** of commands, for instance:\n\n- _include_ only the programs which feature a recursive function;\n- _exclude_ this or that program you want to set aside for the exam;\n- “_impart_” all programs studied so far, _i.e_, consider that all the notions they implement are acquired.\n\nThe result is a list of program **recommendations** ordered by increasing learning cost.\n\n### Example\n\nSuppose that the `programs` directory contains [these simple programs](https://wiki.python.org/moin/SimplePrograms).\n\nFirst, build [this tag database](https://github.com/laowantong/paroxython/blob/master/examples/simple/programs_db.json):\n\n```shell\n> paroxython collect programs\nLabelling 21 programs.\nMapping taxonomy on 21 programs.\nWriting programs_db.json.\n```\n\nThen, filter it through [this pipeline](https://github.com/laowantong/paroxython/blob/master/examples/simple/programs_pipe.py):\n\n```shell\n> paroxython recommend programs\nProcessing 5 commands on 21 programs.\n 19 programs remaining after operation 1 (impart).\n 18 programs remaining after operation 2 (exclude).\n 12 programs remaining after operation 3 (exclude).\n 10 programs remaining after operation 4 (include).\n 10 programs remaining after operation 5 (hide).\nDumped: programs_recommendations.md.\n```\n\nEt voilà, [your recommendation report](https://github.com/laowantong/paroxython/blob/master/examples/simple/programs_recommendations.md)!\n\n\n## Installation and test-drive\n\n### Command line\n\nMuch to no one\'s surprise:\n\n```\npython -m pip install paroxython\n```\n\nThe following command should print a help message and exit:\n\n```\nparoxython --help\n```\n\n### IPython magic command\n\nIf you use Jupyter notebook/lab, you\'ve also just installed a so-called magic command. Load it like this:\n\n```python\n%load_ext paroxython\n```\n\nThis should print `"paroxython 0.7.0 loaded."`. Run it on a cell of Python code:\n\n```python\n%%paroxython # Lines\ndef fibonacci(n): # 2\n result = [] # 3\n (a, b) = (0, 1) # 4\n while a < n: # 5\n result.append(a) # 6\n (a, b) = (b, a + b) # 7\n return result # 8\n```\n\n| Taxon | Lines |\n|:--|:--|\n| `call/subroutine/method/sequence/list/append` | 6 |\n| `condition/inequality` | 5 |\n| `def/subroutine/function/impure` | 2-8 |\n| `def/subroutine/parameter/arg` | 2 |\n| `flow/loop/exit/late` | 5-7 |\n| `flow/loop/while` | 5-7 |\n| `meta/count/program/sloc/8` | 2-8 |\n| `meta/count/subroutine/sloc/7` | 2-8 |\n| `meta/count/variety/3` | 2-8 |\n| `meta/program` | 2-8 |\n| `operator/arithmetic/addition` | 7 |\n| `style/procedural` | 2-8 |\n| `type/number/integer/literal` | 4 |\n| `type/number/integer/literal/zero` | 4 |\n| `type/sequence/list` | 6 |\n| `type/sequence/list/literal/empty` | 3 |\n| `type/sequence/tuple/literal` | 4, 4, 7, 7 |\n| `var/assignment/explicit/parallel` | 4 |\n| `var/assignment/explicit/parallel/slide` | 7 |\n| `var/assignment/explicit/single` | 3 |\n| `var/assignment/implicit/parameter` | 2 |\n| `var/scope/local` | 2-8, 2-8, 2-8, 2-8 |\n\nAs you can see, in this program, Paroxython identifies among others:\n\n- the use of the [procedural paradigm](https://en.wikipedia.org/wiki/Procedural_programming) (`style/procedural`);\n- an im[pure function](https://en.wikipedia.org/wiki/Pure_function) (`def/subroutine/function/impure`);\n- a `while` loop (`flow/loop/while`) with a late exit (`flow/loop/exit/late`);\n- a little bit of voodoo on lists (`type/sequence/list/literal/empty` and `call/subroutine/method/sequence/list/append`);\n- a simple [tuple assignment](https://en.wikibooks.org/wiki/Python_Programming/Tuples#Packing_and_Unpacking) (`var/assignment/explicit/parallel`). Note that we distinguish between explicit (with `=`) and implicit (parameters and iteration variables) assignments;\n- a “sliding” tuple assignment (`var/assignment/explicit/parallel/slide`). If the denomination is unique to us, the pattern itself occurs in a number of programs: implementations of [C-finite sequences](https://en.wikipedia.org/wiki/Constant-recursive_sequence) with C greater than 1, [Greatest Common Divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor), [Quicksort](https://en.wikipedia.org/wiki/Quicksort), etc.\n- four local variables (`var/scope/local`);\n- an estimation of the variety of concepts involved (`meta/count/variety/3`), depending on the number of lines, features and distinct features.\n\nThe magic command `%%paroxython` (corresponding to the subcommand [`tag`](https://laowantong.github.io/paroxython/cli_tag.html)) only scratches the surface of the system. As shown before, to estimate the learning cost of the features and get actionable recommendations, you will need first to construct the tag database with [`collect`](https://laowantong.github.io/paroxython/cli_collect.html), and then call [`recommend`](https://laowantong.github.io/paroxython/cli_recommend.html) on a pipeline of yours.\n\n# Read them\n\nAlthough this is still a work-in-progress, Paroxython should already be fairly well [documented](https://laowantong.github.io/paroxython/index.html):\n\n- [User manual](https://laowantong.github.io/paroxython/user_manual/index.html):\n - [write a command pipeline to get recommendations](https://laowantong.github.io/paroxython/user_manual/index.html#pipeline-tutorial),\n - [prepare your program collections for better results](https://laowantong.github.io/paroxython/user_manual/index#preparing-your-program-collection),\n - [understand and modify the taxonomic classification](https://laowantong.github.io/paroxython/user_manual/index#taxonomy),\n - and more.\n- [Developer manual](https://laowantong.github.io/paroxython/developer_manual/index.html):\n - [get a rough idea of the program structure and operations](https://laowantong.github.io/paroxython/developer_manual/index.html#bird-view),\n - [use the provided helpers to contribute to the code](helper-programs),\n - and more.\n- [Module reference](https://laowantong.github.io/paroxython/#header-submodules).\n- [Feature specifications](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md): a document mixing prose, tests, regular expressions and SQL queries to describe which algorithmic features are recognized and how.\n- [User types](https://github.com/laowantong/paroxython/blob/master/paroxython/user_types.py): all objects of interest are precisely typed and checked by [mypy](http://mypy-lang.org).\n\nFinally, a [battery of examples](https://github.com/laowantong/paroxython/tree/master/examples) and [comprehensive test coverage](https://github.com/laowantong/paroxython/tree/master/tests) should help answer any remaining question.\n',
|
|
23
|
+
'author': 'Aristide Grange',
|
|
24
|
+
'author_email': 'None',
|
|
25
|
+
'maintainer': 'None',
|
|
26
|
+
'maintainer_email': 'None',
|
|
27
|
+
'url': 'https://github.com/laowantong/paroxython/',
|
|
28
|
+
'packages': packages,
|
|
29
|
+
'package_data': package_data,
|
|
30
|
+
'install_requires': install_requires,
|
|
31
|
+
'entry_points': entry_points,
|
|
32
|
+
'python_requires': '>=3.8,<4.0',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
setup(**setup_kwargs)
|
paroxython-0.7.0/setup.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from setuptools import setup
|
|
3
|
-
|
|
4
|
-
packages = \
|
|
5
|
-
['paroxython']
|
|
6
|
-
|
|
7
|
-
package_data = \
|
|
8
|
-
{'': ['*'], 'paroxython': ['resources/*']}
|
|
9
|
-
|
|
10
|
-
install_requires = \
|
|
11
|
-
['docopt>=0.6.2,<0.7.0',
|
|
12
|
-
'regex>=2022.8.17,<2023.0.0',
|
|
13
|
-
'typing-extensions>=4.3.0,<5.0.0']
|
|
14
|
-
|
|
15
|
-
entry_points = \
|
|
16
|
-
{'console_scripts': ['paroxython = paroxython.cli:main']}
|
|
17
|
-
|
|
18
|
-
setup_kwargs = {
|
|
19
|
-
'name': 'paroxython',
|
|
20
|
-
'version': '0.7.0',
|
|
21
|
-
'description': 'Search Python code for algorithmic features',
|
|
22
|
-
'long_description': '[](https://travis-ci.com/laowantong/paroxython)\n[](https://codecov.io/gh/laowantong/paroxython)\n[](http://mypy-lang.org/)\n[](https://www.codacy.com/manual/laowantong/paroxython)\n[](https://pyup.io/repos/github/laowantong/paroxython/)\n\n[]()\n\n[](https://github.com/laowantong/paroxython/blob/master/paroxython)\n[](https://github.com/laowantong/paroxython/blob/master/tests)\n[](https://github.com/laowantong/paroxython/blob/master/helpers)\n[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md)\n[](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/taxonomy.tsv)\n\n[](https://pepy.tech/project/paroxython/week)\n[](https://github.com/psf/black)\n[](https://opensource.org/licenses/MIT)\n[](https://youtu.be/QcbR1J_4ICg?t=54)\n\n<p align="center">\n <a href="https://laowantong.github.io/paroxython/index.html">\n <img src="docs/resources/logo.png">\n </a>\n</p>\n\n## Introduction\n\nParoxython is a set of command line tools which **tag** and **filter** by algorithmic features your collection of Python programming exercises.\n\n### Audience\n\nYou are a teacher, in charge of an introductory programming course in an educational institution. Over the years, you have accumulated many—far too many—programs and code snippets that may be of interest to your students.\n\nOr, as a seasoned developer, you would like to share your knowledge by helping a loved one learn how to code. A cursory search for pedagogical material yields an overwhelming amount of websites and repositories stuffed with Python programs of various levels (e.g.,\n[1](https://github.com/TheAlgorithms/Python),\n[2](http://rosettacode.org/wiki/Category:Python),\n[3](https://www.programming-idioms.org/about#about-block-language-coverage),\n[4](https://github.com/codebasics/py),\n[5](https://github.com/keon/algorithms),\n[6](https://github.com/OmkarPathak/Python-Programs),\nand a lot more from [Awesome Python in Education](https://github.com/quobit/awesome-python-in-education)).\n\nIn any case, the Python source codes you have gathered are typically\n**numerous** (hundreds or even thousands),\n**reasonably sized** (anything below 100 lines of code),\nand **educational** in nature (e.g., snippets, examples, quizzes, exercise solutions, classic algorithms).\nThe programming concepts you plan to teach remain relatively **low level** (e.g. assignments, nested loops, accumulation patterns, tail recursive functions, etc.).\n\nIf all that sounds familiar, keep reading me.\n\n### Main goals\n\nParoxython aims to help you select, from your collection, the one program that best suits your needs. For instance, it will gladly answer the following questions:\n\n> - How can this concept be illustrated?\n> - What problems use the same algorithmic and data structures as this one?\n> - What homework assignment should I give my students so they can practice the content of the last lesson?\n\nMoreover, since Paroxython knows what your class knows, it can recommend the right program at the right time:\n\n> - What would make a good review exercise?\n> - Which exercises can I give on this exam?\n> - What is the current learning cost of this example?\n\nIn the long run, Paroxython may guide you and somehow make you rethink your course outline:\n\n> - What are the prerequisites for the concept of assignment?\n> - Do I have enough material to introduce subroutines before I even talk about conditionals and loops?\n> - Among the loops, which must come first: the most powerful (`while`), or the most useful (`for`)?\n> - How to logically structure this bunch of usual iterative patterns?\n> - What are the _basics_, exactly?\n\nAll issues on which the author changed his mind since he started to work on this project!\n\nIn an ideal world, Paroxython could even put an end to the deadliest religious wars, with rational, data-driven arguments:\n\n> - Father, is it a sin to exit early?\n> - Should a real byte use a mask?\n\n### How it works\n\n<p align="center">\n <a href="https://laowantong.github.io/paroxython/developer_manual/index.html">\n <img src="docs/resources/waterfall.png">\n </a>\n</p>\n\nParoxython starts from a given folder of **programs**. Its contents is parsed, and all features that meet the provided **specifications** are labelled and associated with their spans (e.g., `"assignment_lhs_identifier:a": 4, 6, 18` or `"loop_with_late_exit:while": 3-7, 20-29`).\n\nThese **labels** constitute only scattered knowledge. The next step is to map them onto a **taxonomy** designed with basic hierarchical constraints in mind (e.g., the fact that the introduction of the concept of early exit must come after that of loop, which itself requires that of control flow, is expressed by the _taxon_ `"flow/loop/exit/early"`).\n\n<p align="center">\n <a href="https://laowantong.github.io/paroxython/user_manual/index.html#taxonomy">\n <img src="docs/resources/tree.png" alt="A taxonomy.">\n </a>\n <br>\n <em>Extract of the taxonomy generated from <a href="https://github.com/TheAlgorithms/Python">The Algorithms - Python</a>.<br>Click to jump to its full dynamic version in the user manual.</em>\n</p>\n\nEverything is then persisted in a tag **database**, which can later be filtered through a **pipeline** of commands, for instance:\n\n- _include_ only the programs which feature a recursive function;\n- _exclude_ this or that program you want to set aside for the exam;\n- “_impart_” all programs studied so far, _i.e_, consider that all the notions they implement are acquired.\n\nThe result is a list of program **recommendations** ordered by increasing learning cost.\n\n### Example\n\nSuppose that the `programs` directory contains [these simple programs](https://wiki.python.org/moin/SimplePrograms).\n\nFirst, build [this tag database](https://github.com/laowantong/paroxython/blob/master/examples/simple/programs_db.json):\n\n```shell\n> paroxython collect programs\nLabelling 21 programs.\nMapping taxonomy on 21 programs.\nWriting programs_db.json.\n```\n\nThen, filter it through [this pipeline](https://github.com/laowantong/paroxython/blob/master/examples/simple/programs_pipe.py):\n\n```shell\n> paroxython recommend programs\nProcessing 5 commands on 21 programs.\n 19 programs remaining after operation 1 (impart).\n 18 programs remaining after operation 2 (exclude).\n 12 programs remaining after operation 3 (exclude).\n 10 programs remaining after operation 4 (include).\n 10 programs remaining after operation 5 (hide).\nDumped: programs_recommendations.md.\n```\n\nEt voilà, [your recommendation report](https://github.com/laowantong/paroxython/blob/master/examples/simple/programs_recommendations.md)!\n\n\n## Installation and test-drive\n\n### Command line\n\nMuch to no one\'s surprise:\n\n```\npython -m pip install paroxython\n```\n\nThe following command should print a help message and exit:\n\n```\nparoxython --help\n```\n\n### IPython magic command\n\nIf you use Jupyter notebook/lab, you\'ve also just installed a so-called magic command. Load it like this:\n\n```python\n%load_ext paroxython\n```\n\nThis should print `"paroxython 0.7.0 loaded."`. Run it on a cell of Python code:\n\n```python\n%%paroxython # Lines\ndef fibonacci(n): # 2\n result = [] # 3\n (a, b) = (0, 1) # 4\n while a < n: # 5\n result.append(a) # 6\n (a, b) = (b, a + b) # 7\n return result # 8\n```\n\n| Taxon | Lines |\n|:--|:--|\n| `call/subroutine/method/sequence/list/append` | 6 |\n| `condition/inequality` | 5 |\n| `def/subroutine/function/impure` | 2-8 |\n| `def/subroutine/parameter/arg` | 2 |\n| `flow/loop/exit/late` | 5-7 |\n| `flow/loop/while` | 5-7 |\n| `meta/count/program/sloc/8` | 2-8 |\n| `meta/count/subroutine/sloc/7` | 2-8 |\n| `meta/count/variety/3` | 2-8 |\n| `meta/program` | 2-8 |\n| `operator/arithmetic/addition` | 7 |\n| `style/procedural` | 2-8 |\n| `type/number/integer/literal` | 4 |\n| `type/number/integer/literal/zero` | 4 |\n| `type/sequence/list` | 6 |\n| `type/sequence/list/literal/empty` | 3 |\n| `type/sequence/tuple/literal` | 4, 4, 7, 7 |\n| `var/assignment/explicit/parallel` | 4 |\n| `var/assignment/explicit/parallel/slide` | 7 |\n| `var/assignment/explicit/single` | 3 |\n| `var/assignment/implicit/parameter` | 2 |\n| `var/scope/local` | 2-8, 2-8, 2-8, 2-8 |\n\nAs you can see, in this program, Paroxython identifies among others:\n\n- the use of the [procedural paradigm](https://en.wikipedia.org/wiki/Procedural_programming) (`style/procedural`);\n- an im[pure function](https://en.wikipedia.org/wiki/Pure_function) (`def/subroutine/function/impure`);\n- a `while` loop (`flow/loop/while`) with a late exit (`flow/loop/exit/late`);\n- a little bit of voodoo on lists (`type/sequence/list/literal/empty` and `call/subroutine/method/sequence/list/append`);\n- a simple [tuple assignment](https://en.wikibooks.org/wiki/Python_Programming/Tuples#Packing_and_Unpacking) (`var/assignment/explicit/parallel`). Note that we distinguish between explicit (with `=`) and implicit (parameters and iteration variables) assignments;\n- a “sliding” tuple assignment (`var/assignment/explicit/parallel/slide`). If the denomination is unique to us, the pattern itself occurs in a number of programs: implementations of [C-finite sequences](https://en.wikipedia.org/wiki/Constant-recursive_sequence) with C greater than 1, [Greatest Common Divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor), [Quicksort](https://en.wikipedia.org/wiki/Quicksort), etc.\n- four local variables (`var/scope/local`);\n- an estimation of the variety of concepts involved (`meta/count/variety/***`), depending on the number of lines, features and distinct features.\n\nThe magic command `%%paroxython` (corresponding to the subcommand [`tag`](https://laowantong.github.io/paroxython/cli_tag.html)) only scratches the surface of the system. As shown before, to estimate the learning cost of the features and get actionable recommendations, you will need first to construct the tag database with [`collect`](https://laowantong.github.io/paroxython/cli_collect.html), and then call [`recommend`](https://laowantong.github.io/paroxython/cli_recommend.html) on a pipeline of yours.\n\n# Read them\n\nAlthough this is still a work-in-progress, Paroxython should already be fairly well [documented](https://laowantong.github.io/paroxython/index.html):\n\n- [User manual](https://laowantong.github.io/paroxython/user_manual/index.html):\n - [write a command pipeline to get recommendations](https://laowantong.github.io/paroxython/user_manual/index.html#pipeline-tutorial),\n - [prepare your program collections for better results](https://laowantong.github.io/paroxython/user_manual/index#preparing-your-program-collection),\n - [understand and modify the taxonomic classification](https://laowantong.github.io/paroxython/user_manual/index#taxonomy),\n - and more.\n- [Developer manual](https://laowantong.github.io/paroxython/developer_manual/index.html):\n - [get a rough idea of the program structure and operations](https://laowantong.github.io/paroxython/developer_manual/index.html#bird-view),\n - [use the provided helpers to contribute to the code](helper-programs),\n - and more.\n- [Module reference](https://laowantong.github.io/paroxython/#header-submodules).\n- [Feature specifications](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md): a document mixing prose, tests, regular expressions and SQL queries to describe which algorithmic features are recognized and how.\n- [User types](https://github.com/laowantong/paroxython/blob/master/paroxython/user_types.py): all objects of interest are precisely typed and checked by [mypy](http://mypy-lang.org).\n\nFinally, a [battery of examples](https://github.com/laowantong/paroxython/tree/master/examples) and [comprehensive test coverage](https://github.com/laowantong/paroxython/tree/master/tests) should help answer any remaining question.\n',
|
|
23
|
-
'author': 'Aristide Grange',
|
|
24
|
-
'author_email': 'None',
|
|
25
|
-
'maintainer': 'None',
|
|
26
|
-
'maintainer_email': 'None',
|
|
27
|
-
'url': 'https://github.com/laowantong/paroxython/',
|
|
28
|
-
'packages': packages,
|
|
29
|
-
'package_data': package_data,
|
|
30
|
-
'install_requires': install_requires,
|
|
31
|
-
'entry_points': entry_points,
|
|
32
|
-
'python_requires': '>=3.8,<4.0',
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
setup(**setup_kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|