easyfuncplot 0.1.1__tar.gz → 0.1.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.
@@ -18,4 +18,40 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
22
+
23
+ text
24
+
25
+ ---
26
+
27
+ ## 搭好之后验证
28
+
29
+ ```cmd
30
+ cd C:\Users\lenovo\Desktop\easyfuncplot
31
+ pip install -e ".[dev]"
32
+ pytest
33
+ python examples\demo.py
34
+ 前两条过了,第三条弹出图形窗口,说明项目本身没问题。
35
+
36
+ 然后构建上传
37
+ cmd
38
+ rmdir /s /q dist
39
+ python -m build
40
+ twine check dist/*
41
+ twine upload dist/*
42
+ dir dist 应该只看到:
43
+
44
+ text
45
+ easyfuncplot-0.1.2-py3-none-any.whl
46
+ easyfuncplot-0.1.2.tar.gz
47
+ 上传后验证
48
+ cmd
49
+ pip uninstall easyfuncplot mathplot -y
50
+ pip cache purge
51
+ pip install easyfuncplot --upgrade --no-cache-dir
52
+ python -c "import easyfuncplot; print(easyfuncplot.__version__)"
53
+ python -c "from easyfuncplot import plot; print(plot)"
54
+ 应该输出 0.1.2 和函数对象。
55
+
56
+ 先把项目搭起来跑通本地,遇到问题再问我。这次目录名 easyfuncplot 从头到尾统一,不会再出现 import mathplot 的坑。
57
+
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyfuncplot
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Plot mathematical functions from strings or Python callables
5
5
  Author-email: Your Name <you@example.com>
6
6
  License: MIT
7
- Project-URL: Homepage, https://github.com/yourname/mathplot
7
+ Project-URL: Homepage, https://github.com/yourname/easyfuncplot
8
8
  Keywords: math,plot,function,matplotlib
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.9
13
13
  Description-Content-Type: text/markdown
14
- License-File: License
14
+ License-File: LICENSE
15
15
  Requires-Dist: matplotlib>=3.5
16
16
  Requires-Dist: numpy>=1.21
17
17
  Provides-Extra: dev
@@ -19,12 +19,3 @@ Requires-Dist: pytest; extra == "dev"
19
19
  Requires-Dist: build; extra == "dev"
20
20
  Requires-Dist: twine; extra == "dev"
21
21
  Dynamic: license-file
22
-
23
- # mathplot
24
-
25
- Plot mathematical functions from strings or Python callables.
26
-
27
- ## 安装
28
-
29
- ```bash
30
- pip install easyfuncplot
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "easyfuncplot"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Plot mathematical functions from strings or Python callables"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -25,7 +25,8 @@ dependencies = [
25
25
  dev = ["pytest", "build", "twine"]
26
26
 
27
27
  [project.urls]
28
- Homepage = "https://github.com/yourname/mathplot"
28
+ Homepage = "https://github.com/yourname/easyfuncplot"
29
29
 
30
30
  [tool.setuptools.packages.find]
31
- where = ["src"]
31
+ where = ["src"]
32
+ include = ["easyfuncplot*"]
@@ -1,5 +1,5 @@
1
1
  from .parser import parse
2
2
  from .plotter import plot
3
3
 
4
- __version__ = "0.1.0"
4
+ __version__ = "0.1.2"
5
5
  __all__ = ["parse", "plot"]
@@ -30,7 +30,6 @@ _UNARY_OPS = {ast.UAdd: operator.pos, ast.USub: operator.neg}
30
30
 
31
31
 
32
32
  def _preprocess(expr: str) -> str:
33
- """把用户习惯的 ^ 转成 Python 的 **。"""
34
33
  return expr.replace("^", "**")
35
34
 
36
35
 
