Compare commits
7 commits
af19955ebf
...
f055b54198
Author | SHA1 | Date | |
---|---|---|---|
f055b54198 | |||
a94dc1d48d | |||
279004cd58 | |||
bf29c63744 | |||
c63841b6ac | |||
5adc3a0efe | |||
cf2c059352 |
5 changed files with 191 additions and 27 deletions
26
.drone.yml
26
.drone.yml
|
@ -7,8 +7,8 @@ steps:
|
|||
- name: test
|
||||
image: python:latest
|
||||
commands:
|
||||
- pip install -q --upgrade pre-commit poetry pytest pylint pydantic rich markdownify prettytable feedgen feedparser
|
||||
- pre-commit run --all-files
|
||||
- pip install -q --upgrade pre-commit poetry pytest pylint pydantic rich markdownify prettytable feedgen feedparser md2gemini readability-lxml
|
||||
# - pre-commit run --all-files
|
||||
# - flake8 --ignore=E501,W503,E265
|
||||
# - mypy --ignore-missing-imports ./tenkan/
|
||||
# - pylint --disable=E1101,E0401,C0301,W1514,C0114 ./tenkan/
|
||||
|
@ -33,21 +33,21 @@ steps:
|
|||
password:
|
||||
from_secret: docker_password
|
||||
repo: takaoni/tenkan
|
||||
tags: latest
|
||||
tags: '1.2'
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: deploy_kube
|
||||
image: takaoni/drone-kube
|
||||
settings:
|
||||
template: apps/tenkan.yaml
|
||||
namespace: gemini
|
||||
server:
|
||||
from_secret: kube_server
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
# - name: deploy_kube
|
||||
# image: takaoni/drone-kube
|
||||
# settings:
|
||||
# template: apps/tenkan.yaml
|
||||
# namespace: gemini
|
||||
# server:
|
||||
# from_secret: kube_server
|
||||
# when:
|
||||
# branch:
|
||||
# - master
|
||||
|
||||
host_aliases:
|
||||
- ip: 192.168.0.210
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -139,3 +139,5 @@ cython_debug/
|
|||
|
||||
.chglog/
|
||||
tests/data/
|
||||
|
||||
docker/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.1.0
|
||||
rev: v4.2.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
|
@ -8,7 +8,7 @@ repos:
|
|||
- id: check-added-large-files
|
||||
- id: double-quote-string-fixer
|
||||
- id: fix-encoding-pragma
|
||||
- id: no-commit-to-branch
|
||||
# - id: no-commit-to-branch
|
||||
exclude: 'data/tests/'
|
||||
- id: name-tests-test
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
|
@ -17,9 +17,9 @@ repos:
|
|||
- id: flake8
|
||||
args:
|
||||
- "--max-line-length=200"
|
||||
- "--ignore=E501"
|
||||
- "--ignore=E501,W5O3"
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.12b0
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
name: black (python)
|
||||
|
@ -27,7 +27,7 @@ repos:
|
|||
- '-S'
|
||||
- '-l 200'
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.931
|
||||
rev: v0.942
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies: [pydantic] # add if use pydantic
|
||||
|
@ -38,24 +38,24 @@ repos:
|
|||
name: isort (python)
|
||||
args: ['--profile', 'black']
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.7.1
|
||||
rev: 1.7.4
|
||||
hooks:
|
||||
- id: bandit
|
||||
exclude: ^tests/
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.31.0
|
||||
rev: v2.32.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pylint
|
||||
name: pylint
|
||||
entry: pylint --disable=E1101,E0401,C0301,W1514 --ignore=__init__.py --ignore-patterns=(.)*_test\.py,test_(.)*\.py
|
||||
language: system
|
||||
types: [python]
|
||||
- id: pytest
|
||||
name: Check pytest unit tests pass
|
||||
entry: pytest
|
||||
pass_filenames: false
|
||||
entry: pylint --disable=E1101,E0401,C0301,W1514 --ignore=__init__.py --ignore=setup.py --ignore-patterns=(.)*_test\.py,test_(.)*\.py
|
||||
language: system
|
||||
types: [python]
|
||||
# - id: pytest
|
||||
# name: Check pytest unit tests pass
|
||||
# entry: pytest
|
||||
# pass_filenames: false
|
||||
# language: system
|
||||
# types: [python]
|
||||
|
|
99
README.rst
Normal file
99
README.rst
Normal file
|
@ -0,0 +1,99 @@
|
|||
|
||||
|
||||
.. image:: https://drone.fqserv.eu/api/badges/takaoni/tenkan/status.svg
|
||||
:target: https://drone.fqserv.eu/takaoni/tenkan
|
||||
:alt: Build Status
|
||||
|
||||
|
||||
tenkan
|
||||
======
|
||||
|
||||
Command line tool to convert HTTP RSS/Atom feeds to gemini format.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
```shell script
|
||||
pip install tenkan
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Add a feed
|
||||
```shell script
|
||||
# Any valid RSS/Atom feed
|
||||
tenkan add feedname url
|
||||
|
||||
Update content of feed list
|
||||
```shell script
|
||||
tenkan update
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
||||
Delete feed
|
||||
```shell script
|
||||
tenkan delete feedname
|
||||
|
||||
List subscripted feeds
|
||||
```shell script
|
||||
tenkan list
|
||||
|
||||
.. code-block::
|
||||
|
||||
## Options
|
||||
A debug mode is avaible via --debug option.
|
||||
If you want to use your configuration or feeds file in another place than default one, you can use --config and --feedsfile options.
|
||||
|
||||
|
||||
## Configuration
|
||||
tenkan searches for a configuration file at the following location:
|
||||
|
||||
`$XDG_CONFIG_HOME/tenkan/tenkan.conf`
|
||||
|
||||
### Example config
|
||||
This can be found in tenkan.conf.example.
|
||||
|
||||
```ini
|
||||
[tenkan]
|
||||
gemini_path = /usr/local/gemini/
|
||||
gemini_url = gemini://foo.bar/feeds/
|
||||
# will purge feed folders having more than defined element count
|
||||
# purge_feed_folder_after = 100
|
||||
|
||||
[filters]
|
||||
# authors we don't want to read
|
||||
# authors_blacklist = foo, bar
|
||||
# blacklist of article titles, if provided, it won't be processed
|
||||
# titles_blacklist = foo, bar
|
||||
# blacklist of article links, if provided, it won't be processed
|
||||
# links_blacklist = foo/bar.com, bar/foo, bla
|
||||
|
||||
[formatting]
|
||||
# maximum article title size, 120 chars if not provided
|
||||
# title_size = 120
|
||||
|
||||
# feeds with a truncated content
|
||||
# will be fetched and converted using readability
|
||||
# truncated_feeds = foo, bar
|
||||
|
||||
Todolist
|
||||
--------
|
||||
|
||||
|
||||
* [ ] Add a edit command
|
||||
* [ ] Add a --feedname option to update command, to update a single feed
|
||||
* [ ] Rewrite configuration checks
|
||||
* [ ] add configuration option to log output into a logfile
|
||||
* [ ] Improve tests
|
||||
* [ ] Refactor needed parts like write_article
|
||||
* [ ] (not sure if relevant) migrate images too, for gemini clients that can handle it
|
||||
|
||||
Development
|
||||
-----------
|
||||
|
||||
I recommend using pre-commit. The pre-commit configuration I use is located in .pre-commit-config.yamlfile.
|
||||
|
||||
Run pre-commit command before every pull request and fix the warnings or errors it produces.
|
63
setup.py
Normal file
63
setup.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# DO NOT EDIT THIS FILE!
|
||||
# This file has been autogenerated by dephell <3
|
||||
# https://github.com/dephell/dephell
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
readme = ''
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
readme_path = os.path.join(here, 'README.rst')
|
||||
if os.path.exists(readme_path):
|
||||
with open(readme_path, 'rb') as stream:
|
||||
readme = stream.read().decode('utf8')
|
||||
|
||||
|
||||
setup(
|
||||
long_description=readme,
|
||||
name='tenkan',
|
||||
version='0.1.2',
|
||||
description='a',
|
||||
python_requires='==3.*,>=3.8.0',
|
||||
project_urls={'repository': 'https://git.fqserv.eu/takaoni/tenkan'},
|
||||
author='Quentin Ferrand',
|
||||
author_email='quentin.ferrand@protonmail.com',
|
||||
license='WTFPL',
|
||||
entry_points={'console_scripts': ['tenkan = tenkan.cli:main']},
|
||||
packages=['tenkan'],
|
||||
package_dir={'': '.'},
|
||||
package_data={},
|
||||
install_requires=[
|
||||
'datetime==4.*,>=4.3.0',
|
||||
'feedgen==0.*,>=0.9.0',
|
||||
'feedparser==6.*,>=6.0.8',
|
||||
'markdownify==0.*,>=0.10.0',
|
||||
'md2gemini==1.*,>=1.8.1',
|
||||
'prettytable==3.*,>=3.0.0',
|
||||
'readability-lxml==0.*,>=0.8.1',
|
||||
'requests==2.*,>=2.26.0',
|
||||
'rich==10.*,>=10.16.2',
|
||||
],
|
||||
extras_require={
|
||||
'dev': [
|
||||
'bandit==1.*,>=1.7.1',
|
||||
'black==21.*,>=21.11.0.b1',
|
||||
'flake8==4.*,>=4.0.1',
|
||||
'isort==5.*,>=5.10.1',
|
||||
'mypy==0.*,>=0.910.0',
|
||||
'pylint==2.*,>=2.12.2',
|
||||
'pytest==5.*,>=5.2.0',
|
||||
'pytest-cov==3.*,>=3.0.0',
|
||||
'pyupgrade==2.*,>=2.31.0',
|
||||
]
|
||||
},
|
||||
)
|
Loading…
Reference in a new issue