core: drop py36 support, update docs for reddit (#193)
* docs: update references to my.reddit * ci: remove 3.6, add 3.9
This commit is contained in:
parent
be21606075
commit
3f4fb64d56
7 changed files with 18 additions and 21 deletions
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
|
@ -19,9 +19,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ubuntu-latest, macos-latest] # TODO windows-latest??
|
platform: [ubuntu-latest, macos-latest] # TODO windows-latest??
|
||||||
python-version: [3.6, 3.7, 3.8]
|
python-version: [3.7, 3.8, 3.9]
|
||||||
# seems like 3.6 isn't available on their osx image anymore
|
|
||||||
exclude: [{platform: macos-latest, python-version: 3.6}]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ for cls, p in modules:
|
||||||
# paths[s]/glob to the exported JSON data
|
# paths[s]/glob to the exported JSON data
|
||||||
export_path: Paths
|
export_path: Paths
|
||||||
#+end_src
|
#+end_src
|
||||||
** [[file:../my/reddit.py][my.reddit]]
|
** [[file:../my/reddit][my.reddit]]
|
||||||
|
|
||||||
Reddit data: saved items/comments/upvotes/etc.
|
Reddit data: saved items/comments/upvotes/etc.
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ You'd be really helping me, I want to make the setup as straightforward as possi
|
||||||
* Few notes
|
* Few notes
|
||||||
I understand that people who'd like to use this may not be super familiar with Python, pip or generally unix, so here are some useful notes:
|
I understand that people who'd like to use this may not be super familiar with Python, pip or generally unix, so here are some useful notes:
|
||||||
|
|
||||||
- only ~python >= 3.6~ is supported
|
- only ~python >= 3.7~ is supported
|
||||||
- I'm using ~pip3~ command, but on your system you might only have ~pip~.
|
- I'm using ~pip3~ command, but on your system you might only have ~pip~.
|
||||||
|
|
||||||
If your ~pip --version~ says python 3, feel free to use ~pip~.
|
If your ~pip --version~ says python 3, feel free to use ~pip~.
|
||||||
|
|
|
@ -105,7 +105,7 @@ def config_create() -> None:
|
||||||
# hpi config check
|
# hpi config check
|
||||||
|
|
||||||
# to quickly check a specific module setup, run hpi doctor <module>, e.g.:
|
# to quickly check a specific module setup, run hpi doctor <module>, e.g.:
|
||||||
# hpi doctor my.reddit
|
# hpi doctor my.reddit.rexport
|
||||||
|
|
||||||
### useful default imports
|
### useful default imports
|
||||||
from my.core import Paths, PathIsh, get_files
|
from my.core import Paths, PathIsh, get_files
|
||||||
|
@ -515,7 +515,7 @@ def doctor_cmd(verbose: bool, list_all: bool, quick: bool, skip_conf: bool, modu
|
||||||
'''
|
'''
|
||||||
Run various checks
|
Run various checks
|
||||||
|
|
||||||
MODULE is one or more specific module names to check (e.g. my.reddit)
|
MODULE is one or more specific module names to check (e.g. my.reddit.rexport)
|
||||||
Otherwise, checks all modules
|
Otherwise, checks all modules
|
||||||
'''
|
'''
|
||||||
if not skip_conf:
|
if not skip_conf:
|
||||||
|
@ -562,7 +562,7 @@ def module_requires_cmd(module: str) -> None:
|
||||||
'''
|
'''
|
||||||
Print MODULE requirements
|
Print MODULE requirements
|
||||||
|
|
||||||
MODULE is a specific module name (e.g. my.reddit)
|
MODULE is a specific module name (e.g. my.reddit.rexport)
|
||||||
'''
|
'''
|
||||||
module_requires(module=module)
|
module_requires(module=module)
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ def module_install_cmd(user: bool, module: str) -> None:
|
||||||
'''
|
'''
|
||||||
Install dependencies for a module using pip
|
Install dependencies for a module using pip
|
||||||
|
|
||||||
MODULE is a specific module name (e.g. my.reddit)
|
MODULE is a specific module name (e.g. my.reddit.rexport)
|
||||||
'''
|
'''
|
||||||
# todo could add functions to check specific module etc..
|
# todo could add functions to check specific module etc..
|
||||||
module_install(user=user, module=module)
|
module_install(user=user, module=module)
|
||||||
|
@ -676,13 +676,13 @@ def query_cmd(
|
||||||
As an example, to query reddit comments I've made in the last month
|
As an example, to query reddit comments I've made in the last month
|
||||||
|
|
||||||
\b
|
\b
|
||||||
hpi query --order-type datetime --before now --within 4w my.reddit.comments
|
hpi query --order-type datetime --before now --within 4w my.reddit.all.comments
|
||||||
or...
|
or...
|
||||||
hpi query --recent 4w my.reddit.comments
|
hpi query --recent 4w my.reddit.all.comments
|
||||||
|
|
||||||
\b
|
\b
|
||||||
Can also query within a range. To filter comments between 2016 and 2018:
|
Can also query within a range. To filter comments between 2016 and 2018:
|
||||||
hpi query --order-type datetime --after '2016-01-01 00:00:00' --before '2019-01-01 00:00:00' my.reddit.comments
|
hpi query --order-type datetime --after '2016-01-01 00:00:00' --before '2019-01-01 00:00:00' my.reddit.all.comments
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
|
|
|
@ -607,7 +607,10 @@ class DummyExecutor(Executor):
|
||||||
self._shutdown = False
|
self._shutdown = False
|
||||||
self._max_workers = max_workers
|
self._max_workers = max_workers
|
||||||
|
|
||||||
def submit(self, fn, *args, **kwargs) -> Future:
|
# TODO: once support for 3.7 is dropped,
|
||||||
|
# can make 'fn' a positional only parameter,
|
||||||
|
# which fixes the mypy error this throws without the type: ignore
|
||||||
|
def submit(self, fn, *args, **kwargs) -> Future: # type: ignore[override]
|
||||||
if self._shutdown:
|
if self._shutdown:
|
||||||
raise RuntimeError('cannot schedule new futures after shutdown')
|
raise RuntimeError('cannot schedule new futures after shutdown')
|
||||||
|
|
||||||
|
@ -623,5 +626,5 @@ class DummyExecutor(Executor):
|
||||||
|
|
||||||
return f
|
return f
|
||||||
|
|
||||||
def shutdown(self, wait: bool=True) -> None:
|
def shutdown(self, wait: bool=True) -> None: # type: ignore[override]
|
||||||
self._shutdown = True
|
self._shutdown = True
|
||||||
|
|
|
@ -66,10 +66,10 @@ def locate_function(module_name: str, function_name: str) -> Callable[[], Iterab
|
||||||
|
|
||||||
def locate_qualified_function(qualified_name: str) -> Callable[[], Iterable[ET]]:
|
def locate_qualified_function(qualified_name: str) -> Callable[[], Iterable[ET]]:
|
||||||
"""
|
"""
|
||||||
As an example, 'my.reddit.comments' -> locate_function('my.reddit', 'comments')
|
As an example, 'my.reddit.rexport.comments' -> locate_function('my.reddit.rexport', 'comments')
|
||||||
"""
|
"""
|
||||||
if "." not in qualified_name:
|
if "." not in qualified_name:
|
||||||
raise QueryException("Could not find a '.' in the function name, e.g. my.reddit.comments")
|
raise QueryException("Could not find a '.' in the function name, e.g. my.reddit.rexport.comments")
|
||||||
rdot_index = qualified_name.rindex(".")
|
rdot_index = qualified_name.rindex(".")
|
||||||
return locate_function(qualified_name[:rdot_index], qualified_name[rdot_index + 1:])
|
return locate_function(qualified_name[:rdot_index], qualified_name[rdot_index + 1:])
|
||||||
|
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -42,7 +42,7 @@ def main():
|
||||||
author_email='karlicoss@gmail.com',
|
author_email='karlicoss@gmail.com',
|
||||||
description='A Python interface to my life',
|
description='A Python interface to my life',
|
||||||
|
|
||||||
python_requires='>=3.6',
|
python_requires='>=3.7',
|
||||||
install_requires=INSTALL_REQUIRES,
|
install_requires=INSTALL_REQUIRES,
|
||||||
extras_require={
|
extras_require={
|
||||||
'testing': [
|
'testing': [
|
||||||
|
@ -60,10 +60,6 @@ def main():
|
||||||
'cachew>=0.8.0',
|
'cachew>=0.8.0',
|
||||||
'mypy', # used for config checks
|
'mypy', # used for config checks
|
||||||
],
|
],
|
||||||
':python_version<"3.7"': [
|
|
||||||
# used for some modules... hopefully reasonable to have it as a default
|
|
||||||
'dataclasses',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
entry_points={'console_scripts': ['hpi=my.core.__main__:main']},
|
entry_points={'console_scripts': ['hpi=my.core.__main__:main']},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue