Skip to content

Commit

Permalink
Merge branch 'main' into run-from-file-using-har
Browse files Browse the repository at this point in the history
  • Loading branch information
snshn authored May 20, 2024
2 parents 89a6445 + 84b96ec commit 7b91448
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 18 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'poetry'
- run: poetry install
- name: Run ruff
run: poetry run ruff format --check
- name: Run ruff lint
run: poetry run ruff check
- run: make resolve_deps
- name: Check code formatting
run: make format_check
- name: Run linter
run: make lint_check

pytest:
runs-on: ubuntu-latest
Expand All @@ -55,9 +55,9 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'poetry'
- run: poetry install
- run: make resolve_deps
- name: Run pytest
run: poetry run pytest . -v
run: make test

publish:
needs: [ check-version, format, pytest ]
Expand All @@ -71,7 +71,7 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry"
- run: poetry install
- run: make resolve_deps
- name: Build and Publish
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
Expand Down
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/make -f

# Makefile for harambe

.DEFAULT_GOAL := help

help: ## Show this helpful message
@for ML in $(MAKEFILE_LIST); do \
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $$ML | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'; \
done
.PHONY: help

format: ## Format code
@echo "Formatting code 🧹"
@poetry run ruff format
.PHONY: format

format_check: ## Check code formatting
@echo "Checking code 🧹"
@poetry run ruff format --diff
.PHONY: format_check

lint: ## Lint code
@poetry run ruff check --fix
.PHONY: lint

lint_check: ## Check code quality
@poetry run ruff check
.PHONY: lint_check

resolve_deps: ## Install required dependencies
@poetry install
.PHONY: resolve_deps

test: ## Run tests
@poetry run pytest . -v
.PHONY: test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Before submitting a PR, please run the following commands to ensure
that your code is formatted correctly.

```shell
./format.sh
make format lint
```

Happy extraction! 🦍
8 changes: 0 additions & 8 deletions format.sh

This file was deleted.

3 changes: 2 additions & 1 deletion harambe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class AsyncScraper(Protocol):
Note that scrapers in harambe should be functions, not classes.
"""

async def scrape(self, sdk: "SDK", url: URL, context: Context) -> None: ...
async def scrape(self, sdk: "SDK", url: URL, context: Context) -> None:
...


class SDK:
Expand Down

0 comments on commit 7b91448

Please sign in to comment.