-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2b2f1b4
Showing
14 changed files
with
622 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
updates: | ||
# GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
commit-message: | ||
prefix: ⬆ | ||
# Python | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
commit-message: | ||
prefix: ⬆ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Github actions init | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Update Pip | ||
run: pip install --upgrade pip | ||
|
||
- name: Install Dependencies | ||
run: pip install ruff mypy | ||
|
||
- name: Install | ||
run: pip install -e . | ||
|
||
- name: Lint | ||
run: bash scripts/lint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Github actions init | ||
uses: actions/checkout@v4 | ||
with: | ||
# To force fetching tags | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install build dependencies | ||
run: pip install build | ||
|
||
- name: Build distribution | ||
run: python -m build | ||
|
||
- name: Publish | ||
uses: pypa/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Github actions init | ||
uses: actions/checkout@v4 | ||
with: | ||
# To force fetching tags | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install build dependencies | ||
run: pip install build | ||
|
||
- name: Build | ||
run: python -m build | ||
|
||
- name: Read VERSION file | ||
id: getversion | ||
run: echo "version=$(cat src/extract_favicon/VERSION.md)" >> $GITHUB_OUTPUT | ||
|
||
- name: Changelog | ||
run: git log $(git describe --tags --abbrev=0)..HEAD --format="%s %h" > LATEST-CHANGES.md | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
dist/extract_favicon-${{ steps.getversion.outputs.version }}-py3-none-any.whl | ||
dist/extract_favicon-${{ steps.getversion.outputs.version }}.tar.gz | ||
tag_name: v${{ steps.getversion.outputs.version }} | ||
body_path: LATEST-CHANGES.md | ||
token: ${{ secrets.PAT_EXTRACT_FAVICON }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.venv | ||
__pycache__ | ||
*.pyc | ||
.ruff_cache | ||
.mypy_cache | ||
.pytest_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Extract Favicon | ||
|
||
`extract-favicon` is a Python library to find and extract the favicon of any website. | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install favicon-extract | ||
``` | ||
|
||
## Usage | ||
|
||
```console | ||
>>> import extract_favicon | ||
>>> icons = extract_favicon.from_html(my_html, root_url="https://www.python.org/static/") | ||
Icon(url='https://www.python.org/static/apple-touch-icon-144x144-precomposed.png', width=144, height=144, format='png') | ||
Icon(url='https://www.python.org/static/apple-touch-icon-114x114-precomposed.png', width=114, height=114, format='png') | ||
Icon(url='https://www.python.org/static/apple-touch-icon-72x72-precomposed.png', width=72, height=72, format='png') | ||
Icon(url='https://www.python.org/static/apple-touch-icon-precomposed.png', width=0, height=0, format='png') | ||
Icon(url='https://www.python.org/static/favicon.ico', width=0, height=0, format='ico') | ||
``` | ||
|
||
## Inspiration | ||
This library is an extension of the [favicon](https://github.com/scottwernervt/favicon/) package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "extract-favicon" | ||
description = "Find and extract the favicon of any website" | ||
dynamic = ["version"] | ||
readme = "README.md" | ||
authors = [{ name = "Alex Mili" }] | ||
license = { file = "LICENSE" } | ||
requires-python = ">=3.9" | ||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
"Intended Audience :: Developers", | ||
] | ||
keywords = [] | ||
dependencies = [ | ||
"bs4", | ||
"pillow" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/AlexMili/Extract_Favicon" | ||
Issues = "https://github.com/AlexMili/Extract_Favicon/issues" | ||
Repository = "https://github.com/AlexMili/Extract_Favicon" | ||
Documentation = "https://github.com/AlexMili/Extract_Favicon" | ||
|
||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["./src/extract_favicon/"] | ||
|
||
[tool.hatch.version] | ||
path = "src/extract_favicon/VERSION.md" | ||
pattern = "(?P<version>.*)" | ||
|
||
[tool.ruff.lint.isort] | ||
lines-after-imports = 2 | ||
known-first-party = ["extract_favicon"] | ||
|
||
[tool.mypy] | ||
strict = true | ||
exclude = [".venv", "test", "build", "dist"] | ||
ignore_missing_imports = true | ||
show_error_codes = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -x | ||
|
||
mypy src/extract_favicon | ||
ruff check src/extract_favicon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os.path as osp | ||
|
||
from .main import from_html | ||
|
||
|
||
__all__ = ["from_html"] | ||
|
||
version_path = osp.join(osp.dirname(__file__), "VERSION.md") | ||
if osp.exists(version_path): | ||
with open(version_path, "r") as f: | ||
__version__ = f.readline() |
Oops, something went wrong.