Skip to content

Commit

Permalink
switch to py +3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Feb 29, 2024
1 parent 43dd2cb commit 52d6f33
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 8 deletions.
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8
max_line_length = 180

[*.{bat,cmd,ps1}]
end_of_line = crlf

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
indent_size = 4

[*.yml]
indent_style = space
indent_size = 2

[LICENSE]
insert_final_newline = false
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python: ["3.8", "3.9", "3.10"]
python: ["3.9", "3.10", "3.11"]

steps:
- uses: compas-dev/compas-actions.build@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
tags:
- 'v*'
- "v*"

name: Create Release

Expand All @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python: ['3.8', '3.9', '3.10']
python: ["3.9", "3.10", "3.11"]

steps:
- uses: compas-dev/compas-actions.build@v4
Expand All @@ -27,4 +27,4 @@ jobs:
- uses: compas-dev/compas-actions.publish@v3
with:
pypi_token: ${{ secrets.PYPI }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ authors = [
]
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
dynamic = ['dependencies', 'optional-dependencies', 'version']
classifiers = [
"Development Status :: 4 - Beta",
"Topic :: Scientific/Engineering",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
54 changes: 52 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from compas_invocations import docs as docs_
from compas_invocations import tests
from compas_invocations.console import chdir
from compas_invocations.console import confirm


@invoke.task(
Expand Down Expand Up @@ -117,6 +118,55 @@ def linkcheck(ctx, rebuild=False):
ctx.run("sphinx-build {} -b linkcheck docs dist/docs".format(opts))


@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!"""
if release_type not in ("patch", "minor", "major"):
raise invoke.Exit("The release type parameter is invalid.\nMust be one of: major, minor, patch.")

# Run formatter
ctx.run("invoke format")

# Run checks
ctx.run("invoke test")

# Bump version and git tag it
ctx.run("bump-my-version bump %s --verbose" % release_type)

# Build project
ctx.run("python -m build")

# Prepare the change log for the next release
prepare_changelog(ctx)

# Clean up local artifacts
clean(ctx)

# Upload to pypi
if confirm(
"Everything is ready. You are about to push to git which will trigger a release to pypi.org. Are you sure?",
assume_yes=False,
):
ctx.run("git push --tags && git push")
else:
raise invoke.Exit("You need to manually revert the tag/commits created.")


@invoke.task
def prepare_changelog(ctx):
"""Prepare changelog for next release."""
UNRELEASED_CHANGELOG_TEMPLATE = "## Unreleased\n\n### Added\n\n### Changed\n\n### Removed\n\n\n## "

with chdir(ctx.base_folder):
# Preparing changelog for next release
with open("CHANGELOG.md", "r+") as changelog:
content = changelog.read()
changelog.seek(0)
changelog.write(content.replace("## ", UNRELEASED_CHANGELOG_TEMPLATE, 1))

ctx.run('git add CHANGELOG.md && git commit -m "Prepare changelog for next release"')


ns = Collection(
docs_.help,
check,
Expand All @@ -127,9 +177,9 @@ def linkcheck(ctx, rebuild=False):
tests.test,
tests.testdocs,
tests.testcodeblocks,
build.prepare_changelog,
prepare_changelog,
clean,
build.release,
release,
build.build_ghuser_components,
)
ns.configure(
Expand Down

0 comments on commit 52d6f33

Please sign in to comment.