-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(RFC): Adds altair.datasets
#3631
Draft
dangotbanned
wants to merge
202
commits into
main
Choose a base branch
from
vega-datasets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Allow quickly switching between version tags #3150 (comment)
Not required for these requests, but may be helpful to avoid limits
As an example, for comparing against the most recent I've added the 5 most recent
- Basic mechanism for discovering new versions - Tries to minimise number of and total size of requests
Experimenting with querying the url cache w/ expressions
- `metadata_full.parquet` stores **all known** file metadata - `GitHub.refresh()` to maintain integrity in a safe manner - Roughly 3000 rows - Single release: **9kb** vs 46 releases: **21kb**
- Still undecided exactly how this functionality should work - Need to resolve `npm` tags != `gh` tags issue as well
Mainly removing `Fl` prefix, as there is no confusion now `models.py` is purely `frictionless` structures
Caching is the more sensible default when considering a notebook environment Using a standardised path now also https://specifications.freedesktop.org/basedir-spec/latest/#variables
Now that only a single version is supported, it is possible to mitigate the `pandas` case w/o `.parquet` support (#3631 (comment)) This commit adds the file and some tools needed to implement this - but I'll need to follow up with some more changes to integrate this into `_Reader`
- Made paths a `ClassVar` - Removed unused `SchemaCache` methods - Replace `_FIELD_TO_DTYPE` w/ `_DTYPE_TO_FIELD` - Only one variant is ever used Use a `SchemaCache` instance per-`pandas`-based reader - Make fallback `csv_cache` initialization lazy - Only going to use the global when no dependencies found - Otherwise, instance-per-reader
- Readable via url w/ `vegafusion` installed - Currently no cases where a dataset has both `.parquet` and another extension
Most subsequent changes are operating on this `TypedDict` directly, as it provides richer info for error handling
- Adds `_exceptions.py` with some initial cases - Renaming `result` -> `meta` - Reduced the complexity of `_PyArrowReader` - Generally, trying to avoid exceptions from 3rd parties - to allow suggesting an alternate path that may work
This was referenced Jan 17, 2025
- Using `load` instead of `data` - Don't mention multi-versions, as that was dropped
- `Application.generate_typing` now mostly populated by `DataPackage` methods - Docs are defined alongside expressions - Factored out repetitive code into `spell_literal_alias` - `Metadata` examples table is now generated inside the doc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related
Status
Waiting on the next
vega-datasets
release.Once there is a stable
datapackage.json
available - there is quite a lot oftools/datasets
that can be simplified/removed.3.0.0
Release vega-datasets#654Description
Providing a minimal, but up-to-date source for https://github.com/vega/vega-datasets.
This PR takes a different approach to that of https://github.com/altair-viz/vega_datasets, notably:
metadata.parquet
npm
andgithub
pandas
"polars"
backend, the slowest I've had on a cache-hit is 0.1s to loadExamples
These all come from the docstrings of:
Loader
Loader.from_backend
Loader.__call__
Tasks
altair.datasets
Loader.__call__
_readers._Reader
_typing.Metadata
(Align with revised descriptions from (c572180))tools.datasets
Application
models.py
github.py
npm.py
semver.py
_PyArrowReader
JSON limitation (3fbc759), (4f5b4de)Resolved
Investigate bundling metadata
npm
does not have every version availableGitHub
npm
github
, but during testing this was much slowernpm
Plan strategy for user-configurable dataset cache
altair
, each release would simply ship with changes baked inaltair
package size with datasetsaltair
versionsALTAIR_DATASETS_DIR
Deferred
Reducing cache footprint
.(csv|tsv|json)
files as.parquet
Investigate providing a decorator to add a backend
_name: LiteralString
_read_fn: dict[Extension, Callable[..., IntoDataFrameT]]
_scan_fn: dict[_ExtensionScan, Callable[..., IntoFrameT]]
Provide more meaningful info on the state of
ALTAIR_DATASETS_DIR
sha
cover?nw.Expr.(first|last)
nw.Expr.(head|tail)(1)
not equivalent in agroup_by().agg(...)
contextpandas
-> scalarpolars
-> listpl.Enum
translating to non-orderedpd.Categorical
polars
-native solution