Skip to content

POC: Devpy CLI #50260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .devpy/cmds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import click
from devpy.cmds.util import run


@click.command()
@click.option("--clean", is_flag=True, help="Clean build directory")
@click.option(
"--debug",
is_flag=True,
help="Build C extensions with debugging symbols and without optimization",
)
def build(clean, debug):
extra_args = []

if debug:
# Need to clean first, since there is a bug in
# Cython, where it can't tell extensions need to be recompiled
# when rebuilding in debug mode
extra_args.append("--with-debugging-symbols")
clean = True
if clean:
print("Running clean.")
run(["python", "setup.py", "clean"])

# TODO: Rely on pip for backend agnostic build
build_cmd = ["python", "setup.py", "develop"]

build_cmd += extra_args

run(build_cmd)


@click.command()
@click.argument("pytest_args", nargs=-1)
def test(pytest_args):
run(["python", "-m", "pytest"] + list(pytest_args))
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ MANIFEST
################
# setup.py working directory
build
build-install
# sphinx build directory
doc/_build
# setup.py dist directory
Expand Down
19 changes: 19 additions & 0 deletions dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
#
# Example stub for running `python -m dev.py`
#
# Copy this into your project root.

import os
import runpy
import sys

sys.path.remove(os.path.abspath(os.path.dirname(sys.argv[0])))
try:
runpy.run_module("devpy", run_name="__main__")
except ImportError:
print("Cannot import devpy; please install it using")
print()
print(" pip install git+https://github.com/scientific-python/devpy")
print()
sys.exit(1)
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,11 @@ directory = "coverage_html_report"
[tool.codespell]
ignore-words-list = "blocs, coo, hist, nd, sav, ser, recuse"
ignore-regex = 'https://([\w/\.])+'

[tool.devpy]
package = 'pandas'

[tool.devpy.commands]
"Build" = [".devpy/cmds.py:build", ".devpy/cmds.py:test"]
"Environments" = ["devpy.shell", "devpy.ipython", "devpy.python"]
#"Documentation" = [".devpy/cmds.py:docs"]