- distributes tests alongside the package, might be convenient for package users
- removes some weird indirection (e.g. dummy test files improting tests from modules)
- makes the command line for tests cleaner (e.g. no need to remember to manually add files to tox.ini)
- tests automatically covered by mypy (so makes mypy runs cleaner and ultimately better coverage)
The (vague) convention is
- tests/somemodule.py -- testing my.core.somemodule, contains tests directly re
- tests/test_something.py -- testing a specific feature, e.g. test_get_files.py tests get_files methon only
see https://github.com/karlicoss/HPI/issues/262
* move home to fallback/via_home.py
* move via_ip to fallback
* add fallback model
* add stub via_ip file
* add fallback_locations for via_ip
* use protocol for locations
* estimate_from helper, via_home estimator, all.py
* via_home: add accuracy, cache history
* add datasources to gpslogger/google_takeout
* tz/via_location.py: update import to fallback
* denylist docs/installation instructions
* tz.via_location: let user customize cachew refresh time
* add via_ip.estimate_location using binary search
* use estimate_location in via_home.get_location
* tests: add gpslogger to location config stub
* tests: install tz related libs in test env
* tz: add regression test for broken windows dates
* vendorize bisect_left from python src
doesnt have a 'key' parameter till python3.10
- get rid of unnecessary globs in get_files (they should be in config if the user wishes)
- get rid of some old kython imports
- do not convert Path twice in foursquare (so CPath works correctly)
- use portable separators
- paths should be prepended with r' (so backwards slash isn't treated as escaping)
- sqlite connections should be closed (otherwise windows fails to remove the underlying db file)
- workaround for emojis via PYTHONUTF8=1 test for now
- make ZipPath portable
- properly use tox python environment everywhere
this was causing issues on Windows
e.g.
WARNING: test command found but not installed in testenv
cmd: C:\hostedtoolcache\windows\Python\3.9.12\x64\python3.EXE
- fallback on the old logic if google_takeout_parser isn't available
- move to my.youtube.takeout (possibly mixing in other sources later)
- keep my.media.youtube, but issue deprecation warning
currently used in orger etc, so doesn't hurt to keep
- also fixes https://github.com/karlicoss/HPI/issues/113
* core: add ZipPath encapsulating compressed zip files
this way you don't have to unpack it first and can work as if it's a 'virtual' directory
related: https://github.com/karlicoss/HPI/issues/20
prior to this change it would error with
@dataclass
> class pushshift_config(uconfig.pushshift):
E AttributeError: type object 'test_config' has no attribute 'pushshift'
* initial pushshift/rexport merge implementation, using id for merging
* smarter module deprecation warning using regex
* add `RedditBase` from promnesia
* `import_source` helper for gracefully handing mixin data sources
* my.core.serialize: simplejson support, more types
I added a couple extra checks to the default function,
serializing datetime, dates and dataclasses (incase
orjson isn't installed)
(copied from below)
if orjson couldn't be imported, try simplejson
This is included for compatibility reasons because orjson
is rust-based and compiling on rarer architectures may not work
out of the box
as an example, I've been having issues getting it to install
on my phone (termux/android)
unlike the builtin JSON modue which serializes NamedTuples as lists
(even if you provide a default function), simplejson correctly
serializes namedtuples to dictionaries
this just gives another option to people, simplejson is pure python
so no one should have issues with that. orjson is still way faster,
so still preferable if its easy and theres a precompiled build
for your architecture (which there typically is)
If you're ever running this with simplejson installed and not orjson,
its pretty easy to tell as the JSON styling is different; orjson has
no spaces between tokens, simplejson puts spaces between tokens. e.g.
simplejson: {"a": 5, "b": 10}
orjson: {"a":5,"b":10}
- restructure query code for cli, some test fixes
- initial query_range implementation
refactored functions in query some more
to allow re-use in range_range, select()
pretty much just calls out to a bunch
of handlers now
everything is backwards-compatible with the previous
interface, the only minor changes were to the doctor cmd
which can now accept more than one item to run,
and the --skip-config-check to skip the config_ok
check if the user specifies to
added a test using click.testing.CliRunner (tests
the CLI in an isolated environment), though
additional tests which aren't testing the CLI
itself (parsing arguments or decorator behaviour)
can just call the functions themselves, as they
no longer accept a argparser.Namespace and instead
accept the direct arguments
- modernize:
- add REQUIRES spec for pdfannots library
- config dataclass/config stub
- stats function
- absolute my.core imports in anticipation of splitting core
- use 'paths' instead of 'roots' (better reflects the semantics), use get_files
backward compatible via config migration
- properly run tests/mypy
this fixes two distinct mypy errors
one where NamedTuple/dataclassees can't be
defined locally
https://github.com/python/mypy/issues/7281
which happens when you run mypy like
mypy -p my.core on warm cache
the second error is the core/types.py file shadowing the
stdlib types module
addresses https://github.com/karlicoss/HPI/issues/103
for now via experimental time.tz.force_abbreviations config variable
not sure if this whole things is doomed to be resolved properly
- rely on appdirs for default cache path instead of hardcoded /var/tmp/cachew
technically backwards incompatible, but no action needed
you might want to clean /var/tmp/cachew after updating
- use default cache path (e.g. ~/.cache) by default
see https://github.com/ActiveState/appdirs#some-example-output for more info
*warning*: things will be cached by default now (used to be uncached before)
- treat cache_dir = None in the config
*warning*: kind of backwards incompatible.. but again nothing disasterous