linkgnome 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linkgnome-0.0.3/.github/workflows/ci.yml +51 -0
- linkgnome-0.0.3/.github/workflows/publish.yml +135 -0
- linkgnome-0.0.3/.gitignore +218 -0
- linkgnome-0.0.3/.vscode/settings.json +4 -0
- linkgnome-0.0.3/LICENSE +28 -0
- linkgnome-0.0.3/PKG-INFO +34 -0
- linkgnome-0.0.3/README.md +1 -0
- linkgnome-0.0.3/pyproject.toml +85 -0
- linkgnome-0.0.3/src/linkgnome/__init__.py +3 -0
- linkgnome-0.0.3/src/linkgnome/cache.py +57 -0
- linkgnome-0.0.3/src/linkgnome/cli.py +124 -0
- linkgnome-0.0.3/src/linkgnome/config.py +169 -0
- linkgnome-0.0.3/src/linkgnome/db.py +278 -0
- linkgnome-0.0.3/src/linkgnome/fetchers/__init__.py +0 -0
- linkgnome-0.0.3/src/linkgnome/fetchers/base.py +91 -0
- linkgnome-0.0.3/src/linkgnome/fetchers/bluesky.py +179 -0
- linkgnome-0.0.3/src/linkgnome/fetchers/mastodon.py +265 -0
- linkgnome-0.0.3/src/linkgnome/link_meta.py +87 -0
- linkgnome-0.0.3/src/linkgnome/scorer.py +238 -0
- linkgnome-0.0.3/src/linkgnome/setup.py +194 -0
- linkgnome-0.0.3/src/linkgnome/tui.py +288 -0
- linkgnome-0.0.3/tests/fetchers/test_bluesky.py +275 -0
- linkgnome-0.0.3/tests/fetchers/test_mastodon.py +229 -0
- linkgnome-0.0.3/tests/test_cache.py +93 -0
- linkgnome-0.0.3/tests/test_config.py +86 -0
- linkgnome-0.0.3/tests/test_scorer.py +228 -0
- linkgnome-0.0.3/uv.lock +692 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI Tests and Coverage
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
cache: 'pip'
|
|
27
|
+
cache-dependency-path: |
|
|
28
|
+
**/pyproject.toml
|
|
29
|
+
**/uv.lock
|
|
30
|
+
|
|
31
|
+
- name: Install uv
|
|
32
|
+
run: |
|
|
33
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
34
|
+
export PATH="$HOME/.cargo/bin:$PATH"
|
|
35
|
+
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: |
|
|
38
|
+
python -m pip install --upgrade pip
|
|
39
|
+
uv sync --all-extras
|
|
40
|
+
|
|
41
|
+
- name: Run tests with coverage
|
|
42
|
+
run: |
|
|
43
|
+
source ~/.cargo/env
|
|
44
|
+
uv run pytest --cov=linkgnome --cov-report=xml --cov-report=term-missing
|
|
45
|
+
|
|
46
|
+
- name: Upload coverage to Codecov
|
|
47
|
+
uses: codecov/codecov-action@v4
|
|
48
|
+
with:
|
|
49
|
+
file: ./coverage.xml
|
|
50
|
+
flags: unittests
|
|
51
|
+
name: codecov-umbrella
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version_bump:
|
|
7
|
+
description: "Version bump type (patch, minor, major)"
|
|
8
|
+
required: true
|
|
9
|
+
default: "patch"
|
|
10
|
+
type: choice
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
release:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: write
|
|
21
|
+
id-token: write
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
+
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.12"
|
|
33
|
+
|
|
34
|
+
- name: Install UV
|
|
35
|
+
run: |
|
|
36
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
37
|
+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
38
|
+
|
|
39
|
+
- name: Get current version
|
|
40
|
+
id: current_version
|
|
41
|
+
run: |
|
|
42
|
+
CURRENT_VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' src/linkgnome/__init__.py)
|
|
43
|
+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
44
|
+
echo "Current version: $CURRENT_VERSION"
|
|
45
|
+
|
|
46
|
+
- name: Determine version bump
|
|
47
|
+
id: determine_bump
|
|
48
|
+
run: |
|
|
49
|
+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
50
|
+
echo "bump_type=${{ github.event.inputs.version_bump }}" >> $GITHUB_OUTPUT
|
|
51
|
+
else
|
|
52
|
+
echo "bump_type=patch" >> $GITHUB_OUTPUT
|
|
53
|
+
fi
|
|
54
|
+
echo "Bump type: ${{ github.event.inputs.version_bump }}"
|
|
55
|
+
|
|
56
|
+
- name: Calculate new version
|
|
57
|
+
id: new_version
|
|
58
|
+
run: |
|
|
59
|
+
CURRENT_VERSION="${{ steps.current_version.outputs.version }}"
|
|
60
|
+
BUMP_TYPE="${{ steps.determine_bump.outputs.bump_type }}"
|
|
61
|
+
|
|
62
|
+
# Split version into components
|
|
63
|
+
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
|
|
64
|
+
MAJOR="${VERSION_PARTS[0]}"
|
|
65
|
+
MINOR="${VERSION_PARTS[1]}"
|
|
66
|
+
PATCH="${VERSION_PARTS[2]}"
|
|
67
|
+
|
|
68
|
+
# Increment based on bump type
|
|
69
|
+
case $BUMP_TYPE in
|
|
70
|
+
major)
|
|
71
|
+
MAJOR=$((MAJOR + 1))
|
|
72
|
+
MINOR=0
|
|
73
|
+
PATCH=0
|
|
74
|
+
;;
|
|
75
|
+
minor)
|
|
76
|
+
MINOR=$((MINOR + 1))
|
|
77
|
+
PATCH=0
|
|
78
|
+
;;
|
|
79
|
+
patch)
|
|
80
|
+
PATCH=$((PATCH + 1))
|
|
81
|
+
;;
|
|
82
|
+
esac
|
|
83
|
+
|
|
84
|
+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
|
|
85
|
+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
86
|
+
echo "New version: $NEW_VERSION"
|
|
87
|
+
|
|
88
|
+
- name: Update version in __init__.py
|
|
89
|
+
run: |
|
|
90
|
+
sed -i 's/__version__ = "${{ steps.current_version.outputs.version }}"/__version__ = "${{ steps.new_version.outputs.version }}"/' src/linkgnome/__init__.py
|
|
91
|
+
|
|
92
|
+
- name: Commit version bump
|
|
93
|
+
run: |
|
|
94
|
+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
95
|
+
git config --local user.name "github-actions[bot]"
|
|
96
|
+
git add src/linkgnome/__init__.py
|
|
97
|
+
git commit -m "chore: bump version to ${{ steps.new_version.outputs.version }}"
|
|
98
|
+
git push
|
|
99
|
+
|
|
100
|
+
- name: Create and push tag
|
|
101
|
+
run: |
|
|
102
|
+
git tag -a "v${{ steps.new_version.outputs.version }}" -m "Release v${{ steps.new_version.outputs.version }}"
|
|
103
|
+
git push origin "v${{ steps.new_version.outputs.version }}"
|
|
104
|
+
|
|
105
|
+
- name: Install dependencies
|
|
106
|
+
run: |
|
|
107
|
+
uv venv
|
|
108
|
+
source .venv/bin/activate
|
|
109
|
+
uv pip install build twine
|
|
110
|
+
|
|
111
|
+
- name: Build package
|
|
112
|
+
run: |
|
|
113
|
+
source .venv/bin/activate
|
|
114
|
+
python -m build
|
|
115
|
+
|
|
116
|
+
- name: Publish to PyPI
|
|
117
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
118
|
+
with:
|
|
119
|
+
print-hash: true
|
|
120
|
+
|
|
121
|
+
- name: Create GitHub Release
|
|
122
|
+
uses: softprops/action-gh-release@v2
|
|
123
|
+
with:
|
|
124
|
+
tag_name: v${{ steps.new_version.outputs.version }}
|
|
125
|
+
name: Release v${{ steps.new_version.outputs.version }}
|
|
126
|
+
body: |
|
|
127
|
+
## Changes in v${{ steps.new_version.outputs.version }}
|
|
128
|
+
|
|
129
|
+
This release was automatically created based on commits to the main branch.
|
|
130
|
+
|
|
131
|
+
### Version bump type: ${{ steps.determine_bump.outputs.bump_type }}
|
|
132
|
+
|
|
133
|
+
See the [commit history](https://github.com/${{ github.repository }}/compare/${{ steps.current_version.outputs.version }}...v${{ steps.new_version.outputs.version }}) for detailed changes.
|
|
134
|
+
draft: false
|
|
135
|
+
prerelease: false
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
linkgnome-0.0.3/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Philip James
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
linkgnome-0.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: linkgnome
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Terminal-based link aggregator for Mastodon and Bluesky feeds
|
|
5
|
+
Project-URL: Homepage, https://github.com/phildini/linkgnome
|
|
6
|
+
Project-URL: Documentation, https://github.com/phildini/linkgnome/blob/main/README.md
|
|
7
|
+
Project-URL: Repository, https://github.com/phildini/linkgnome
|
|
8
|
+
Project-URL: Issues, https://github.com/phildini/linkgnome/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/phildini/linkgnome/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Mastodon, https://wandering.shop/@phildini
|
|
11
|
+
Project-URL: Bluesky, https://bsky.app/profile/phildini.net
|
|
12
|
+
Author-email: Philip James <phildini@phildini.net>
|
|
13
|
+
Maintainer-email: Philip James <phildini@phildini.net>
|
|
14
|
+
License: BSD 3
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Environment :: Console
|
|
18
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
19
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Topic :: Communications
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: certifi>=2026.4.22
|
|
25
|
+
Requires-Dist: click>=8.1.0
|
|
26
|
+
Requires-Dist: diskcache>=5.6.0
|
|
27
|
+
Requires-Dist: httpx[http2]>=0.27.0
|
|
28
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
29
|
+
Requires-Dist: pydantic>=2.0.0
|
|
30
|
+
Requires-Dist: questionary>=2.0.0
|
|
31
|
+
Requires-Dist: rich>=13.0.0
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# linkgnome
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# linkgnome
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "linkgnome"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Terminal-based link aggregator for Mastodon and Bluesky feeds"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = {text = "BSD 3"}
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "Philip James", email = "phildini@phildini.net"},
|
|
10
|
+
]
|
|
11
|
+
maintainers = [
|
|
12
|
+
{name = "Philip James", email = "phildini@phildini.net"},
|
|
13
|
+
]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: End Users/Desktop",
|
|
18
|
+
"License :: OSI Approved :: BSD License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Topic :: Communications",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
dependencies = [
|
|
25
|
+
"click>=8.1.0",
|
|
26
|
+
"rich>=13.0.0",
|
|
27
|
+
"pydantic>=2.0.0",
|
|
28
|
+
"pydantic-settings>=2.0.0",
|
|
29
|
+
"httpx[http2]>=0.27.0",
|
|
30
|
+
"questionary>=2.0.0",
|
|
31
|
+
"diskcache>=5.6.0",
|
|
32
|
+
"certifi>=2026.4.22",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/phildini/linkgnome"
|
|
37
|
+
Documentation = "https://github.com/phildini/linkgnome/blob/main/README.md"
|
|
38
|
+
Repository = "https://github.com/phildini/linkgnome"
|
|
39
|
+
Issues = "https://github.com/phildini/linkgnome/issues"
|
|
40
|
+
Changelog = "https://github.com/phildini/linkgnome/blob/main/CHANGELOG.md"
|
|
41
|
+
Mastodon = "https://wandering.shop/@phildini"
|
|
42
|
+
Bluesky = "https://bsky.app/profile/phildini.net"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
[dependency-groups]
|
|
46
|
+
dev = [
|
|
47
|
+
"respx>=0.23.1",
|
|
48
|
+
"pytest>=8.0.0",
|
|
49
|
+
"pytest-asyncio>=0.23.0",
|
|
50
|
+
"pytest-cov>=4.0.0",
|
|
51
|
+
"ruff>=0.3.0",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
linkgnome = "linkgnome.cli:main"
|
|
56
|
+
|
|
57
|
+
[build-system]
|
|
58
|
+
requires = ["hatchling"]
|
|
59
|
+
build-backend = "hatchling.build"
|
|
60
|
+
|
|
61
|
+
[tool.hatch.version]
|
|
62
|
+
path = "src/linkgnome/__init__.py"
|
|
63
|
+
|
|
64
|
+
[tool.hatch.build.targets.wheel]
|
|
65
|
+
packages = ["src/linkgnome"]
|
|
66
|
+
|
|
67
|
+
[tool.pytest.ini_options]
|
|
68
|
+
testpaths = ["tests"]
|
|
69
|
+
|
|
70
|
+
[tool.ruff]
|
|
71
|
+
target-version = "py311"
|
|
72
|
+
line-length = 88
|
|
73
|
+
|
|
74
|
+
[tool.ruff.lint]
|
|
75
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
76
|
+
ignore = ["E501"]
|
|
77
|
+
|
|
78
|
+
[tool.mypy]
|
|
79
|
+
python_version = "3.11"
|
|
80
|
+
warn_return_any = true
|
|
81
|
+
warn_unused_configs = true
|
|
82
|
+
disallow_untyped_defs = true
|
|
83
|
+
disallow_incomplete_defs = true
|
|
84
|
+
check_untyped_defs = true
|
|
85
|
+
no_implicit_optional = true
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Caching layer for fetched feed data."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from diskcache import Cache
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FeedCache:
|
|
13
|
+
"""Cache for feed data."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, cache_dir: Path | None = None, ttl_seconds: int = 600):
|
|
16
|
+
self.cache_dir = cache_dir or Path.home() / ".cache" / "linkgnome"
|
|
17
|
+
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
|
18
|
+
self.ttl_seconds = ttl_seconds
|
|
19
|
+
self._cache = Cache(str(self.cache_dir))
|
|
20
|
+
|
|
21
|
+
def get_feed(
|
|
22
|
+
self, platform: str, timeline_type: str
|
|
23
|
+
) -> list[dict[str, Any]] | None:
|
|
24
|
+
"""Get cached feed data if it hasn't expired."""
|
|
25
|
+
cache_key = f"{platform}:{timeline_type}"
|
|
26
|
+
cached = self._cache.get(cache_key)
|
|
27
|
+
if cached is None:
|
|
28
|
+
return None
|
|
29
|
+
|
|
30
|
+
data, timestamp = cached
|
|
31
|
+
if datetime.now().timestamp() - timestamp > self.ttl_seconds:
|
|
32
|
+
self._cache.delete(cache_key)
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
return data
|
|
36
|
+
|
|
37
|
+
def set_feed(
|
|
38
|
+
self,
|
|
39
|
+
platform: str,
|
|
40
|
+
timeline_type: str,
|
|
41
|
+
posts: list[dict[str, Any]],
|
|
42
|
+
) -> None:
|
|
43
|
+
"""Cache feed data."""
|
|
44
|
+
cache_key = f"{platform}:{timeline_type}"
|
|
45
|
+
self._cache.set(
|
|
46
|
+
cache_key,
|
|
47
|
+
(posts, datetime.now().timestamp()),
|
|
48
|
+
expire=self.ttl_seconds,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def clear(self) -> None:
|
|
52
|
+
"""Clear all cached data."""
|
|
53
|
+
self._cache.clear()
|
|
54
|
+
|
|
55
|
+
def close(self) -> None:
|
|
56
|
+
"""Close the cache."""
|
|
57
|
+
self._cache.close()
|