spin 0.10__tar.gz → 0.11__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.
Files changed (29) hide show
  1. {spin-0.10/spin.egg-info → spin-0.11}/PKG-INFO +2 -2
  2. {spin-0.10 → spin-0.11}/pyproject.toml +1 -1
  3. {spin-0.10 → spin-0.11}/spin/__init__.py +1 -1
  4. spin-0.11/spin/cmds/__init__.py +3 -0
  5. {spin-0.10 → spin-0.11}/spin/cmds/meson.py +43 -17
  6. {spin-0.10 → spin-0.11}/spin/cmds/util.py +4 -0
  7. {spin-0.10 → spin-0.11}/spin/tests/conftest.py +7 -0
  8. {spin-0.10 → spin-0.11}/spin/tests/test_build_cmds.py +0 -10
  9. {spin-0.10 → spin-0.11}/spin/tests/test_editable.py +0 -10
  10. spin-0.11/spin/tests/test_test.py +29 -0
  11. {spin-0.10 → spin-0.11/spin.egg-info}/PKG-INFO +2 -2
  12. {spin-0.10 → spin-0.11}/spin.egg-info/SOURCES.txt +1 -0
  13. {spin-0.10 → spin-0.11}/spin.egg-info/requires.txt +1 -1
  14. spin-0.10/spin/cmds/__init__.py +0 -8
  15. {spin-0.10 → spin-0.11}/LICENSE +0 -0
  16. {spin-0.10 → spin-0.11}/README.md +0 -0
  17. {spin-0.10 → spin-0.11}/setup.cfg +0 -0
  18. {spin-0.10 → spin-0.11}/spin/__main__.py +0 -0
  19. {spin-0.10 → spin-0.11}/spin/cmds/build.py +0 -0
  20. {spin-0.10 → spin-0.11}/spin/cmds/pip.py +0 -0
  21. {spin-0.10 → spin-0.11}/spin/color_format.py +0 -0
  22. {spin-0.10 → spin-0.11}/spin/containers.py +0 -0
  23. {spin-0.10 → spin-0.11}/spin/sectioned_help.py +0 -0
  24. {spin-0.10 → spin-0.11}/spin/tests/test_cli.py +0 -0
  25. {spin-0.10 → spin-0.11}/spin/tests/test_meson.py +0 -0
  26. {spin-0.10 → spin-0.11}/spin/tests/testutil.py +0 -0
  27. {spin-0.10 → spin-0.11}/spin.egg-info/dependency_links.txt +0 -0
  28. {spin-0.10 → spin-0.11}/spin.egg-info/entry_points.txt +0 -0
  29. {spin-0.10 → spin-0.11}/spin.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spin
3
- Version: 0.10
3
+ Version: 0.11
4
4
  Summary: Developer tool for scientific Python libraries
5
5
  Maintainer-email: Scientific Python <spin@discuss.scientific-python.org>
6
6
  License: BSD 3-Clause License
@@ -55,7 +55,7 @@ Requires-Dist: tomli; python_version < "3.11"
55
55
  Requires-Dist: colorama; platform_system == "Windows"
56
56
  Requires-Dist: importlib_metadata>=7
57
57
  Provides-Extra: lint
58
- Requires-Dist: pre-commit==3.7.0; extra == "lint"
58
+ Requires-Dist: pre-commit==3.7.1; extra == "lint"
59
59
  Provides-Extra: dev
60
60
  Requires-Dist: changelist==0.5; extra == "dev"
61
61
 
@@ -34,7 +34,7 @@ dynamic = ['version']
34
34
  spin = "spin.__main__:main"
35
35
 
36
36
  [project.optional-dependencies]
37
- lint = ["pre-commit == 3.7.0"]
37
+ lint = ["pre-commit == 3.7.1"]
38
38
  dev = ["changelist == 0.5"]
39
39
 
40
40
  [project.urls]
@@ -6,7 +6,7 @@ For usage information see `python -m spin`.
6
6
  Read more at https://github.com/scientific-python/spin
7
7
  """
8
8
 
9
- __version__ = "0.10"
9
+ __version__ = "0.11"
10
10
 
11
11
  from .cmds import util
12
12
 
@@ -0,0 +1,3 @@
1
+ __all__ = ["meson"]
2
+
3
+ from . import meson
@@ -45,6 +45,9 @@ def _editable_install_path(distname):
45
45
  except importlib_metadata.PackageNotFoundError:
46
46
  return None
47
47
 
48
+ if dist.origin is None:
49
+ return None
50
+
48
51
  if hasattr(dist.origin, "dir_info") and getattr(
49
52
  dist.origin.dir_info, "editable", False
50
53
  ):
@@ -425,8 +428,35 @@ def test(
425
428
  """ # noqa: E501
426
429
  cfg = get_config()
427
430
  distname = cfg.get("project.name", None)
431
+ pytest_args = pytest_args or ()
432
+
433
+ # User specified tests without -t flag
434
+ # Rewrite arguments as though they specified using -t and proceed
435
+ if (len(pytest_args) == 1) and (not tests):
436
+ tests = pytest_args[0]
437
+ pytest_args = ()
438
+
439
+ package = cfg.get("tool.spin.package", None)
440
+ if package is None:
441
+ print(
442
+ "Please specify `package = packagename` under `tool.spin` section of `pyproject.toml`"
443
+ )
444
+ raise SystemExit(1)
445
+
446
+ # User did not specify what to test, so we test
447
+ # the full package
448
+ if not (pytest_args or tests):
449
+ pytest_args = ("--pyargs", package)
450
+ elif tests:
451
+ if (os.path.sep in tests) or ("/" in tests):
452
+ # Tests specified as file path
453
+ pytest_args = pytest_args + (tests,)
454
+ else:
455
+ # Otherwise tests given as modules
456
+ pytest_args = pytest_args + ("--pyargs", tests)
428
457
 
429
- if gcov and distname and _is_editable_install_of_same_source(distname):
458
+ is_editable_install = distname and _is_editable_install_of_same_source(distname)
459
+ if gcov and is_editable_install:
430
460
  click.secho(
431
461
  "Error: cannot generate coverage report for editable installs",
432
462
  fg="bright_red",
@@ -443,16 +473,6 @@ def test(
443
473
  else:
444
474
  ctx.invoke(build_cmd)
445
475
 
446
- package = cfg.get("tool.spin.package", None)
447
- if package is None:
448
- print(
449
- "Please specify `package = packagename` under `tool.spin` section of `pyproject.toml`"
450
- )
451
- raise SystemExit(1)
452
-
453
- if (not pytest_args) and (not tests):
454
- tests = package
455
-
456
476
  site_path = _set_pythonpath()
457
477
  if site_path:
458
478
  print(f'$ export PYTHONPATH="{site_path}"')
@@ -476,8 +496,8 @@ def test(
476
496
  if (n_jobs != "1") and ("-n" not in pytest_args):
477
497
  pytest_args = ("-n", str(n_jobs)) + pytest_args
478
498
 
479
- if tests and "--pyargs" not in pytest_args:
480
- pytest_args = ("--pyargs", tests) + pytest_args
499
+ if not any("--import-mode" in arg for arg in pytest_args):
500
+ pytest_args = ("--import-mode=importlib",) + pytest_args
481
501
 
482
502
  if verbose:
483
503
  pytest_args = ("-v",) + pytest_args
@@ -500,9 +520,12 @@ def test(
500
520
  else:
501
521
  cmd = ["pytest"]
502
522
 
503
- pytest_p = _run(
504
- cmd + list(pytest_args),
505
- )
523
+ if not os.path.exists(install_dir):
524
+ os.mkdir(install_dir)
525
+
526
+ cwd = os.getcwd()
527
+ pytest_p = _run(cmd + list(pytest_args), cwd=site_path)
528
+ os.chdir(cwd)
506
529
 
507
530
  if gcov:
508
531
  # Verify the tools are present
@@ -857,7 +880,10 @@ def docs(
857
880
  bold=True,
858
881
  fg="bright_blue",
859
882
  )
860
- _run(["make", "-C", doc_dir, sphinx_target], replace=True)
883
+
884
+ make_bat_exists = (Path(doc_dir) / "make.bat").exists()
885
+ make_cmd = "make.bat" if sys.platform == "win32" and make_bat_exists else "make"
886
+ _run([make_cmd, sphinx_target], cwd=doc_dir, replace=True)
861
887
 
862
888
 
863
889
  @click.command()
@@ -41,6 +41,10 @@ def run(
41
41
 
42
42
  Other arguments and keywords are passed directly to `subprocess.run`.
43
43
 
44
+
45
+ Returns
46
+ -------
47
+ p : CompletedProcess
44
48
  """
45
49
  if cwd:
46
50
  if echo:
@@ -18,3 +18,10 @@ def pre_post_test():
18
18
  os.chdir(cwd)
19
19
  util.run(["git", "clean", "-xdf"], cwd="example_pkg")
20
20
  os.chdir(cwd)
21
+
22
+
23
+ @pytest.fixture
24
+ def editable_install():
25
+ util.run(["pip", "install", "--quiet", "--no-build-isolation", "-e", "."])
26
+ yield
27
+ util.run(["pip", "uninstall", "--quiet", "-y", "example_pkg"])
@@ -88,16 +88,6 @@ def test_recommend_run_python():
88
88
  ), "Failed to recommend `python run python file.py`"
89
89
 
90
90
 
91
- def test_test():
92
- """Does the test command run?"""
93
- spin("test")
94
-
95
-
96
- def test_test_with_pythonpath():
97
- """Does `spin test` work when PYTHONPATH is set?"""
98
- spin("test", env={**os.environ, "PYTHONPATH": "/tmp"})
99
-
100
-
101
91
  def test_sdist():
102
92
  spin("sdist")
103
93
 
@@ -1,15 +1,5 @@
1
- import pytest
2
1
  from testutil import spin, stdout
3
2
 
4
- from spin.cmds.util import run
5
-
6
-
7
- @pytest.fixture
8
- def editable_install():
9
- run(["pip", "install", "--quiet", "--no-build-isolation", "-e", "."])
10
- yield
11
- run(["pip", "uninstall", "--quiet", "-y", "example_pkg"])
12
-
13
3
 
14
4
  def test_detect_editable(editable_install):
15
5
  assert "Editable install of same source detected" in stdout(
@@ -0,0 +1,29 @@
1
+ import os
2
+
3
+ from testutil import spin
4
+
5
+
6
+ def test_test():
7
+ """Does the test command run?"""
8
+ spin("test")
9
+
10
+
11
+ def test_test_with_pythonpath():
12
+ """Does `spin test` work when PYTHONPATH is set?"""
13
+ spin("test", env={**os.environ, "PYTHONPATH": "/tmp"})
14
+
15
+
16
+ def test_test_file_spec():
17
+ spin("test", "example_pkg/submodule/tests/test_submodule.py")
18
+
19
+
20
+ def test_test_module_spec():
21
+ spin("test", "example_pkg.submodule")
22
+
23
+
24
+ def test_test_editable_file_spec(editable_install):
25
+ spin("test", "example_pkg/submodule/tests/test_submodule.py")
26
+
27
+
28
+ def test_test_editable_module_spec(editable_install):
29
+ spin("test", "example_pkg.submodule")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spin
3
- Version: 0.10
3
+ Version: 0.11
4
4
  Summary: Developer tool for scientific Python libraries
5
5
  Maintainer-email: Scientific Python <spin@discuss.scientific-python.org>
6
6
  License: BSD 3-Clause License
@@ -55,7 +55,7 @@ Requires-Dist: tomli; python_version < "3.11"
55
55
  Requires-Dist: colorama; platform_system == "Windows"
56
56
  Requires-Dist: importlib_metadata>=7
57
57
  Provides-Extra: lint
58
- Requires-Dist: pre-commit==3.7.0; extra == "lint"
58
+ Requires-Dist: pre-commit==3.7.1; extra == "lint"
59
59
  Provides-Extra: dev
60
60
  Requires-Dist: changelist==0.5; extra == "dev"
61
61
 
@@ -22,4 +22,5 @@ spin/tests/test_build_cmds.py
22
22
  spin/tests/test_cli.py
23
23
  spin/tests/test_editable.py
24
24
  spin/tests/test_meson.py
25
+ spin/tests/test_test.py
25
26
  spin/tests/testutil.py
@@ -11,4 +11,4 @@ tomli
11
11
  changelist==0.5
12
12
 
13
13
  [lint]
14
- pre-commit==3.7.0
14
+ pre-commit==3.7.1
@@ -1,8 +0,0 @@
1
- from . import meson
2
-
3
- # Backward compatibility with older versions
4
- build = meson.build
5
- test = meson.test
6
- ipython = meson.ipython
7
- python = meson.python
8
- shell = meson.shell
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