Skip to main content

sum_pts

Reads an assignment file (source code or latex source) and counts how many points each problem is worth.

Installation

pip3 install sum-pts

Quick-Start

Given an input text file, like ex_hw0.py or ex_hw0.ipynb:

# Part 1 (10 points)
# some text or code here

# Part 2 (14 + 2 auto pt)
# some text or code here

# part 3 (14 pt + 3 extra credit really long name pts)

Run this module from its command line interface:

python3 -m sum_pts ex_hw0.py

to generate a markdown table which sums all points in assignment:

| part   |    | auto   | extra credit really long name   |   part total |
|:-------|---:|:-------|:--------------------------------|-------------:|
| Part 1 | 10 |        |                                 |           10 |
| Part 2 | 14 | 2.0    |                                 |           16 |
| part 3 | 14 |        | 3.0                             |           17 |
| total  | 38 | 2.0    | 3.0                             |           43 |

you can write this to a markdown or csv file with the -m or -c flags if desired. This example shows more than one type of point in a problem (e.g. 'auto', 'extra credit really long name') though the final 3 columns above would be removed if no other point type existed.

Advanced Usage

You can customize the behavior to support more use cases, such as LaTeX files by modifying the default regular expression configurations, available via the command line interface.

There are a few regular expression strings which specify how points are identified.

# Part 2 (14 + 2 auto pt)
  • prefix matches the beginning of a line which contains points to be counted. default '#'
  • left and right mark the beginning and end of the "point block" (e.g. (14 + 2 auto pt) above). default '\\(' and '\\)'
  • points must match at least once inside the point block for the problem to be included. default '([Pp]ts?|[Pp]oints?)'
  • pt_split a point block is split between different types of points (e.g. 'auto' and '' in the example) whenever this is matched. default '[+&,]'
  • rm_list is a list of regex strings which are deleted from problem names (e.g. part 1) and point types. by default it is empty, users can pass strings here via the -r command line option. see case 2 for motivating use case

Parsing:

  1. Find lines matching '{prefix}.*{left}.*{points}.*{right}.*'
  2. The name of the problem is the whole match above, after removing prefix, left, right and points and rm_list
  3. The {left}.*{points}.*{right} string is split according to pt_split
  4. Point types have left, right, points and rm_list removed

Metadata

Release files for sum-pts 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sum-pts 0.0.4
File Size Uploaded Provenance Actions
sum_pts-0.0.4.tar.gz 4.1 kB Without provenance Details for sum_pts-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sum-pts 0.0.4
File Interpreter ABI Platform Actions
sum_pts-0.0.4-py3-none-any.whl Python 3 none any Details for sum_pts-0.0.4-py3-none-any.whl

Total release size: 8.9 kB

Release files / sum_pts-0.0.4.tar.gz

Download URL sum_pts-0.0.4.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3943f8b88c8a8d5c8ae06ef04477e914f090354ba3e897678734907f8c283f07
BLAKE2b-256 checksum
How to use checksums
490938e59d4516cc0aef78563cd1518acc3c0b57c0006483292732d491efd334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / sum_pts-0.0.4-py3-none-any.whl

Download URL sum_pts-0.0.4-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93fba06f26555f65c77b749e540aa47ade1f7036d4e9970ef689767b7f1cea30
BLAKE2b-256 checksum
How to use checksums
adc229df7f71a4bfc8316057b8bbb61633aadf9e60a7a783f647d054138f0765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for sum-pts 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page