diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0b6775d..21fc3a7 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,2 +1,2 @@ [bumpversion] -current_version = 0.1.185 +current_version = 0.1.186 diff --git a/ipython/startup.py b/ipython/startup.py index c3f2418..d12c123 100644 --- a/ipython/startup.py +++ b/ipython/startup.py @@ -141,6 +141,9 @@ ) from zoneinfo import ZoneInfo +builtins.print(f"{dt.datetime.now():%Y-%m-%d %H:%M:%S}: Running `startup.py`...") # noqa: DTZ005, T201 + + _ = [ AbstractSet, Annotated, @@ -252,7 +255,6 @@ platform, poplib, pprint, - pprint, product, random, re, @@ -341,6 +343,24 @@ alt.data_transformers.enable("vegafusion") + try: + from utilities.altair import ( + plot_dataframes, + plot_intraday_dataframe, + save_chart, + save_charts_as_pdf, + vconcat_charts, + ) + except ModuleNotFoundError: + pass + else: + _ = [ + plot_dataframes, + plot_intraday_dataframe, + save_chart, + save_charts_as_pdf, + vconcat_charts, + ] try: from beartype import beartype @@ -527,20 +547,25 @@ try: import more_itertools import more_itertools as mi - from more_itertools import split_at + from more_itertools import partition, split_at except ModuleNotFoundError: pass else: - _ = [mi, more_itertools, split_at] + _ = [mi, more_itertools, partition, split_at] + try: - import utilities + from utilities.more_itertools import ( + always_iterable, + one, + partition_typeguard, + peekable, + ) except ModuleNotFoundError: from more_itertools import always_iterable, one, peekable _ = [always_iterable, one, peekable] else: - _ = utilities - + _ = [always_iterable, one, partition_typeguard, peekable] try: import numpy # noqa: ICN001 @@ -722,13 +747,18 @@ Week, ) except ModuleNotFoundError: + try: + from utilities.pandas import IndexS + except ModuleNotFoundError: + pass + else: + _ = [IndexS] try: from utilities.pickle import read_pickle except ModuleNotFoundError: pass else: _ = [read_pickle] - else: _ = [ BDay, @@ -936,7 +966,12 @@ struct, when, ] - + try: + from utilities.polars import check_polars_dataframe + except ModuleNotFoundError: + pass + else: + _ = [check_polars_dataframe] try: from pqdm.processes import pqdm @@ -955,6 +990,20 @@ _ = [pydantic, BaseModel] +try: + from pytest import fixture, mark, param # noqa: PT013 +except ModuleNotFoundError: + pass +else: + _ = [fixture, mark, param] + + try: + from utilities.pytest import throttle + except ModuleNotFoundError: + pass + else: + _ = [throttle] + try: import requests except ModuleNotFoundError: @@ -998,12 +1047,24 @@ import sqlalchemy import sqlalchemy as sqla import sqlalchemy.orm - from sqlalchemy import create_engine, func, select + from sqlalchemy import func, select except ModuleNotFoundError: pass else: - _ = [sqla, sqlalchemy, sqlalchemy.orm, create_engine, select, func] + _ = [sqla, sqlalchemy, sqlalchemy.orm, select, func] + try: + import utilities + except ModuleNotFoundError: + from utilities.sqlalchemy import ( + create_engine, + get_table, + insert_items, + insert_items_async, + ) + _ = [create_engine, get_table, insert_items, insert_items_async] + else: + _ = utilities try: import streamlit @@ -1070,6 +1131,7 @@ from utilities.pickle import read_pickle, write_pickle from utilities.re import extract_group, extract_groups from utilities.text import ensure_str + from utilities.timer import Timer from utilities.types import ( ensure_class, ensure_datetime, @@ -1093,6 +1155,7 @@ Month, SECOND, TOKYO, + Timer, US_CENTRAL, US_EASTERN, UTC, @@ -1133,40 +1196,12 @@ serialize_month, write_pickle, ] - try: - from utilities.altair import ( - plot_dataframes, - plot_intraday_dataframe, - save_chart, - save_charts_as_pdf, - vconcat_charts, - ) - except ModuleNotFoundError: - pass - else: - _ = [ - plot_dataframes, - plot_intraday_dataframe, - save_chart, - save_charts_as_pdf, - vconcat_charts, - ] try: from utilities.atomicwrites import writer except ModuleNotFoundError: pass else: _ = [writer] - try: - from utilities.more_itertools import ( - always_iterable, - partition_typeguard, - peekable, - ) - except ModuleNotFoundError: - pass - else: - _ = [always_iterable, partition_typeguard, peekable] try: from utilities.jupyter import show except ModuleNotFoundError: @@ -1174,41 +1209,38 @@ else: _ = [show] try: - from utilities.pandas import IndexS - except ModuleNotFoundError: - pass - else: - _ = [IndexS] - try: - from utilities.polars import check_polars_dataframe - except ModuleNotFoundError: - pass - else: - _ = [check_polars_dataframe] - try: - from utilities.pytest import throttle - except ModuleNotFoundError: - pass - else: - _ = [throttle] - try: - from utilities.sqlalchemy import get_table, insert_items - except ModuleNotFoundError: - pass - else: - _ = [get_table, insert_items] - try: - from utilities.sqlalchemy_polars import insert_dataframe - except ModuleNotFoundError: - pass - else: - _ = [insert_dataframe] - try: - from utilities.timer import Timer + from utilities.sqlalchemy_polars import ( + insert_dataframe, + insert_dataframe_async, + select_to_dataframe, + select_to_dataframe_async, + ) except ModuleNotFoundError: pass else: - _ = [Timer] + _ = [ + insert_dataframe, + insert_dataframe_async, + select_to_dataframe, + select_to_dataframe_async, + ] + + +try: + import xarray + from xarray import DataArray, Dataset +except ModuleNotFoundError: + pass +else: + _ = [xarray, DataArray, Dataset] + + +try: + from whenever import Date, DateTimeDelta, LocalDateTime, Time, ZonedDateTime +except ModuleNotFoundError: + pass +else: + _ = [Date, DateTimeDelta, LocalDateTime, Time, ZonedDateTime] try: from utilities.whenever import ( ensure_date, @@ -1248,15 +1280,6 @@ serialize_zoned_datetime, ] -try: - import xarray - from xarray import DataArray, Dataset -except ModuleNotFoundError: - pass -else: - _ = [xarray, DataArray, Dataset] - - # functions diff --git a/jupyter/docmanager/plugin.jsonc b/jupyter/docmanager/plugin.jsonc index 2916deb..70aa0c4 100644 --- a/jupyter/docmanager/plugin.jsonc +++ b/jupyter/docmanager/plugin.jsonc @@ -1,6 +1,4 @@ { - // Document Manager - // @jupyterlab/docmanager-extension:plugin - // Document Manager settings. - // *************************************** + "autosave": false, + "autosaveInterval": 120, } diff --git a/jupyter/filebrowser/browser.jsonc b/jupyter/filebrowser/browser.jsonc index b21c371..fb9ed5b 100644 --- a/jupyter/filebrowser/browser.jsonc +++ b/jupyter/filebrowser/browser.jsonc @@ -1,11 +1,42 @@ { + // File Browser + // @jupyterlab/filebrowser-extension:browser + // File Browser settings. + // ***************************************** + + // Filter folders + // Whether to apply the search on folders "filterDirectories": true, + + // Navigate to current folder + // Whether to automatically navigate to a document's current folder "navigateToCurrentDirectory": true, + + // Use checkboxes to select items + // Whether to show checkboxes next to files and folders "showFileCheckboxes": false, + + // Show file size column + // Whether to show the file size column "showFileSizeColumn": false, + + // Show full path in browser bread crumbs + // Whether to show full path in browser bread crumbs "showFullPath": false, + + // Show hidden files + // Whether to show hidden files. The server parameter `ContentsManager.allow_hidden` must be set to `True` to display hidden files. "showHiddenFiles": true, - "showLastModifiedColumn": false, + + // Show last modified column + // Whether to show the last modified column + "showLastModifiedColumn": true, + + // When sorting by name, group notebooks before other files + // Whether to group the notebooks away from files "sortNotebooksFirst": true, + + // Filter on file name with a fuzzy search + // Whether to apply fuzzy algorithm while filtering on file names "useFuzzyFilter": true, } diff --git a/nvim/lua/snippets.lua b/nvim/lua/snippets.lua index 9588072..91b5bde 100644 --- a/nvim/lua/snippets.lua +++ b/nvim/lua/snippets.lua @@ -78,8 +78,10 @@ ls.add_snippets("python", { -- hypothesis s("hy-assume", { t({ "from hypothesis import assume", "" }) }), s("hy-booleans", { t({ "from hypothesis.strategies import booleans", "" }) }), + s("hy-composite", { t({ "from hypothesis.strategies import composite", "" }) }), s("hy-data", { t({ "from hypothesis.strategies import data, DataObject", "" }) }), s("hy-dates", { t({ "from hypothesis.strategies import dates", "" }) }), + s("hy-datetimes", { t({ "from hypothesis.strategies import datetimes", "" }) }), s("hy-given", { t({ "from hypothesis import given", "" }) }), s("hy-integers", { t({ "from hypothesis.strategies import integers", "" }) }), s("hy-invalid-argument", { t({ "from hypothesis.errors import InvalidArgument", "" }) }), @@ -87,8 +89,10 @@ ls.add_snippets("python", { s("hy-reproduce-failure", { t({ "from hypothesis import reproduce_failure", "" }) }), s("hy-sampled-from", { t({ "from hypothesis.strategies import sampled_from", "" }) }), s("hy-settings", { t({ "from hypothesis import settings", "" }) }), - s("settings-max-examples", { t({ "@settings(max_examples=1)", "" }) }), + s("hy-tuples", { t({ "from hypothesis.strategies import tuples", "" }) }), + s("settings-filter-too-much", { t({ "@settings(suppress_health_check={HealthCheck.filter_too_much})", "" }) }), s("settings-generate-only", { t({ "@settings(phases={Phase.generate})", "" }) }), + s("settings-max-examples", { t({ "@settings(max_examples=1)", "" }) }), -- itertools s("it-accumulate", { t({ "from itertools import accumulate", "" }) }), @@ -178,6 +182,9 @@ ls.add_snippets("python", { -- re s("re-search", { t({ "from re import search", "" }) }), + -- redis + s("re-redis", { t({ "from redis import Redis", "" }) }), + -- rich s("ri-print", { t({ "from rich import print", "" }), t({ "" }), t({ "print(" }), i(1, "Values"), t({ ")", "" }) }), diff --git a/nvim/lua/user_commands.lua b/nvim/lua/user_commands.lua index b752a88..643b709 100644 --- a/nvim/lua/user_commands.lua +++ b/nvim/lua/user_commands.lua @@ -23,7 +23,12 @@ end CreateInsertCodeUserCommand( "HypothesisSettingsFilterTooMuch", { "from hypothesis import HealthCheck, settings" }, - "@settings(suppress_health_check=[HealthCheck.filter_too_much])" + "@settings(suppress_health_check={HealthCheck.filter_too_much})" +) +CreateInsertCodeUserCommand( + "HypothesisSettingsGenerateOnly", + { "from hypothesis import Phase, settings" }, + "@settings(phases={Phase.generate})" ) CreateInsertCodeUserCommand( "HypothesisSettingsMaxExamples", diff --git a/shell/common.sh b/shell/common.sh index dac8e15..dbf9d21 100644 --- a/shell/common.sh +++ b/shell/common.sh @@ -152,7 +152,7 @@ fi pi() { pip install "$@"; } pie() { pi --editable .; } pii() { pi ipython; } -pij() { pi jupyterlab jupyterlab-vim; } +pij() { pi jupyterlab jupyterlab-code-formatter; } plo() { pip list --outdated; } pui() { pip uninstall "$@"; }