Skip to content

Commit 8313c2f

Browse files
lithomas1stefanv
andcommitted
POC: Devpy CLI
Co-authored-by: Stefan van der Walt <[email protected]>
1 parent 113bdb3 commit 8313c2f

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.devpy/cmds.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import click
2+
from devpy.cmds.util import run
3+
4+
5+
@click.command()
6+
@click.option("--clean", is_flag=True, help="Clean build directory")
7+
@click.option(
8+
"--debug",
9+
is_flag=True,
10+
help="Build C extensions with debugging symbols and without optimization",
11+
)
12+
def build(clean, debug):
13+
extra_args = []
14+
15+
if debug:
16+
# Need to clean first, since there is a bug in
17+
# Cython, where it can't tell extensions need to be recompiled
18+
# when rebuilding in debug mode
19+
extra_args.append("--with-debugging-symbols")
20+
clean = True
21+
if clean:
22+
print("Running clean.")
23+
run(["python", "setup.py", "clean"])
24+
25+
# TODO: Rely on pip for backend agnostic build
26+
build_cmd = ["python", "setup.py", "develop"]
27+
28+
build_cmd += extra_args
29+
30+
run(build_cmd)
31+
32+
33+
@click.command()
34+
@click.argument("pytest_args", nargs=-1)
35+
def test(pytest_args):
36+
run(["python", "-m", "pytest"] + list(pytest_args))

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ MANIFEST
4242
################
4343
# setup.py working directory
4444
build
45+
build-install
4546
# sphinx build directory
4647
doc/_build
4748
# setup.py dist directory

dev.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
#
3+
# Example stub for running `python -m dev.py`
4+
#
5+
# Copy this into your project root.
6+
7+
import os
8+
import runpy
9+
import sys
10+
11+
sys.path.remove(os.path.abspath(os.path.dirname(sys.argv[0])))
12+
try:
13+
runpy.run_module("devpy", run_name="__main__")
14+
except ImportError:
15+
print("Cannot import devpy; please install it using")
16+
print()
17+
print(" pip install git+https://github.com/scientific-python/devpy")
18+
print()
19+
sys.exit(1)

pyproject.toml

+8
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,11 @@ directory = "coverage_html_report"
463463
[tool.codespell]
464464
ignore-words-list = "blocs, coo, hist, nd, sav, ser, recuse"
465465
ignore-regex = 'https://([\w/\.])+'
466+
467+
[tool.devpy]
468+
package = 'pandas'
469+
470+
[tool.devpy.commands]
471+
"Build" = [".devpy/cmds.py:build", ".devpy/cmds.py:test"]
472+
"Environments" = ["devpy.shell", "devpy.ipython", "devpy.python"]
473+
#"Documentation" = [".devpy/cmds.py:docs"]

0 commit comments

Comments
 (0)