-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from 15r10nk/python_3.7
feat: support for python 3.7 - 3.11
- Loading branch information
Showing
7 changed files
with
379 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
__pycache__ | ||
dist | ||
.python-version | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# minimize source code | ||
|
||
If you build a linter, formatter or any other tool which has to analyse python source code you might end up searching bugs in pretty large input files. | ||
|
||
|
||
`pysource_minimize` is able to remove everything from the python source which is not related to the problem. | ||
|
||
Example: | ||
``` pycon | ||
>>> from pysource_minimize import minimize | ||
|
||
>>> source = """ | ||
... def f(): | ||
... print("bug"+"other string") | ||
... return 1+1 | ||
... f() | ||
... """ | ||
|
||
>>> print(minimize(source, lambda new_source: "bug" in new_source)) | ||
"""bug""" | ||
|
||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from pathlib import Path | ||
|
||
import nox | ||
|
||
nox.options.sessions = ["clean", "test", "report", "docs"] | ||
nox.options.reuse_existing_virtualenvs = True | ||
|
||
|
||
@nox.session(python="python3.10") | ||
def clean(session): | ||
session.run_always("poetry", "install", "--with=dev", external=True) | ||
session.env["TOP"] = str(Path(__file__).parent) | ||
session.run("coverage", "erase") | ||
|
||
|
||
@nox.session(python="python3.10") | ||
def mypy(session): | ||
session.install("poetry") | ||
session.run("poetry", "install", "--with=dev") | ||
session.run("mypy", "src", "tests") | ||
|
||
|
||
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"]) | ||
def test(session): | ||
session.run_always("poetry", "install", "--with=dev", external=True) | ||
session.env["COVERAGE_PROCESS_START"] = str( | ||
Path(__file__).parent / "pyproject.toml" | ||
) | ||
session.env["TOP"] = str(Path(__file__).parent) | ||
args = [] if session.posargs else ["-n", "auto", "-v"] | ||
|
||
session.run("pytest", *args, "tests", *session.posargs) | ||
|
||
|
||
@nox.session(python="python3.10") | ||
def report(session): | ||
session.run_always("poetry", "install", "--with=dev", external=True) | ||
session.env["TOP"] = str(Path(__file__).parent) | ||
try: | ||
session.run("coverage", "combine") | ||
except: | ||
pass | ||
session.run("coverage", "html") | ||
session.run("coverage", "report", "--fail-under", "94") | ||
|
||
|
||
@nox.session(python="python3.10") | ||
def docs(session): | ||
session.install("poetry") | ||
session.run("poetry", "install", "--with=doc") | ||
session.run("mkdocs", "build") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
[tool.poetry] | ||
name = "pysource-minimize" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
description = "find failing section in python source" | ||
authors = ["Frank Hoffmann"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{include = "pysource_minimize"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
python = "^3.7" | ||
asttokens = "^2.0.8" | ||
rich = "^12.6.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^7.1.3" | ||
pytest-subtests = "^0.8.0" | ||
pytest-xdist = "^3.0.2" | ||
pytest-xdist = {extras = ["psutil"], version = "^3.1.0"} | ||
astunparse = "^1.6.3" | ||
coverage-enable-subprocess = "^1.0" | ||
coverage = "^6.5.0" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.coverage.run] | ||
source = ["tests","pysource_minimize"] | ||
parallel = true | ||
branch = true | ||
data_file = "$TOP/.coverage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters