Skip to content

Commit

Permalink
feat: Update project
Browse files Browse the repository at this point in the history
  • Loading branch information
janw committed Oct 1, 2024
1 parent f198fc7 commit 7b5bac5
Show file tree
Hide file tree
Showing 9 changed files with 932 additions and 526 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
liberapay: janw
ko_fi: janwxyz
14 changes: 14 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Bump version

on:
push:
branches:
- main

jobs:
bump-version:
uses: janw/workflows/.github/workflows/commitizen-bump-version.yaml@main
secrets:
personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
8 changes: 8 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Linters

on:
pull_request:

jobs:
commitizen:
uses: janw/workflows/.github/workflows/commitizen.yaml@main
47 changes: 47 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish

on:
push:
tags:
- "v*.*.*"
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Build package
run: poetry build -vvv

- uses: actions/upload-artifact@v4
with:
name: package
path: |
README.md
pyproject.toml
dist/*
if-no-files-found: error
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: package

- run: ls dist/*

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # cspell: disable-line
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ dmypy.json
# End of https://www.gitignore.io/api/python

.vscode/
feed.xml
feed.xml
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ci:
autoupdate_commit_msg: 'build(pre-commit): pre-commit.ci autoupdate'
autoupdate_schedule: weekly
autofix_commit_msg: 'ci(pre-commit): auto fixes from pre-commit hooks'
autofix_prs: true

default_install_hook_types:
- pre-commit
default_stages:
- pre-commit
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.5'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.6.0"
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: check-ast

- repo: https://github.com/python-poetry/poetry
rev: '1.8.0'
hooks:
- id: poetry-check
4 changes: 1 addition & 3 deletions letterboxd_rss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@

base_url = "https://letterboxd.com/"

MATCH_TOTAL_MOVIES = re.compile(r"to see (\d+)")
s = session()


def process(args):

watchlist_url = args.letterboxd_url.rstrip("/")
if not watchlist_url.startswith("https://"):
watchlist_url = f"{base_url}{watchlist_url}"
Expand Down Expand Up @@ -80,7 +78,7 @@ def process(args):


def extract_metadata(movie, feed):
movie_url = base_url +"film/"+ movie.div.attrs["data-film-slug"]
movie_url = base_url + "film/" + movie.div.attrs["data-film-slug"]
movie_page = s.get(movie_url)
movie_soup = BeautifulSoup(movie_page.text, "html.parser")

Expand Down
1,319 changes: 806 additions & 513 deletions poetry.lock

Large diffs are not rendered by default.

31 changes: 22 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,33 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.6"
beautifulsoup4 = "^4.7"
requests = "^2.21"
feedgen = "^0.9.0"
python = "^3.9"
beautifulsoup4 = "^4.12"
requests = "^2.32"
feedgen = "^1.0"

[tool.poetry.dev-dependencies]
pytest = "^4.4"
pytest-cov = "^2.6"
pytest-vcr = "^1.0"
pytest-mock = "^1.10"
[tool.poetry.group.dev.dependencies]
commitizen = "^3.29.1"
ruff = "0.3.5"
pre-commit = "^3.6.0"
mypy = "^1.8.0"
types-beautifulsoup4 = "*"

[tool.poetry.scripts]
letterboxd-rss = "letterboxd_rss.__main__:main"

[tool.commitizen]
version_scheme = "semver"
version_provider = "poetry"
version_files = [
"pyproject.toml:version = ",
]
annotated_tag = true
tag_format = "v$version"
update_changelog_on_bump = true
changelog_start_rev = "0.2.2"
gpg_sign = true

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

0 comments on commit 7b5bac5

Please sign in to comment.