Skip to content

Commit

Permalink
ci: update cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff authored Oct 1, 2023
1 parent 9f4be02 commit b410e13
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/MartinBernstorff/swift-python-cookiecutter",
"commit": "525b1f682621953d7ef9deb6ad6cf7359ebd43c8",
"commit": "7fdb02999e8596c525377c208ca902645d134f97",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
12 changes: 12 additions & 0 deletions .github/recommended_repo_setup.md.rej
Original file line number Diff line number Diff line change
@@ -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
59 changes: 59 additions & 0 deletions .github/workflows/release.yml.rej
Original file line number Diff line number Diff line change
@@ -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/[email protected]
+ id: release
+ uses: python-semantic-release/[email protected]
+ 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 }}
108 changes: 108 additions & 0 deletions pyproject.toml.rej
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"}
+ { name = "Martin Bernstorff", email = "[email protected]" },
]
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

0 comments on commit b410e13

Please sign in to comment.