diff --git a/tasks.py b/tasks.py index d8a51226..24f91dba 100644 --- a/tasks.py +++ b/tasks.py @@ -118,50 +118,6 @@ def linkcheck(ctx, rebuild=False): ctx.run("sphinx-build {} -b linkcheck docs dist/docs".format(opts)) -@invoke.task( - help={ - "docs": "True to clean up generated documentation, otherwise False", - "bytecode": "True to clean up compiled python files, otherwise False.", - "builds": "True to clean up build/packaging artifacts, otherwise False.", - } -) -def clean(ctx, docs=True, bytecode=True, builds=True, ghuser=True): - """Cleans the local copy from compiled artifacts.""" - - with chdir(ctx.base_folder): - if builds: - ctx.run("python setup.py clean") - - if bytecode: - for root, dirs, files in os.walk(ctx.base_folder): - for f in files: - if f.endswith(".pyc"): - os.remove(os.path.join(root, f)) - if ".git" in dirs: - dirs.remove(".git") - - folders = [] - - if docs: - folders.append("docs/api/generated") - - folders.append("dist/") - - if bytecode: - for t in ("src", "tests"): - folders.extend(glob.glob("{}/**/__pycache__".format(t), recursive=True)) - - if builds: - folders.append("build/") - folders.extend(glob.glob("src/**/*.egg-info", recursive=False)) - - if ghuser and ctx.get("ghuser"): - folders.append(os.path.abspath(ctx.ghuser.target_dir)) - - for folder in folders: - shutil.rmtree(os.path.join(ctx.base_folder, folder), ignore_errors=True) - - @invoke.task(help={"release_type": "Type of release follows semver rules. Must be one of: major, minor, patch."}) def release(ctx, release_type): """Releases the project in one swift command!""" @@ -172,13 +128,13 @@ def release(ctx, release_type): ctx.run("invoke format") # Run checks - ctx.run("invoke check test") + ctx.run("invoke test") # Bump version and git tag it - ctx.run("bump2version %s --verbose" % release_type) + ctx.run("bump-my-version bump %s --verbose" % release_type) # Build project - ctx.run("python setup.py clean --all sdist bdist_wheel") + ctx.run("python -m build") # Prepare the change log for the next release prepare_changelog(ctx) @@ -221,9 +177,9 @@ def prepare_changelog(ctx): tests.test, tests.testdocs, tests.testcodeblocks, - build.prepare_changelog, + prepare_changelog, clean, - build.release, + release, build.build_ghuser_components, ) ns.configure(