TODO:
- add
add_hours_strict(fail if wrap) andadd_hours_maybe(return None if wrap) - add
minutes|seconds_elapsedandminutes|seconds_remainingproperties?
Running this project requires copier, git, uv, and flake. Install nix and
install the others by running nix-shell -p uv python3 git. You can now copy the project and run the toy CLI provided out-of-the-box:
copier copy --trust \
/home/isaac/repos/dev-envs/python-uv-nix /tmp/hello-world \
--data-file /home/isaac/repos/dev-envs/python-uv-nix/example-data-uv.yml
nix run /tmp/hello-worldYou can also enter a development environment with all dependencies installed:
nix developOnce in this dev shell, you have a number of development utils you can try out (via just):
✔just
✔just format
✔just check
✔just fix
✔just typecheck
✔just lint
✔just deal
✔just vulture
✔just pydeps-full
✔just pydeps
✔just pydeps-simple
✔just view-deps
✔just snakefood
✔just deply
✔just bandit
✔just bandit-html
✔just bandit-view
✔just pyflame
✔just flamegraph
✔just perf-flamegraph
✔just check-structure
✔just check-imports
✔just smoke
✔just unit
✔just test
✔just test-cov
☐ just docs
✔just scalene
✔just view-cov
☐ just view-docs
✔just view-flamegraphs
✔just sbom
lefthook validate
lefthook run allAdd FilteredRange types (separate because they will behave differently)
Modify check_structure script to add inherited methods to subclasses (especially important for abstract classes)
-
✔ Sync package lists in uv.nix.jinja and README.md
-
✔ Parametrize each package for copier and update copier.yml
-
✔ Clean up copier.yml and example-data.yml
-
✔ Get impure environment working -> draw from buildFHSUserEnv approach in consilium and other projects
-
✔ Write working version of scripts and test them on datethyme
-
✔ create reference project (revised from datethyme)
-
✔ use copier to re-create it (make a datethyme answers file)
-
✔ find good CLI tools for diffing an entire folder
-
✔ iteratively modify template until copier perfectly re-creates the reference project
-
✔ package mdformat with mdformat-mkdocs (via nix)
-
✔ remove super-linter, but look over it and steal any good ideas
-
✔ add commitizen and commitmsgfmt ✔
-
✔ Modify nix to support any python version via nixpkgs-python and tox
-
✔ Read through jinja2-ansible-filters
-
Go through https://www.youtube.com/results?search_query=nix+and+python and any relevant NixCon talks
-
✔ restructure nix code
-
✔ add poetry support (selectable via copier)
-
re-make datethyme package using template, iteratively polishing the template
-
add copier switch to include a CLI or not
Note: first get working the way it is for datathyme.
-
Package all docs packages via nix, since they run independently of the other Python packages.
-
Do the same for testing dependencies, if possible.
-
Add different types of git hooks
-
Client-Side Hooks
-
Pre-commit hooks run before a commit is created and are ideal for code quality checks. They're perfect for running linters, formatters, static analysis tools, or tests to catch issues before they enter the repository. If the hook exits with a non-zero status, the commit is aborted
-
Prepare-commit-msg hooks execute after the default commit message is created but before the editor opens. These work well for automatically adding ticket numbers, branch names, or standardized formatting to commit messages based on branch patterns or other context
-
Commit-msg hooks run after you've written your commit message and are excellent for enforcing commit message conventions. They can validate that messages follow specific formats, contain required information like issue references, or meet length requirements
-
Post-commit hooks trigger after a commit completes successfully. Since they can't affect the commit outcome, they're useful for notifications, triggering builds, updating external systems, or logging commit information
-
Pre-rebase hooks run before rebasing and help prevent rebasing published commits or branches that shouldn't be rebased. They're particularly valuable for protecting main branches or enforcing workflow policies
-
Post-checkout and post-merge hooks execute after checking out branches or completing merges. These are ideal for environment setup tasks like updating dependencies, clearing caches, generating files, or syncing external resources that depend on the current branch state
-
-
Server-Side Hooks
-
Pre-receive hooks run before any references are updated when receiving a push. They're powerful for enforcing repository-wide policies like preventing force pushes to protected branches, validating that all commits meet standards, or checking permissions before allowing updates
-
Update hooks execute once per branch being updated and are perfect for branch-specific policies. They can enforce different rules for different branches, validate individual commits, or check that updates follow branching strategies
-
Post-receive hooks run after all references are successfully updated and are ideal for deployment triggers, sending notifications, updating issue trackers, or kicking off CI/CD pipelines. Since they run after the push succeeds, they're commonly used for automation that depends on the repository being in its new state
-
TODO: look at jj-fzf, lazyjj, gg-jj look at luxuries
-
dependency resolution (should already be installed)
- uv ✔
-
miscellaneous (semver via Python)
- semver ✔
-
task running / hooks (installable via Python or Nix; Nix preferred)
-
interactive programming (installable via Python or Nix; Nix preferred)
- ipython ✔
-
static type checking (installable via Python or Nix; Nix preferred)
-
source code visualization (graphviz and pydeps via Nix, the rest via Python)
- pydeps ✔
- graphviz ✔
- deply ✔
- snakefood3 ✔
- grimp ✔
-
performance profiling (flamegraph and scalene via Nix, pyflame via Python)
- pyflame ✔
- scalene ✔
- flamegraph-rs (cargo-flamegraph in nix) ✔
-
software supply chain, security (installable via Python, but Nix preferred)
-
testing (installed via Python for now)
-
docs (installed via Python for now)
-
formatters / linters
- installable via Python or Nix:
- ruff ✔
- mdformat + mdformat-mkdocs TODO
- yamlfmt OR yamllint ✔
- pyprojectsort
- toml-sort ✔
- installable only via Nix or other package manager:
- treefmt + treefmt-nix ✔
- alejandra ✔
- super-linter TODO
- markdown-code-runner OR mdsf ✔
- markdownlint-cli2 OR markdownlint-cli TODO
- just-formatter ✔
- installable via Python or Nix:
A savory approach to date and time, built on Pydantic and datetime, with an emphasis on input validation and date/time arithmetic.
-
review which dunder methods to use for what - init - repr - str - bool - eq - ne - hash - lt - gt - le - ge - - int - float - bytes - complex - format - enter - exit - - add + : - sub - : - mul * : - truediv / : - mod % : - floordiv // : - pow: ** : range creation - matmul @ : - - radd - rsub - rmul - rtruediv - rmod - rfloordiv - rpow - rmatmul - - and: composite from elementary - or | : composite span creation? - xor ^ : inverse composite span (complement) creation? - rshift >> : span creation - lshift << : reverse span creation? - rand
- ror - rxor - rrshift - rlshift - - neg - pos - invert - - iadd - isub - imul - itruediv /= : - imod %= : - ifloordiv //= : - ipow **= : - imatmul @= : - iand &= : - ior |= : - ixor ^= : - irshift >>= : - ilshift <<= : - - divmod - rdivmod - abs - index - round - trunc - floor - ceil - - getattr - getattribute - setattr - delattr - dir - - prepare - instancecheck - subclasscheck - init_subclass - subclasses - mro_entries - class_getitem - - set_name - get - set - delete - - buffer - release_buffer - - new - del - - aenter - aexit - aiter - anext - await - - -
add round_hour(), round_minute(), etc.
-
add support for conditional ranges (and maybe spans), for example DateRange(..., filter=lambda wd: wd < 6)
-
add support for composite spans and ranges (union as opposed to hull)
-
localization: add DateStrings class with defaults for popular languages and possibility to pass custom strings -> DateStrings.lookup("mon", 4), DateStrings.get_with_fallback(), DateStrings.format(date: Date)
-
add
stdlibandtupleandnamedtupleanddictproperties? -
add iter() and items()?
-
add add_hours, add_minutes, add_seconds to Time
-
add TimeDelta object?
-
rename span to interval
-
remove DateRange in favor of DateRange: 'range' for discrete sequences, 'span' (or 'interval'?) for uncountable intervals
-
rewrite using class Time(_Time), etc. to avoid mypy 'method-assign' error -> get rid of _interactions.py (use inheritance instead of monkey-patching; measure performance)
-
[ ]
---------------------------------------------------------
| | Date | Time | DateTime |
|----------|--------------|--------------|--------------|
| Date | DateRange | ND | DateTimeSpan |
| Time | ND | TimeSpan | ND |
| DateTime | DateTimeSpan | DateTimeSpan | DateTimeSpan |
---------------------------------------------------------
---------------------------------------------------------
| | Date | Time | DateTime |
|----------|--------------|--------------|--------------|
| Date | ND | DateTime | ND |
| Time | DateTime | ND | ND |
| DateTime | ND | ND | ND |
---------------------------------------------------------
--------------------------------------------------------------
| | DateRange | TimeSpan | DateTimeSpan |
|---------------|--------------|--------------|--------------|
| DateRange | DateRange | ND | ND |
| TimeSpan | ND | TimeSpan | ND |
| DateTimeSpan | ND | ND | DateTimeSpan |
--------------------------------------------------------------
Date ** Date -> DateRange Time ** Time -> TimeSpan DateTime ** DateTime -> DateTimeSpan
Date ** Time -> ND
Create sister package thymeline