Skip to content
Merged
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
4 changes: 2 additions & 2 deletions jupyter_releaser/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ def check_npm(dist_dir, npm_install_options):
@use_checkout_dir()
def check_manifest():
"""Check the project manifest"""
# Only run the check if we're using setuptools
if util.SETUP_PY.exists() or util.MANIFEST.exists():
# Only run the check if we have a manifest file.
if util.MANIFEST.exists():
util.run("check-manifest -v")
else:
util.log("Skipping check-manifest since there are no python package files")
Expand Down
26 changes: 11 additions & 15 deletions jupyter_releaser/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,15 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F

# Make a new branch with a uuid suffix
pr_branch = f"changelog-{uuid.uuid1().hex}"
util.run(f"{util.GIT_FETCH_CMD} {branch}", echo=True)
dirty = False
try:
util.run("git stash", echo=True)
dirty = True
except Exception:
pass
util.run(f"git checkout -b {pr_branch} origin/{branch}", echo=True)
if dirty:
if dry_run:
util.run("git merge --squash --strategy-option=theirs stash", echo=True)
else:
util.run("git stash apply", echo=True)

if not dry_run:
dirty = util.run("git --no-pager diff --stat") != ""
if dirty:
util.run("git stash")
util.run(f"{util.GIT_FETCH_CMD} {branch}")
util.run(f"git checkout -b {pr_branch} origin/{branch}")
if dirty:
util.run("git stash apply")

# Add a commit with the message
try:
Expand All @@ -192,8 +188,8 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
head = pr_branch
maintainer_can_modify = True

remote_name = util.get_remote_name(dry_run)
util.run(f"git push {remote_name} {pr_branch}", echo=True)
if not dry_run:
util.run(f"git push origin {pr_branch}", echo=True)

# title, head, base, body, maintainer_can_modify, draft, issue
pull = gh.pulls.create(title, head, base, body, maintainer_can_modify, False, None)
Expand Down
11 changes: 0 additions & 11 deletions jupyter_releaser/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,6 @@ def test_check_python_resource_path(monkeypatch, py_package, runner, build_mock,
path = bar_dir / "baz.txt"
path.write_text("hello", encoding="utf-8")

manifest = Path(util.CHECKOUT_NAME) / "MANIFEST.in"
manifest_text = manifest.read_text(encoding="utf-8")
manifest_text += "\ninclude foo/bar/baz.txt\n"
manifest.write_text(manifest_text, encoding="utf-8")

setup_cfg_path = Path(util.CHECKOUT_NAME) / "setup.cfg"
setup_cfg_text = setup_cfg_path.read_text(encoding="utf-8")
setup_cfg_text = setup_cfg_text.replace("foo.__version__", "foo.__init__.__version__")
setup_cfg_text = setup_cfg_text.replace("py_modules = foo", "")
setup_cfg_path.write_text(setup_cfg_text, encoding="utf-8")

runner(["build-python"])
runner(["check-python"])

Expand Down
7 changes: 2 additions & 5 deletions jupyter_releaser/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def pyproject_template(project_name="foo", sub_packages=None):
sub_packages = sub_packages or []
res = f"""
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling>=1.5.0"]
build-backend = "hatchling.build"

[project]
name = "{project_name}"
Expand Down Expand Up @@ -227,9 +227,6 @@ def write_files(git_repo, sub_packages=None, package_name="foo", module_name=Non
foopy = git_repo / f"{module_name}.py"
foopy.write_text(PY_MODULE_TEMPLATE, encoding="utf-8")

manifest = git_repo / "MANIFEST.in"
manifest.write_text(MANIFEST_TEMPLATE, encoding="utf-8")

license = git_repo / "LICENSE"
license.write_text(LICENSE_TEMPLATE, encoding="utf-8")

Expand Down