json-store 4.4__tar.gz → 4.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,11 @@
1
1
  # cache
2
2
  *.pyc
3
+ .*_cache
3
4
  .cache
4
5
  __pycache__
5
6
 
6
7
  # dev/test
8
+ .envrc
7
9
  .venv*
8
10
  .python-version
9
11
  .tox
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2025 Jeremy Avnet
1
+ Copyright (c) 2010-2026 Jeremy Avnet
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -1,13 +1,13 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: json-store
3
- Version: 4.4
3
+ Version: 4.6
4
4
  Summary: A shelve-like store using JSON serialization.
5
5
  Project-URL: Homepage, https://github.com/brainsik/json-store
6
6
  Project-URL: Repository, https://github.com/brainsik/json-store.git
7
7
  Project-URL: Issues, https://github.com/brainsik/json-store/issues
8
8
  Project-URL: Changelog, https://github.com/brainsik/json-store/releases
9
9
  Author-email: jeremy avnet <json-store@theory.org>
10
- License: Copyright (c) 2010-2025 Jeremy Avnet
10
+ License: Copyright (c) 2010-2026 Jeremy Avnet
11
11
 
12
12
  Permission is hereby granted, free of charge, to any person obtaining a copy
13
13
  of this software and associated documentation files (the "Software"), to deal
@@ -33,28 +33,28 @@ Classifier: Intended Audience :: Developers
33
33
  Classifier: License :: OSI Approved :: MIT License
34
34
  Classifier: Operating System :: OS Independent
35
35
  Classifier: Programming Language :: Python :: 3
36
- Classifier: Programming Language :: Python :: 3.10
37
36
  Classifier: Programming Language :: Python :: 3.11
38
37
  Classifier: Programming Language :: Python :: 3.12
39
38
  Classifier: Programming Language :: Python :: 3.13
40
39
  Classifier: Programming Language :: Python :: 3.14
40
+ Classifier: Programming Language :: Python :: 3.15
41
41
  Classifier: Programming Language :: Python :: Implementation :: CPython
42
42
  Classifier: Programming Language :: Python :: Implementation :: PyPy
43
43
  Classifier: Topic :: Software Development :: Libraries
44
- Requires-Python: >=3.10
44
+ Requires-Python: >=3.11
45
45
  Description-Content-Type: text/markdown
46
46
 
47
- # JSON Store
47
+ # json-store
48
48
 