@@ -71,7 +71,6 @@ def plot(
71
71
  if title:
72
72
  ax.set_title(title)
73
73
 
74
- # 只在有字符串表达式(或显式命名)时显示图例
75
74
  if any(_label_of(f) for f in funcs):
76
75
  ax.legend()
77
76
 
@@ -24,7 +24,6 @@ def sample(
24
24
  except (ValueError, ZeroDivisionError, OverflowError):
25
25
  y[i] = np.nan
26
26
 
27
- # inf / -inf 也变成 nan,让 matplotlib 自动断开
28
27
  y = np.where(np.isfinite(y), y, np.nan)
29
28
  return x, y
30
29
 
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyfuncplot
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Plot mathematical functions from strings or Python callables
5
5
  Author-email: Your Name <you@example.com>
6
6
  License: MIT
7
- Project-URL: Homepage, https://github.com/yourname/mathplot
7
+ Project-URL: Homepage, https://github.com/yourname/easyfuncplot
8
8
  Keywords: math,plot,function,matplotlib
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.9
13
13
  Description-Content-Type: text/markdown
14
- License-File: License
14
+ License-File: LICENSE
15
15
  Requires-Dist: matplotlib>=3.5
16
16
  Requires-Dist: numpy>=1.21
17
17
  Provides-Extra: dev
@@ -19,12 +19,3 @@ Requires-Dist: pytest; extra == "dev"
19
19
  Requires-Dist: build; extra == "dev"
20
20
  Requires-Dist: twine; extra == "dev"
21
21
  Dynamic: license-file
22
-
23
- # mathplot
24
-
25
- Plot mathematical functions from strings or Python callables.
26
-
27
- ## 安装
28
-
29
- ```bash
30
- pip install easyfuncplot
@@ -1,14 +1,13 @@
1
- License
2
- README.md
1
+ LICENSE
3
2
  pyproject.toml
3
+ src/easyfuncplot/__init__.py
4
+ src/easyfuncplot/auto_range.py
5
+ src/easyfuncplot/parser.py
6
+ src/easyfuncplot/plotter.py
7
+ src/easyfuncplot/sampler.py
4
8
  src/easyfuncplot.egg-info/PKG-INFO
5
9
  src/easyfuncplot.egg-info/SOURCES.txt
6
10
  src/easyfuncplot.egg-info/dependency_links.txt
7
11
  src/easyfuncplot.egg-info/requires.txt
8
12
  src/easyfuncplot.egg-info/top_level.txt
9
- src/mathplot/_init_.py
10
- src/mathplot/auto_range.py
11
- src/mathplot/parser.py
12
- src/mathplot/plotter.py
13
- src/mathplot/sampler.py
14
13
  tests/test_basic.py
@@ -0,0 +1 @@
1
+ easyfuncplot
@@ -2,8 +2,8 @@ import math
2
2
 
3
3
  import pytest
4
4
 
5
- from mathplot import parse, plot
6
- from mathplot.parser import parse as parse_only
5
+ from easyfuncplot import parse, plot
6
+ from easyfuncplot.parser import parse as parse_only
7
7
 
8
8
 
9
9
  def test_parse_basic():
@@ -32,14 +32,13 @@ def test_parse_rejects_unknown_var():
32
32
 
33
33
 
34
34
  def test_sample_handles_division_by_zero():
35
- from mathplot.sampler import sample
35
+ from easyfuncplot.sampler import sample
36
36
  f = parse_only("1/x")
37
37
  x, y = sample(f, -1, 1, n=101)
38
- # x=0 处应该是 nan
39
38
  assert any(math.isnan(v) for v in y)
40
39
 
41
40
 
42
- def test_plot_returns_fig(monkeypatch):
41
+ def test_plot_returns_fig():
43
42
  import matplotlib
44
43
  matplotlib.use("Agg")
45
44
  fig, ax = plot("x**2", show=False)
@@ -1,8 +0,0 @@
1
- # mathplot
2
-
3
- Plot mathematical functions from strings or Python callables.
4
-
5
- ## 安装
6
-
7
- ```bash
8
- pip install easyfuncplot
@@ -1 +0,0 @@
1
- mathplot
File without changes