diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 79aa7fa0..cced8ff8 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ -github: [huxuan] +github: + - huxuan diff --git a/.github/FUNDING.yml.jinja b/.github/FUNDING.yml.jinja index d354a8b1..46d0c178 100644 --- a/.github/FUNDING.yml.jinja +++ b/.github/FUNDING.yml.jinja @@ -1 +1,2 @@ -github: [{{ repo_namespace }}] +github: + - {{ repo_namespace }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f723b530..8e1e6501 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,42 +1,50 @@ -name: CI - -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize] - jobs: lint: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: + cache: pip python-version: ${{ matrix.python-version }} - cache: "pip" - run: make dev-lint - run: make lint - tests: - runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + tests: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: + cache: pip python-version: ${{ matrix.python-version }} - cache: "pip" - run: make dev-tests - run: make tests - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: flags: ${{ matrix.python-version }} + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' +name: CI +on: + pull_request: + types: + - opened + - synchronize + push: + branches: + - main diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 8b10e7ab..75e87f6a 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,12 +1,3 @@ -name: Upload Python Package - -on: - release: - types: [published] - -permissions: - contents: read - jobs: deploy: runs-on: ubuntu-latest @@ -15,11 +6,18 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.x" - cache: "pip" + cache: pip + python-version: 3.x - run: make dev-package - run: make build - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} +name: Upload Python Package +on: + release: + types: + - published +permissions: + contents: read diff --git a/.github/workflows/readthedocs-preview.yml b/.github/workflows/readthedocs-preview.yml index 43f65889..6e935305 100644 --- a/.github/workflows/readthedocs-preview.yml +++ b/.github/workflows/readthedocs-preview.yml @@ -1,17 +1,14 @@ +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: serious-scaffold-python name: Read the Docs Pull Request Preview - on: pull_request_target: types: - opened - permissions: pull-requests: write - -jobs: - documentation-links: - runs-on: ubuntu-latest - steps: - - uses: readthedocs/actions/preview@v1 - with: - project-slug: "serious-scaffold-python" diff --git a/.github/workflows/readthedocs-preview.yml.jinja b/.github/workflows/readthedocs-preview.yml.jinja index 8f905414..fc1b8034 100644 --- a/.github/workflows/readthedocs-preview.yml.jinja +++ b/.github/workflows/readthedocs-preview.yml.jinja @@ -1,17 +1,14 @@ +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: {{ repo_name }} name: Read the Docs Pull Request Preview - on: pull_request_target: types: - opened - permissions: pull-requests: write - -jobs: - documentation-links: - runs-on: ubuntu-latest - steps: - - uses: readthedocs/actions/preview@v1 - with: - project-slug: "{{ repo_name }}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1af0a0d9..aa44d560 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,5 @@ repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: + - hooks: - id: check-added-large-files - id: check-docstring-first - id: check-json @@ -14,55 +12,65 @@ repos: - id: mixed-line-ending - id: name-tests-test - id: no-commit-to-branch - stages: [push] - - id: pretty-format-json - args: [--autofix] - - id: requirements-txt-fixer - args: - [ - constraints/default.txt, - requirements.txt, - requirements/docs.txt, - requirements/lint.txt, - requirements/package.txt, - requirements/tests.txt, - ] - - id: sort-simple-yaml - files: .pre-commit-config.yaml + stages: + - push + - args: + - '--autofix' + id: pretty-format-json + - args: + - constraints/default.txt + - requirements.txt + - requirements/docs.txt + - requirements/lint.txt + - requirements/package.txt + - requirements/tests.txt + id: requirements-txt-fixer + - files: .pre-commit-config.yaml + id: sort-simple-yaml - id: trailing-whitespace - - repo: local - hooks: - - id: black + repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + - hooks: + - entry: pipenv run python -m black + id: black + language: system name: black + types: + - python + - args: + - '--filter-files' + entry: pipenv run python -m isort + id: isort language: system - entry: pipenv run python -m black - types: [python] - - id: isort name: isort - language: system - entry: pipenv run python -m isort require_serial: true - types_or: [cython, pyi, python] - args: ["--filter-files"] - - id: mypy - name: mypy + types_or: + - cython + - pyi + - python + - entry: make mypy + id: mypy language: system - entry: make mypy - types: [python] - require_serial: true + name: mypy pass_filenames: false - - id: ruff + require_serial: true + types: + - python + - entry: pipenv run python -m ruff + id: ruff + language: system name: ruff + types: + - python + - entry: pipenv run toml-sort -a -i + id: toml-sort language: system - entry: pipenv run python -m ruff - types: [python] - - id: toml-sort name: toml-sort - language: system - entry: pipenv run toml-sort -a -i - types: [toml] - - id: forbidden-files - name: forbidden files - entry: found Copier update rejection files; review them and remove them + types: + - toml + - entry: found Copier update rejection files; review them and remove them + files: \.rej$ + id: forbidden-files language: fail - files: "\\.rej$" + name: forbidden files + repo: local diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 48975986..43ba0242 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,13 +1,11 @@ -version: 2 - build: os: ubuntu-22.04 tools: - python: "3" - + python: '3' python: install: - - method: pip - path: . - extra_requirements: + - extra_requirements: - docs + method: pip + path: . +version: 2 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index c722b198..b4aad4fc 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,11 +1,11 @@ { "recommendations": [ + "PascalReitermann93.vscode-yaml-sort", "charliermarsh.ruff", "esbenp.prettier-vscode", "ms-python.black-formatter", "ms-python.python", "richie5um2.vscode-sort-json", - "shuworks.vscode-table-formatter", "streetsidesoftware.code-spell-checker", "trond-snekvik.simple-rst" ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 6bd8caa6..02681675 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,9 @@ }, "editor.defaultFormatter": "ms-python.black-formatter" }, + "[yaml]": { + "editor.defaultFormatter": "PascalReitermann93.vscode-yaml-sort" + }, "cSpell.words": [ "autofix", "automodule", @@ -58,5 +61,20 @@ "sortJSONTypeReverse": false, "sortJSONValues": false, "sortJSONValuesReverse": false - } + }, + "vscode-yaml-sort.customSortKeywords_2": [ + "_exclude", + "project_name", + "project_description", + "repo_namespace", + "author_name", + "author_email", + "repo_name", + "package_name", + "module_name" + ], + "vscode-yaml-sort.noCompatMode": true, + "vscode-yaml-sort.sortOnSave": 2, + "vscode-yaml-sort.useAsFormatter": true, + "vscode-yaml-sort.useLeadingDashes": false } diff --git a/copier.yaml b/copier.yaml index 67f792da..7ed4666a 100644 --- a/copier.yaml +++ b/copier.yaml @@ -1,51 +1,43 @@ _exclude: - - "*.py[co]" - - ".DS_Store" - - ".git" - - ".svn" - - "__pycache__" - - "copier.yaml" - - "copier.yml" - - "docs/modules/serious_scaffold.settings.rst" - - "src/serious_scaffold" - - "~*" - + - '*.py[co]' + - .DS_Store + - .git + - .svn + - __pycache__ + - copier.yaml + - copier.yml + - docs/modules/serious_scaffold.settings.rst + - src/serious_scaffold + - ~* project_name: - type: str - help: "Project name in CamelCase:" default: Serious Scaffold Python - -project_description: + help: 'Project name in CamelCase:' type: str - help: "Brief project description:" +project_description: default: A serious Python project template for out-of-box and production usage. - -repo_namespace: + help: 'Brief project description:' type: str - help: "Repo namespace, it should be the name of an user or an organization:" +repo_namespace: default: huxuan - + help: 'Repo namespace, it should be the name of an user or an organization:' + type: str author_name: + default: '{{ repo_namespace }}' + help: 'Author name:' type: str - help: "Author name:" - default: "{{ repo_namespace }}" - author_email: + default: i@{{ author_name }}.org + help: 'Author email:' type: str - help: "Author email:" - default: "i@{{ author_name }}.org" - repo_name: + default: '{{ project_name|lower|replace('' '', ''-'') }}' + help: 'Repo name:' type: str - help: "Repo name:" - default: "{{ project_name|lower|replace(' ', '-') }}" - package_name: + default: '{{ repo_name|regex_replace(''-python$'','''') }}' + help: 'Package name:' type: str - help: "Package name:" - default: "{{ repo_name|regex_replace('-python$','') }}" - module_name: + default: '{{ package_name|lower|replace(''-'', ''_'') }}' + help: 'Module name:' type: str - help: "Module name:" - default: "{{ package_name|lower|replace('-', '_') }}"