Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit config #11

Merged
merged 11 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: huaxk/postgis-action@v1
with:
postgresql password: ${{ env.POSTGRESQL_PASSWORD }}
postgresql db: "test"
postgresql db: 'test'
- name: Run pygeoapi
run: |
docker run -d -it --rm -p 5000:80 $(docker build -q .)
Expand All @@ -41,6 +41,3 @@ jobs:
pytest tests/test_sitemap_process.py
pytest tests/test_sparql_provider.py
pytest tests/test_xml_formatter.py
- name: run flake8 ⚙️
run: |
find . -type f -name "*.py" | xargs flake8
150 changes: 75 additions & 75 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,114 +10,114 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install Pillow numpy filetype setuptools wheel twine
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install Pillow numpy filetype setuptools wheel twine
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish dist to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pygeoapi-plugins
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ''
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

publish-to-testpypi:
name: Publish dist to TestPyPI
needs:
- build
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/pygeoapi-plugins

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
minimum_pre_commit_version: '2.9.0'
ci:
autoupdate_schedule: monthly
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: local
hooks:
- id: forbid-symlinks
name: Forbid symlinks
entry: Forbid symlinks
language: fail
types: [symlink]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
hooks:
- id: forbid-crlf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
exclude_types: [svg]
- id: fix-byte-order-marker
- id: mixed-line-ending
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v4.0.0-alpha.8'
hooks:
- id: prettier
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.3
hooks:
# Run the linter.
- id: ruff
args: [--fix]
- id: ruff-format
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true
}
5 changes: 2 additions & 3 deletions docker/examples/ckan/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
#
# =================================================================

version: "3"
version: '3'

services:

pygeoapi:
container_name: pygeoapi-ckan
build:
context: ../../..
ports:
- "5000:80"
- '5000:80'
environment:
- PYGEOAPI_URL=http://localhost:5000
volumes:
Expand Down
5 changes: 2 additions & 3 deletions docker/examples/sparql/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
#
# =================================================================

version: "3"
version: '3'

services:

pygeoapi:
container_name: pygeoapi-sparql
build:
context: ../../..
ports:
- "5001:80"
- '5001:80'
environment:
- PYGEOAPI_URL=http://localhost:5001
volumes:
Expand Down
2 changes: 1 addition & 1 deletion docker/examples/sparql/sparql.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ resources:
table: states
sparql_provider: SQLiteGPKG
sparql_endpoint: https://dbpedia.org/sparql
sparql_subject: " :NAME"
sparql_subject: ' :NAME'
sparql_predicates:
senator: dbp:senators
motto: dbo:motto|dbp:motto
Expand Down
2 changes: 1 addition & 1 deletion docker/pygeoapi.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ resources:
table: states
sparql_provider: SQLiteGPKG
sparql_endpoint: https://dbpedia.org/sparql
sparql_subject: " :NAME"
sparql_subject: ' :NAME'
sparql_predicates:
senator: dbp:senators
motto: dbo:motto|dbp:motto
Expand Down
2 changes: 1 addition & 1 deletion pygeoapi_plugins/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
#
# =================================================================

__version__ = '0.1.0'
__version__ = "0.1.0"
Loading
Loading