Skip to content

Commit

Permalink
update pyproject/workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-goeldi committed Mar 7, 2024
1 parent 8b018fa commit 389d2ac
Show file tree
Hide file tree
Showing 11 changed files with 363 additions and 382 deletions.
67 changes: 67 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE [#$NUMBER](https://github.com/gdsfactory/kweb/pull/$NUMBER)'
template: |
# What's Changed
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 'Breaking'
label: 'breaking'
- title: 'New'
labels:
- 'enhancement'
- 'feature'
- title: 'Bug Fixes'
label: 'bug'
- title: 'Maintenance'
label: 'maintenance'
- title: 'Documentation'
label: 'documentation'
- title: 'Other changes'
- title: 'Dependency Updates'
label: 'dependencies'
collapse-after: 5

# Change major/breaking to major and enhancement/minor to minor after v1.0
version-resolver:
minor:
labels:
- 'breaking'
patch:
labels:
- 'enhancement'
- 'bug'
- 'maintenance'
- 'documentation'
- 'dependencies'
- 'security'
default: patch

exclude-labels:
- 'github_actions'

autolabeler:
- label: 'documentation'
files:
- '*.md'
branch:
- '/docs-.+/'
- label: 'bug'
branch:
- '/^fix-.+/'
title:
- '/^fix/i'
- label: 'enhancement'
branch:
- '/^feature-.+/'
- '/^add-.+/'
- '/^improve-.+/'
title:
- '/^add\s/i'
- label: 'github_actions'
files:
- '.github/**/*.yml'
18 changes: 18 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Update Changelog

on:
pull_request:
types: [ closed ]

jobs:
changelog:
name: Update changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: rhysd/changelog-from-release/action@v3
with:
file: CHANGELOG.md
github_token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Drafter and Labels

on:
push:
branches:
- main
pull_request:
types: [edited, opened, reopened, synchronize, unlabeled, labeled]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
require_label:
if: github.event.pull_request
needs: update_release_draft
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: mheap/github-action-required-labels@v5
with:
mode: minimum
count: 1
labels: "breaking, bug, github_actions, documentation, dependencies, enhancement, feature, maintenance, security"
add_comment: true
25 changes: 0 additions & 25 deletions .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,3 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
# test_docs:
# needs: [pre-commit]
# runs-on: ${{ matrix.os }}
# strategy:
# max-parallel: 12
# matrix:
# python-version: ['3.10']
# os: [ubuntu-latest]

# steps:
# - uses: actions/checkout@v3
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.11'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# sudo apt install pandoc
# make install
# pip install -e .[docs]
# - name: Test documentation
# run: |
# cd docs
# make html
177 changes: 49 additions & 128 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,147 +1,68 @@
exclude: |
(?x)(
^src/kweb/static/bootstrap/
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
rev: "v4.5.0"
hooks:
- id: check-added-large-files
exclude: |
(?x)^(
dodata/docs/_static/.*
)$
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: 'changelog\.d/.*|CHANGLEOG\.md'
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace
# - id: end-of-file-fixer
# - id: mixed-line-ending
# - id: name-tests-test
# args: ["--pytest-test-first"]
# - id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.2.0"
hooks:
- id: ruff
- repo: https://github.com/djlint/djLint
rev: v1.34.1
hooks:
- id: djlint-reformat-jinja
files: "\\.html"
types_or: ['html']
exclude: |
(?x)^(
changelog\.d/.*|
CHANGELOG\.md
src/kweb/static/bootstrap/.*
)$
- repo: https://github.com/pycqa/isort
rev: "5.12.0"
- id: djlint-jinja
files: "\\.html"
types_or: ['html']
exclude: |
(?x)^(
src/kweb/static/bootstrap/.*
)$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: isort
files: "kweb/.*"
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: "23.7.0"
- id: shellcheck

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: black

# - repo: https://github.com/pycqa/flake8
# rev: "647996c743f9e77368ce46cc74abe98549dd4c3a"
# hooks:
# - id: flake8
- id: pretty-format-toml
args: [--autofix]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
exclude: |
(?x)^(
src/kweb/static/bootstrap/.*
)$
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
files: ".ipynb"

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py310-plus, --keep-runtime-typing]

# - repo: https://github.com/codespell-project/codespell
# rev: 3841ffe24aba604a5d16439c8216b018a7ec649a
# hooks:
# - id: codespell
# args: ["-L TE,TE/TM,te,ba,FPR,fpr_spacing,ro,donot"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck

# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: 7b4409161486c6956bb3206ce96db5d56731b1b9 # Use the ref you want to point at
# hooks:
# - id: python-use-type-annotations

- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args: [--exit-zero]
# ignore all tests, not just tests data
exclude: ^tests/
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: "v0.991"
# hooks:
# - id: mypy
# exclude: ^(docs/|example-plugin/|tests/fixtures)
# additional_dependencies:
# - "pydantic"
# - repo: https://github.com/terrencepreilly/darglint
# rev: master
# hooks:
# - id: darglint
# - repo: https://github.com/pycqa/pydocstyle
# rev: "a6fe4222012e990042c86cdaaa904a8d059752ee"
# hooks:
# - id: pydocstyle
# additional_dependencies: ["pydocstyle[toml]"]
# - repo: https://github.com/asottile/reorder_python_imports
# rev: 2b2f0c74acdb3de316e23ceb7dd0d7945c354050
# hooks:
# - id: reorder-python-imports
# - repo: https://github.com/PyCQA/pylint
# rev: v2.14.1
# hooks:
# - id: pylint
# args: [--exit-zero]
# - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
# rev: 6565d773ca281682d7062d4c0be74538cc474cc9
# hooks:
# - id: pretty-format-java
# args: [--autofix]
# - id: pretty-format-kotlin
# args: [--autofix]
# - id: pretty-format-yaml
# args: [--autofix, --indent, "2"]
# - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.21.0 # or higher tag
# hooks:
# - id: yamllint
# args: [--format, parsable, --strict]
# - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
# rev: 0.1.0 # or specific tag
# hooks:
# - id: yamlfmt
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-log-warn
- id: python-no-eval
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 3e5186603806260939b5f1b0372c058203c65553
# hooks:
# - id: nbqa-black
# additional_dependencies: [jupytext, black] # optional, only if you're using Jupytext
# - id: nbqa-pyupgrade
# args: ["--py37-plus"]
# # - id: nbqa-flake8
# # - id: nbqa-isort
# # args: ["--float-to-top"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.285"
hooks:
- id: ruff
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ KWeb offers two basic apps:
- Browser:

A version that provides a version with a file browser for a folder and the kweb viewer for viewing the gds file in that folder.
This can be used by importing the funciton `kweb.browser.get_app` and settings the `KWEB_FILESLOCATION` env variable of passing
This can be used by importing the function `kweb.browser.get_app` and settings the `KWEB_FILESLOCATION` env variable of passing
`fileslocation=<Path object for target folder>` to the function. Alternatively there is a default one in `kweb.default.app` that
will only look for the env variable.
Expand All @@ -40,7 +40,7 @@ KWeb offers two basic apps:
```bash
# Clone the repository to your local
git clone https://github.com/gdsfactory/kweb.git
# Install the necessary dependecies
# Install the necessary dependencies
cd /kweb
python -m pip install -e .[dev]
```
Expand All @@ -63,7 +63,7 @@ Copy the link http://127.0.0.1:8000/gds/file.gds (or http://localhost:8000/gds/f
#### Contributing
Pleas make sure you have also installed pre-commit before committing:
Please make sure you have also installed pre-commit before committing:
```bash
python -m pip install pre-commit
Expand Down
15 changes: 0 additions & 15 deletions changelog.d/changelog_template.jinja

This file was deleted.

Loading

0 comments on commit 389d2ac

Please sign in to comment.