49
49
  [![json-store](https://github.com/brainsik/json-store/actions/workflows/main.yml/badge.svg)](https://github.com/brainsik/json-store/actions/workflows/main.yml)
50
50
  ![PyPI](https://img.shields.io/pypi/v/json-store)
51
51
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/json-store)
52
52
 
53
- JSON store is a simple replacement for shelve. It writes JSON serialized files,
53
+ **json-store** is a simple replacement for shelve. It writes JSON serialized files,
54
54
  accepts unicode keys, and tracks whether the store has been changed since last
55
55
  sync. It has no dependencies.
56
56
 
57
- JSON store is intended for smaller stores. Everything is kept in memory and
57
+ json-store is intended for smaller stores. Everything is kept in memory and
58
58
  `sync()` writes the whole store to disk.
59
59
 
60
60
  For issues and development, see:
@@ -1,14 +1,14 @@
1
- # JSON Store
1
+ # json-store
2
2
 
3
3
  [![json-store](https://github.com/brainsik/json-store/actions/workflows/main.yml/badge.svg)](https://github.com/brainsik/json-store/actions/workflows/main.yml)
4
4
  ![PyPI](https://img.shields.io/pypi/v/json-store)
5
5
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/json-store)
6
6
 
7
- JSON store is a simple replacement for shelve. It writes JSON serialized files,
7
+ **json-store** is a simple replacement for shelve. It writes JSON serialized files,
8
8
  accepts unicode keys, and tracks whether the store has been changed since last
9
9
  sync. It has no dependencies.
10
10
 
11
- JSON store is intended for smaller stores. Everything is kept in memory and
11
+ json-store is intended for smaller stores. Everything is kept in memory and
12
12
  `sync()` writes the whole store to disk.
13
13
 
14
14
  For issues and development, see:
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  dynamic = ["version"]
3
3
  name = "json-store"
4
- requires-python = ">=3.10"
4
+ requires-python = ">=3.11"
5
5
  dependencies = []
6
6
 
7
7
  authors = [{name = "jeremy avnet", email = "json-store@theory.org"}]
@@ -20,11 +20,11 @@ classifiers = [
20
20
 
21
21
  "Operating System :: OS Independent",
22
22
  "Programming Language :: Python :: 3",
23
- "Programming Language :: Python :: 3.10",
24
23
  "Programming Language :: Python :: 3.11",
25
24
  "Programming Language :: Python :: 3.12",
26
25
  "Programming Language :: Python :: 3.13",
27
26
  "Programming Language :: Python :: 3.14",
27
+ "Programming Language :: Python :: 3.15",
28
28
  "Programming Language :: Python :: Implementation :: CPython",
29
29
  "Programming Language :: Python :: Implementation :: PyPy",
30
30
  ]
@@ -39,11 +39,19 @@ Changelog = "https://github.com/brainsik/json-store/releases"
39
39
  shelve2json = "json_store.shelve2json:main"
40
40
 
41
41
  [build-system]
42
- requires = ["hatchling"]
42
+ requires = ["hatchling==1.32.4"]
43
43
  build-backend = "hatchling.build"
44
44
 
45
+ [tool.hatch.build.targets.sdist]
46
+ include = [
47
+ "/pyproject.toml",
48
+ "/LICENSE.txt",
49
+ "/src",
50
+ "/tests",
51
+ ]
52
+
45
53
  [tool.hatch.version]
46
54
  path = "src/json_store/__init__.py"
47
55
 
48
56
  [dependency-groups]
49
- dev = ["pytest >=8.3"]
57
+ dev = ["pytest >=9.1"]
@@ -1,5 +1,5 @@
1
1
  from .json_store import JSONStore
2
2
 
3
- __version__ = "4.4"
3
+ __version__ = "4.6"
4
4
 
5
5
  open = JSONStore
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  """A JSON store to use in place of shelve. Unicode keys, FTW!
3
2
 
4
3
  This is for small stores. Everything is in memory and sync() always writes
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env python
2
- # encoding: utf-8
3
2
  """Naïvely create a json_store file from a shelve DB."""
4
3
 
4
+ import dbm
5
5
  import os
6
6
  import shelve
7
7
  import sys
@@ -11,7 +11,7 @@ import json_store
11
11
 
12
12
  def convert(oldfile: str):
13
13
  if not os.path.isfile(oldfile):
14
- raise ValueError("No such file: {}".format(oldfile))
14
+ raise ValueError(f"No such file: {oldfile}")
15
15
 
16
16
  name = oldfile
17
17
  # remove extensions that are implicitly added by the underlying DBM module
@@ -29,12 +29,12 @@ def convert(oldfile: str):
29
29
 
30
30
  def main(argv=sys.argv):
31
31
  if len(argv) < 2:
32
- print("Usage: {0[0]} <shelve_db>".format(argv))
32
+ print(f"Usage: {argv[0]} <shelve_db>")
33
33
  return 1
34
34
 
35
35
  try:
36
36
  convert(argv[1])
37
- except Exception as e:
37
+ except (*dbm.error, TypeError, ValueError) as e:
38
38
  print(str(e), file=sys.stderr)
39
39
  return 1
40
40
  return 0
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  import json
3
2
  import os
4
3
  import platform
@@ -13,7 +12,7 @@ def get_new_store(json_kw=None, mode=None):
13
12
  # get a random filename to use
14
13
  with NamedTemporaryFile(prefix=__name__ + ".") as f:
15
14
  path = f.name
16
- assert not os.path.exists(path), "Tempfile was not deleted: %s" % path
15
+ assert not os.path.exists(path), f"Tempfile was not deleted: {path}"
17
16
 
18
17
  kwargs = {}
19
18
 
@@ -151,7 +150,6 @@ def test_unchanged_store_doesnt_write_new_file():
151
150
  new_store.sync()
152
151
 
153
152
  store = json_store.open(new_store.path)
154
- print("Test: ", store._needs_sync)
155
153
  try:
156
154
  inode1 = os.stat(store.path).st_ino
157
155
  assert not store.sync(), "File was written?"
@@ -1,40 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- #
7
- name: "CodeQL"
8
-
9
- on:
10
- push:
11
- branches: ["main"]
12
- pull_request:
13
- # The branches below must be a subset of the branches above
14
- branches: ["main"]
15
- schedule:
16
- - cron: "27 8 * * 0"
17
-
18
- jobs:
19
- analyze:
20
- name: Analyze
21
- runs-on: ubuntu-latest
22
- permissions:
23
- actions: read
24
- contents: read
25
- security-events: write
26
-
27
- steps:
28
- - name: Checkout repository
29
- uses: actions/checkout@v4
30
-
31
- # Initializes the CodeQL tools for scanning.
32
- - name: Initialize CodeQL
33
- uses: github/codeql-action/init@v3
34
- with:
35
- languages: python
36
- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
37
- queries: security-and-quality
38
-
39
- - name: Perform CodeQL Analysis
40
- uses: github/codeql-action/analyze@v3
@@ -1,85 +0,0 @@
1
- name: json-store
2
- on: [push, pull_request]
3
-
4
- jobs:
5
- lint:
6
- runs-on: ubuntu-latest
7
-
8
- steps:
9
- - uses: actions/checkout@v5
10
-
11
- - name: Install uv
12
- uses: astral-sh/setup-uv@v6
13
- with:
14
- version: "latest"
15
-
16
- - name: pre-commit cache
17
- uses: actions/cache@v4
18
- with:
19
- path: ~/.cache/pre-commit
20
- key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21
- restore-keys: |
22
- ${{ runner.os }}-pre-commit-
23
-
24
- - name: Run pre-commit tests
25
- run: uv tool run pre-commit run -a
26
-
27
- build:
28
- runs-on: ubuntu-latest
29
-
30
- steps:
31
- - uses: actions/checkout@v5
32
-
33
- - name: Install uv
34
- uses: astral-sh/setup-uv@v6
35
- with:
36
- version: "latest"
37
-
38
- - name: Build package
39
- run: uv build
40
-
41
- - name: Store build artifacts
42
- uses: actions/upload-artifact@v4
43
- with:
44
- name: dist
45
- path: dist
46
-
47
- test:
48
- needs: [lint, build]
49
- strategy:
50
- matrix:
51
- os: [ubuntu-latest]
52
- python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.11"]
53
- include:
54
- - os: windows-latest
55
- python-version: "3.10"
56
- - os: macos-latest
57
- python-version: "3.10"
58
- - os: windows-latest
59
- python-version: "3.14"
60
- - os: macos-latest
61
- python-version: "3.14"
62
- runs-on: ${{ matrix.os }}
63
-
64
- steps:
65
- - uses: actions/checkout@v5
66
-
67
- - name: Install uv
68
- uses: astral-sh/setup-uv@v6
69
- with:
70
- version: "latest"
71
-
72
- - name: Set up Python ${{ matrix.python-version }}
73
- uses: actions/setup-python@v6
74
- with:
75
- python-version: ${{ matrix.python-version }}
76
-
77
- - name: Install ${{ github.job }} dependencies
78
- run: |
79
- uv sync
80
-
81
- - name: Test with pytest
82
- run: uv run pytest
83
-
84
- - name: Test shelve2json
85
- run: uv run sh tests/test_shelve2json.sh
@@ -1,30 +0,0 @@
1
- repos:
2
- - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v6.0.0
4
- hooks:
5
- - id: check-ast
6
- - id: check-merge-conflict
7
- - id: check-yaml
8
- - id: end-of-file-fixer
9
- - id: trailing-whitespace
10
-
11
- - repo: https://github.com/rhysd/actionlint
12
- rev: v1.7.11
13
- hooks:
14
- - id: actionlint
15
-
16
- - repo: https://github.com/astral-sh/ruff-pre-commit
17
- rev: v0.15.1
18
- hooks:
19
- - id: ruff-check
20
- - id: ruff-format
21
-
22
- - repo: https://github.com/rvben/rumdl-pre-commit
23
- rev: v0.1.21
24
- hooks:
25
- - id: rumdl
26
-
27
- - repo: https://github.com/abravalheri/validate-pyproject
28
- rev: v0.25
29
- hooks:
30
- - id: validate-pyproject
@@ -1,133 +0,0 @@
1
-
2
- # Contributor Covenant Code of Conduct
3
-
4
- ## Our Pledge
5
-
6
- We as members, contributors, and leaders pledge to make participation in our
7
- community a harassment-free experience for everyone, regardless of age, body
8
- size, visible or invisible disability, ethnicity, sex characteristics, gender
9
- identity and expression, level of experience, education, socio-economic status,
10
- nationality, personal appearance, race, caste, color, religion, or sexual
11
- identity and orientation.
12
-
13
- We pledge to act and interact in ways that contribute to an open, welcoming,
14
- diverse, inclusive, and healthy community.
15
-
16
- ## Our Standards
17
-
18
- Examples of behavior that contributes to a positive environment for our
19
- community include:
20
-
21
- * Demonstrating empathy and kindness toward other people
22
- * Being respectful of differing opinions, viewpoints, and experiences
23
- * Giving and gracefully accepting constructive feedback
24
- * Accepting responsibility and apologizing to those affected by our mistakes,
25
- and learning from the experience
26
- * Focusing on what is best not just for us as individuals, but for the overall
27
- community
28
-
29
- Examples of unacceptable behavior include:
30
-
31
- * The use of sexualized language or imagery, and sexual attention or advances of
32
- any kind
33
- * Trolling, insulting or derogatory comments, and personal or political attacks
34
- * Public or private harassment
35
- * Publishing others' private information, such as a physical or email address,
36
- without their explicit permission
37
- * Other conduct which could reasonably be considered inappropriate in a
38
- professional setting
39
-
40
- ## Enforcement Responsibilities
41
-
42
- Community leaders are responsible for clarifying and enforcing our standards of
43
- acceptable behavior and will take appropriate and fair corrective action in
44
- response to any behavior that they deem inappropriate, threatening, offensive,
45
- or harmful.
46
-
47
- Community leaders have the right and responsibility to remove, edit, or reject
48
- comments, commits, code, wiki edits, issues, and other contributions that are
49
- not aligned to this Code of Conduct, and will communicate reasons for moderation
50
- decisions when appropriate.
51
-
52
- ## Scope
53
-
54
- This Code of Conduct applies within all community spaces, and also applies when
55
- an individual is officially representing the community in public spaces.
56
- Examples of representing our community include using an official email address,
57
- posting via an official social media account, or acting as an appointed
58
- representative at an online or offline event.
59
-
60
- ## Enforcement
61
-
62
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
- reported to the community leaders responsible for enforcement at
64
- [json-store@theory.org](mailto:json-store@theory.org).
65
- All complaints will be reviewed and investigated promptly and fairly.
66
-
67
- All community leaders are obligated to respect the privacy and security of the
68
- reporter of any incident.
69
-
70
- ## Enforcement Guidelines
71
-
72
- Community leaders will follow these Community Impact Guidelines in determining
73
- the consequences for any action they deem in violation of this Code of Conduct:
74
-
75
- ### 1. Correction
76
-
77
- **Community Impact**: Use of inappropriate language or other behavior deemed
78
- unprofessional or unwelcome in the community.
79
-
80
- **Consequence**: A private, written warning from community leaders, providing
81
- clarity around the nature of the violation and an explanation of why the
82
- behavior was inappropriate. A public apology may be requested.
83
-
84
- ### 2. Warning
85
-
86
- **Community Impact**: A violation through a single incident or series of
87
- actions.
88
-
89
- **Consequence**: A warning with consequences for continued behavior. No
90
- interaction with the people involved, including unsolicited interaction with
91
- those enforcing the Code of Conduct, for a specified period of time. This
92
- includes avoiding interactions in community spaces as well as external channels
93
- like social media. Violating these terms may lead to a temporary or permanent
94
- ban.
95
-
96
- ### 3. Temporary Ban
97
-
98
- **Community Impact**: A serious violation of community standards, including
99
- sustained inappropriate behavior.
100
-
101
- **Consequence**: A temporary ban from any sort of interaction or public
102
- communication with the community for a specified period of time. No public or
103
- private interaction with the people involved, including unsolicited interaction
104
- with those enforcing the Code of Conduct, is allowed during this period.
105
- Violating these terms may lead to a permanent ban.
106
-
107
- ### 4. Permanent Ban
108
-
109
- **Community Impact**: Demonstrating a pattern of violation of community
110
- standards, including sustained inappropriate behavior, harassment of an
111
- individual, or aggression toward or disparagement of classes of individuals.
112
-
113
- **Consequence**: A permanent ban from any sort of public interaction within the
114
- community.
115
-
116
- ## Attribution
117
-
118
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
- version 2.1, available at
120
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
-
122
- Community Impact Guidelines were inspired by
123
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
-
125
- For answers to common questions about this code of conduct, see the FAQ at
126
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
- [https://www.contributor-covenant.org/translations][translations].
128
-
129
- [homepage]: https://www.contributor-covenant.org
130
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
- [Mozilla CoC]: https://github.com/mozilla/diversity
132
- [FAQ]: https://www.contributor-covenant.org/faq
133
- [translations]: https://www.contributor-covenant.org/translations
@@ -1,46 +0,0 @@
1
- # Development
2
-
3
- ## Releasing a new version
4
-
5
- Documentation is the first step on the road to automation. 😊
6
-
7
- Follow these steps in order.
8
-
9
- ### Create new build on GitHub
10
-
11
- 1. Update `json-store/__init__.py` with new version.
12
- 1. Tag the commit
13
-
14
- ```sh
15
- git tag -s v3.2
16
- ```
17
-
18
- 1. Push commit and push tag
19
-
20
- ```sh
21
- git push --atomic origin main v3.2
22
- ```
23
-
24
- ### Release on GitHub
25
-
26
- 1. Download artifacts from [GitHub workflow](https://github.com/brainsik/json-store/actions/workflows/main.yml).
27
- This will create a `dist/` directory.
28
- 1. Create release from tag and write notes
29
- 1. Attach files in `/path/to/dist`
30
- 1. Publish
31
-
32
- ### Release on PyPI
33
-
34
- 1. Upload artifacts
35
-
36
- ```sh
37
- uvx twine upload /path/to/dist/*
38
- ```
39
-
40
- ### Cleanup
41
-
42
- ```sh
43
- rm -rf /path/to/dist
44
- git clean -Xd -n # check for the unexpected
45
- git clean -Xd -f
46
- ```