Skip to content

Commit

Permalink
Move setup.cfg config settings to pyproject.toml (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-yz-liu authored Jun 24, 2023
1 parent e086e54 commit 8bf8470
Show file tree
Hide file tree
Showing 88 changed files with 78 additions and 67 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions sample_usage/README.md → examples/sample_usage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ call `pyta_statistics` on the absolute path to the directory, as so:

```python
>>> directory = "C:\\Users\\prof\\Documents\\course1\\projects" # for example
>>> from sample_usage.pyta_stats import pyta_statistics # while running python in the pyta directory
>>> from examples.sample_usage.pyta_stats import pyta_statistics # while running python in the pyta directory
>>> pyta_statistics(directory)
```

Expand All @@ -54,15 +54,15 @@ aggregate (if it is a course directory).
There are three Python files that contribute to the aggregation and calculation
of statistics for Python TA:

- `sample_usage/pyta_stats.py`
- `examples/sample_usage/pyta_stats.py`

- This module contains the `pyta_statistics` function that users run on the
directory that they want to analyse. It aggregates statistics that are collected
by `StatReporter` instances when `python_ta.check_all()` is run, then calls
the actual statistics calculators contained in the `stats_analysis` module,
and pretty-prints the results.

- `sample_usage/stats_analysis.py`
- `examples/sample_usage/stats_analysis.py`

- This module performs all of the actual statistics calculation on data collected
by `pyta_stats`. The main function, `summary`, takes in the data and calls
Expand Down
2 changes: 1 addition & 1 deletion sample_usage/TODO.md → examples/sample_usage/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
AnnAssign Node:
An AttributeError is raised because the transformer did not add
'end_lineno' attribute to the AnnAssign node. In the current example
found in `nodes/ann_assign.py`, only the last statement has the
found in `examples/nodes/ann_assign.py`, only the last statement has the
'end_lineno' attribute added to it.

DictUnpack Node:
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import python_ta.cfg

USAGE = "USAGE: python -m sample_usage.draw_cfg <your-file.py>"
USAGE = "USAGE: python -m examples.sample_usage.draw_cfg <your-file.py>"


def main(filepath: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from python_ta.typecheck.base import TypeFail, _TNode
from tests.custom_hypothesis_support import _parse_text

USAGE = "Usage: python -m sample_usage.draw_tnodes <your-file.py>"
USAGE = "Usage: python -m examples.sample_usage.draw_tnodes <your-file.py>"


def _type_str(type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import astroid
from colorama import Back, Fore

USAGE = "Usage: python -m sample_usage.print_ast <your-file.py>"
USAGE = "Usage: python -m examples.sample_usage.print_ast <your-file.py>"
FILL = " "
# Unicode Box Drawing Characters.
CHAR_PIPE = "┃"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def print_node(filename, node_class):
if __name__ == "__main__":
for node_class in astroid.nodes.ALL_NODE_CLASSES:
print("=== {} ===".format(node_class.__name__))
file_location = "nodes/" + inflection.underscore(node_class.__name__) + ".py"
file_location = "examples/nodes/" + inflection.underscore(node_class.__name__) + ".py"
try:
print_node(file_location, node_class)
except FileNotFoundError:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import python_ta
from python_ta.reporters.stat_reporter import StatReporter
from sample_usage.stats_analysis import summary
from examples.sample_usage.stats_analysis import summary


def pyta_statistics(directory, config=""):
Expand Down
File renamed without changes.
60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,67 @@
[project]
name = "python-ta"
description = "Code checking tool for teaching Python"
authors = [
{name = "David Liu", email = "david@cs.toronto.edu"},
]
license = {text = "MIT"}
readme = "README.md"
dependencies = [
"astroid ~= 2.15.4",
"click >= 8.0.1, < 9",
"colorama ~= 0.4.6",
"jinja2 ~= 3.1.2",
"pycodestyle ~= 2.10.0",
"pygments ~= 2.14.0",
"pylint ~= 2.17.4",
"requests ~= 2.28.0",
"six",
"tabulate ~= 0.9.0",
"toml ~= 0.10.2",
"typeguard >= 2.13.3, < 3",
"wrapt >= 1.15.0, < 2",
]
dynamic = ["version"]
requires-python = ">=3.8"

[project.optional-dependencies]
dev = [
"graphviz",
"hypothesis",
"inflection",
"myst-parser",
"pre-commit",
"pytest",
"pytest-snapshot",
"pytest-cov ~= 4.0.0",
"sphinx",
"sphinx-rtd-theme",
]
z3 = [
"z3-solver",
]

[project.scripts]
python_ta = "python_ta.__main__:main"

[project.urls]
Homepage = "https://github.com/pyta-uoft/pyta"
Documentation = "https://www.cs.toronto.edu/~david/pyta/"
Repository = "https://github.com/pyta-uoft/pyta.git"
Changelog = "https://github.com/pyta-uoft/pyta/blob/master/CHANGELOG.md"


[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true
zip-safe = false

[tool.setuptools.dynamic]
version = {attr = "python_ta.__version__"}
#readme = {file = "README.md", content-type = "text/markdown"}

[tool.black]
extend-exclude = '''
Expand Down
49 changes: 0 additions & 49 deletions setup.cfg

This file was deleted.

16 changes: 8 additions & 8 deletions tests/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_check_on_dir():

def test_check_on_file():
"""Test files"""
_inputs = [["nodes/name.py"], ["nodes/dict.py", "nodes/const.py"]]
_inputs = [["examples/nodes/name.py"], ["examples/nodes/dict.py", "examples/nodes/const.py"]]
for item in _inputs:
python_ta.check_all(
item,
Expand All @@ -46,8 +46,8 @@ def test_check_on_bad_input():
_inputs = [
[222],
222,
["nodes/dict.py nodes/const.py"],
[222, "examples/inline_config_comment.py", "nodes/dict.py"],
["examples/nodes/dict.py examples/nodes/const.py"],
[222, "examples/inline_config_comment.py", "examples/nodes/dict.py"],
["file_does_not_exist"],
]
for item in _inputs:
Expand All @@ -63,7 +63,7 @@ def test_check_on_bad_input():

def test_check_with_config():
"""Test inputs along with a config arg."""
_inputs = [["nodes/const.py"], ["nodes"]]
_inputs = [["examples/nodes/const.py"], ["examples/nodes"]]
CONFIG = {
# [ELIF]
"max-nested-blocks": 4,
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_check_with_config():

def test_check_saves_file() -> None:
"""Test whether or not specifiying an output properly saves a file"""
_inputs = [["nodes/name.py"]]
_inputs = [["examples/nodes/name.py"]]
for item in _inputs:
# Note that the reporter output will be created in the main directory
python_ta.check_all(item, output="pyta_output.html")
Expand All @@ -195,7 +195,7 @@ def test_check_no_reporter_output() -> None:
webbrowser.open = Mock(return_value=None)
HTTPServer.handle_request = Mock(return_value=None)

_inputs = [["nodes/name.py"]]
_inputs = [["examples/nodes/name.py"]]
for item in _inputs:
# Note that the reporter output *would have been* created in the main directory
python_ta.check_all(item)
Expand Down Expand Up @@ -234,7 +234,7 @@ def test_check_errors_nonzero() -> None:
"python_ta",
"--config",
"tests/test.pylintrc",
"nodes/name.py",
"examples/nodes/name.py",
]
)

Expand All @@ -253,7 +253,7 @@ def test_check_exit_zero() -> None:
"--exit-zero",
"--config",
"tests/test.pylintrc",
"nodes/name.py",
"examples/nodes/name.py",
]
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_type_constraints/test_tnode_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest
from astroid import nodes

from examples.sample_usage.draw_tnodes import gen_graph_from_nodes
from python_ta.typecheck.base import TypeConstraints, TypeFail, _TNode
from sample_usage.draw_tnodes import gen_graph_from_nodes

from .. import custom_hypothesis_support as cs

Expand Down

0 comments on commit 8bf8470

Please sign in to comment.