Skip to content
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

[v3] add json indentation to config #1952

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Jun 5, 2024

Level of JSON indentation is set by by the global config object.

resolves #704

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/tutorial.rst
  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@d-v-b d-v-b mentioned this pull request Jun 5, 2024
@d-v-b
Copy link
Contributor Author

d-v-b commented Jun 5, 2024

The correct tests would compare JSON documents with different levels of json_indent values, to ensure that the indentation is working correctly. If we do want those tests, I can add them, but I think I would rather defer that for a big sprint to fill out the metadata tests.

@d-v-b d-v-b requested review from normanrz and jhamman June 5, 2024 17:18
if self.zarr_format == 3:
return {ZARR_JSON: Buffer.from_bytes(json.dumps(self.to_dict()).encode())}
return {
ZARR_JSON: Buffer.from_bytes(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a Buffer.from_json method

@jhamman
Copy link
Member

jhamman commented Jun 5, 2024

I like the feature and I'm happy to see this go in. I expect the specific implementation will change a bit with #1851 but that is fine with me.

@will-moore
Copy link

Looks great, thanks. Working as expected for me. 👍

@jhamman jhamman merged commit ba6b5c0 into zarr-developers:v3 Jun 18, 2024
18 checks passed
dcherian added a commit to dcherian/zarr-python that referenced this pull request Jun 25, 2024
* v3: (22 commits)
  [v3] `Buffer` ensure correct subclass based on the `BufferPrototype` argument (zarr-developers#1974)
  Fix doc build (zarr-developers#1987)
  Fix doc build warnings (zarr-developers#1985)
  Automatically generate API reference docs (zarr-developers#1918)
  Update `RemoteStore.__str__` and add UPath tests (zarr-developers#1964)
  [v3] Elevate codec pipeline (zarr-developers#1932)
  0 dim arrays: indexing (zarr-developers#1980)
  `parse_shapelike` allows 0 (zarr-developers#1979)
  Clean up typing and docs for indexing (zarr-developers#1961)
  add json indentation to config (zarr-developers#1952)
  chore: update pre-commit hooks (zarr-developers#1973)
  Bump pypa/gh-action-pypi-publish in the actions group (zarr-developers#1969)
  chore: update pre-commit hooks (zarr-developers#1957)
  Update release.rst (zarr-developers#1960)
  doc: update release notes for 3.0.0.alpha (zarr-developers#1959)
  Basic working FsspecStore (zarr-developers#1785)
  Feature: Top level V3 API (zarr-developers#1884)
  Buffer Prototype Argument (zarr-developers#1910)
  Create issue-metrics.yml
  fixes bug in transpose (zarr-developers#1949)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compact JSON in .zarray
4 participants