From 9a03a2909da24f3f9a6fbcb7b0e615a69c71d2ec Mon Sep 17 00:00:00 2001 From: MartinBernstorff Date: Sun, 15 Oct 2023 10:43:35 +0000 Subject: [PATCH] ci: update cruft --- .cruft.json | 2 +- .github/recommended_repo_setup.md.rej | 12 +++ .github/workflows/release.yml.rej | 59 ++++++++++++++ pyproject.toml.rej | 108 ++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 .github/recommended_repo_setup.md.rej create mode 100644 .github/workflows/release.yml.rej create mode 100644 pyproject.toml.rej diff --git a/.cruft.json b/.cruft.json index 3f72bab..5be5520 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/MartinBernstorff/swift-python-cookiecutter", - "commit": "525b1f682621953d7ef9deb6ad6cf7359ebd43c8", + "commit": "7fdb02999e8596c525377c208ca902645d134f97", "checkout": null, "context": { "cookiecutter": { diff --git a/.github/recommended_repo_setup.md.rej b/.github/recommended_repo_setup.md.rej new file mode 100644 index 0000000..4dc7dac --- /dev/null +++ b/.github/recommended_repo_setup.md.rej @@ -0,0 +1,12 @@ +diff a/.github/recommended_repo_setup.md b/.github/recommended_repo_setup.md (rejected hunks) +@@ -34,4 +34,7 @@ + * pre-commit (formatting) + * pytest (tests) + * check_for_rej (check for residual cruft updates) +- * Require conversation resolution before merging +\ No newline at end of file ++ * Require conversation resolution before merging ++ ++### Publishing to PyPI ++If do not wish to pypi, you can just delete the `release.yml` file. If you do wish to publish, you need to setup trusted publishing [here](https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/). +\ No newline at end of file diff --git a/.github/workflows/release.yml.rej b/.github/workflows/release.yml.rej new file mode 100644 index 0000000..c1d3d85 --- /dev/null +++ b/.github/workflows/release.yml.rej @@ -0,0 +1,59 @@ +diff a/.github/workflows/release.yml b/.github/workflows/release.yml (rejected hunks) +@@ -1,8 +1,9 @@ + # This workflow will +-# 1) Update the version number in pyproject.toml based on the commit history +-# 2) Create a git tag +-# 3) Create a release on GitHub +-# 4) Upload the package to PyPI ++# - Find the latest version tag based on the commit history ++# - Create a git tag for the new version ++# - Update the version number in pyproject.toml based on the commit history ++# - Upload the package to PyPI ++# - Create a release on GitHub + + name: Release + on: +@@ -14,24 +15,33 @@ jobs: + release: + runs-on: ubuntu-latest + concurrency: release ++ permissions: ++ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing using PyPI ++ # a guide on how to set it up is available here: https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/ ++ + + if: ${{ github.ref == 'refs/heads/main' && github.event.workflow_run.conclusion == 'success'}} + steps: +- # Checkout action is required for token to persist + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + + - name: Python Semantic Release +- uses: relekang/python-semantic-release@v7.33.1 ++ id: release ++ uses: python-semantic-release/python-semantic-release@v8.0.4 ++ with: ++ github_token: ${{ secrets.PAT }} ++ ++ - name: Publish package distributions to PyPI ++ uses: pypa/gh-action-pypi-publish@release/v1 ++ if: steps.release.outputs.released == 'true' ++ # This action supports PyPI's trusted publishing implementation, which allows authentication to PyPI without a manually ++ # configured API token or username/password combination. To perform trusted publishing with this action, your project's ++ # publisher must already be configured on PyPI. ++ ++ - name: Publish package distributions to GitHub Releases ++ uses: python-semantic-release/upload-to-gh-release@main ++ if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.PAT }} +- # Remember to copy the [tool.semantic_release] section from pyproject.toml +- # as well +- # To enable pypi, +- # 1) Set upload_to_pypi to true in pyproject.toml and +- # 2) Set the pypi_token in the repo +- # 3) Uncomment the two lines below +- repository_username: __token__ +- repository_password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/pyproject.toml.rej b/pyproject.toml.rej new file mode 100644 index 0000000..46a6c0f --- /dev/null +++ b/pyproject.toml.rej @@ -0,0 +1,108 @@ +diff a/pyproject.toml b/pyproject.toml (rejected hunks) +@@ -3,10 +3,12 @@ requires = ["setuptools>=61.0.0", "wheel", "setuptools_scm"] + build-backend = "setuptools.build_meta" + + [project] ++ ++ + name = "personal-mnemonic-medium" + version = "0.0.0" + authors = [ +- {name = "Martin Bernstorff", email = "martinbernstorfff@gmail.com"} ++ { name = "Martin Bernstorff", email = "martinbernstorfff@gmail.com" }, + ] + description = "Personal Mnemonic Medium" + classifiers = [ +@@ -14,13 +16,11 @@ classifiers = [ + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3.9", +- "Programming Language :: Python :: 3.10" ++ "Programming Language :: Python :: 3.10", ++ "Programming Language :: Python :: 3.11", + ] + requires-python = ">=3.9" +-dependencies = [ +- "pydantic" +-] +- ++dependencies = ["pydantic"] + [project.license] + file = "LICENSE" + name = "MIT" +@@ -32,7 +32,7 @@ dev = [ + "pre-commit>=2.20.0", + "ruff>=0.0.254", + "black[jupyter]>=22.8.0", +- "pandas-stubs>=0.0.0", # type stubs for pandas ++ "pandas-stubs>=0.0.0", # type stubs for pandas + "invoke==2.1.1", + ] + tests = [ +@@ -44,13 +44,13 @@ tests = [ + ] + docs = [ + "sphinx>=5.3.0", +- "furo>=2022.12.7", # theme ++ "furo>=2022.12.7", # theme + "sphinx-copybutton>=0.5.1", + "sphinxext-opengraph>=0.7.3", + "sphinx_design>=0.3.0", + "sphinx_togglebutton>=0.2.3", +- "myst-nb>=0.6.0", # for rendering notebooks +- "jupyter>=1.0.0", # for tutorials ++ "myst-nb>=0.6.0", # for rendering notebooks ++ "jupyter>=1.0.0", # for tutorials + ] + + +@@ -95,17 +95,9 @@ select = [ + "RET", + "RUF", + "SIM", +- "W" +-] +-ignore = [ +- "ANN101", +- "ANN401", +- "E402", +- "E501", +- "F401", +- "F841", +- "RET504" ++ "W", + ] ++ignore = ["ANN101", "ANN401", "E402", "E501", "F401", "F841", "RET504"] + ignore-init-module-imports = true + # Allow autofix for all enabled rules (when `--fix`) is provided. + unfixable = ["ERA"] +@@ -150,13 +142,10 @@ max-complexity = 10 + + [tool.semantic_release] + branch = "main" +-version_variable = [ +- "pyproject.toml:version" +-] +-upload_to_pypi = false +-upload_to_release = false ++version_toml = ["pyproject.toml:project.version"] + build_command = "python -m pip install build; python -m build" + ++ + [tool.setuptools] + include-package-data = true + +@@ -175,11 +164,11 @@ commands = + + [testenv:type] + description: run type checks +-extras = test, dev ++extras = tests, dev + basepython = py39 # Setting these explicitly avoid recreating env if your shell is set to a different version + use_develop = true + commands = +- pyright . ++ pyright src/ + + [testenv:docs] + description: build docs