diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000..36b070e --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,16 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Format + uses: psf/black@stable + with: + options: "--check --diff" + src: "./src" + use_pyproject: true diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index eec2659..e4c8c89 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,30 +6,30 @@ # Action artifacts... name: Build and Deploy Sphinx Docs to GitHub Pages + on: + workflow_dispatch: + pull_request: + release: + types: + - published push: branches: - main - dev - release: - types: - - published - pull_request: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write -# Allow one concurrent deployment + concurrency: group: "pages" cancel-in-progress: true + jobs: deploy: environment: diff --git a/README.rst b/README.rst index 705b24e..d828e23 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,16 @@ -===== + +.. image:: https://badge.fury.io/py/krank.svg + :target: https://badge.fury.io/py/krank + +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/psf/black + +---- + + Krank ===== - Fetch psychology datasets from remote sources. .. important:: diff --git a/docs/index.rst b/docs/index.rst index 42494ac..7268355 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,8 +2,12 @@ .. image:: https://badge.fury.io/py/krank.svg :target: https://badge.fury.io/py/krank +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/psf/black + ---- + Krank ===== diff --git a/pyproject.toml b/pyproject.toml index f7417fa..23cb595 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,8 +40,9 @@ Homepage = "https://github.com/remrama/krank" [project.optional-dependencies] dev = [ - "sphinx", + "black", "pydata-sphinx-theme", # Needs to be in requirements.txt also (for docs.yml). + "sphinx", ] [tool.setuptools.dynamic] @@ -59,3 +60,8 @@ krank = [ "krank/data/lexicons.json", "krank/data/tables.json", ] + +[tool.black] +line-length = 88 +target-version = ["py312"] +include = '\.pyi?$'