pydantic-fixedwidth 0.2.3__tar.gz → 0.3.1__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.
- pydantic_fixedwidth-0.3.1/.devcontainer.example/devcontainer-lock.json +9 -0
- pydantic_fixedwidth-0.3.1/.devcontainer.example/devcontainer.json +21 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.editorconfig +6 -10
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.github/workflows/ci.yaml +24 -13
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.github/workflows/prepare-release.yaml +28 -4
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.github/workflows/release.yaml +17 -8
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.gitignore +12 -9
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.pre-commit-config.yaml +1 -6
- pydantic_fixedwidth-0.3.1/.python-version +1 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.vscode.example/extensions.json +0 -1
- pydantic_fixedwidth-0.3.1/.vscode.example/settings.json +11 -0
- pydantic_fixedwidth-0.3.1/CONTRIBUTING.md +62 -0
- pydantic_fixedwidth-0.3.1/Justfile +62 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/PKG-INFO +16 -4
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/README.md +12 -1
- pydantic_fixedwidth-0.3.1/flake.lock +61 -0
- pydantic_fixedwidth-0.3.1/flake.nix +39 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/pydantic_fixedwidth/fixedwidth.py +2 -1
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/pyproject.toml +29 -22
- pydantic_fixedwidth-0.3.1/uv.lock +709 -0
- pydantic_fixedwidth-0.2.3/.devcontainer.example/devcontainer.json +0 -26
- pydantic_fixedwidth-0.2.3/.devcontainer.example/onCreateCommand.sh +0 -3
- pydantic_fixedwidth-0.2.3/.devcontainer.example/postStartCommand.sh +0 -3
- pydantic_fixedwidth-0.2.3/.devcontainer.example/updateContentCommand.sh +0 -3
- pydantic_fixedwidth-0.2.3/.gitattributes +0 -124
- pydantic_fixedwidth-0.2.3/.python-version +0 -1
- pydantic_fixedwidth-0.2.3/Makefile +0 -67
- pydantic_fixedwidth-0.2.3/uv.lock +0 -910
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/LICENSE +0 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/pydantic_fixedwidth/__init__.py +0 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/pydantic_fixedwidth/py.typed +0 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/renovate.json +0 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/tests/__init__.py +0 -0
- {pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/tests/test_fixedwidth.py +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"features": {
|
|
3
|
+
"ghcr.io/devcontainers/features/nix:1": {
|
|
4
|
+
"version": "1.3.1",
|
|
5
|
+
"resolved": "ghcr.io/devcontainers/features/nix@sha256:8953a9da475055d140db0ede314e8e1b117d28c1eabf289c1b07c7619ce6c078",
|
|
6
|
+
"integrity": "sha256:8953a9da475055d140db0ede314e8e1b117d28c1eabf289c1b07c7619ce6c078"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lasuillard-s/pydantic-fixedwidth",
|
|
3
|
+
"image": "mcr.microsoft.com/devcontainers/base:dev-trixie",
|
|
4
|
+
"features": {
|
|
5
|
+
"ghcr.io/devcontainers/features/nix:1": {
|
|
6
|
+
"extraNixConfig": "extra-experimental-features = nix-command flakes"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"customizations": {
|
|
10
|
+
"vscode": {
|
|
11
|
+
"extensions": [
|
|
12
|
+
"ms-python.python",
|
|
13
|
+
"ms-python.vscode-pylance",
|
|
14
|
+
"EditorConfig.EditorConfig",
|
|
15
|
+
"charliermarsh.ruff",
|
|
16
|
+
"ms-python.mypy-type-checker",
|
|
17
|
+
"ms-python.debugpy"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -5,19 +5,15 @@ root = true
|
|
|
5
5
|
[*]
|
|
6
6
|
charset = utf-8
|
|
7
7
|
end_of_line = lf
|
|
8
|
-
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
9
10
|
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
10
12
|
|
|
11
|
-
[
|
|
13
|
+
[{justfile,Justfile}]
|
|
12
14
|
indent_style = space
|
|
13
15
|
indent_size = 4
|
|
14
16
|
|
|
15
|
-
[*.
|
|
17
|
+
[*.py]
|
|
16
18
|
indent_style = space
|
|
17
|
-
indent_size =
|
|
18
|
-
|
|
19
|
-
[*.md]
|
|
20
|
-
trim_trailing_whitespace = false
|
|
21
|
-
|
|
22
|
-
[Makefile]
|
|
23
|
-
indent_style = tab
|
|
19
|
+
indent_size = 4
|
|
@@ -6,18 +6,26 @@ on:
|
|
|
6
6
|
pull_request:
|
|
7
7
|
branches: [main]
|
|
8
8
|
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
9
13
|
env:
|
|
10
14
|
UV_FROZEN: 1
|
|
11
15
|
|
|
12
16
|
jobs:
|
|
13
17
|
lint:
|
|
18
|
+
name: Lint
|
|
14
19
|
runs-on: ubuntu-latest
|
|
15
20
|
timeout-minutes: 5
|
|
16
21
|
permissions:
|
|
17
22
|
contents: read
|
|
18
23
|
steps:
|
|
19
|
-
-
|
|
20
|
-
|
|
24
|
+
- name: Checkout
|
|
25
|
+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
26
|
+
|
|
27
|
+
- name: Set up uv
|
|
28
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
21
29
|
with:
|
|
22
30
|
version: latest
|
|
23
31
|
enable-cache: true
|
|
@@ -25,17 +33,17 @@ jobs:
|
|
|
25
33
|
- name: Install deps
|
|
26
34
|
run: uv sync
|
|
27
35
|
|
|
28
|
-
- name:
|
|
29
|
-
run: uv run ruff check .
|
|
30
|
-
|
|
31
|
-
- name: Format with Ruff
|
|
36
|
+
- name: Check code formatting
|
|
32
37
|
run: uv run ruff format --check .
|
|
33
38
|
|
|
34
|
-
- name:
|
|
39
|
+
- name: Lint code
|
|
40
|
+
run: uv run ruff check .
|
|
41
|
+
|
|
42
|
+
- name: Type check
|
|
35
43
|
run: uv run mypy --show-error-codes --pretty .
|
|
36
44
|
|
|
37
45
|
test:
|
|
38
|
-
name:
|
|
46
|
+
name: Test (py${{ matrix.python-version }})
|
|
39
47
|
runs-on: ubuntu-latest
|
|
40
48
|
timeout-minutes: 5
|
|
41
49
|
permissions:
|
|
@@ -44,11 +52,14 @@ jobs:
|
|
|
44
52
|
strategy:
|
|
45
53
|
fail-fast: false
|
|
46
54
|
matrix:
|
|
47
|
-
python-version: ["3.
|
|
55
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
48
56
|
|
|
49
57
|
steps:
|
|
50
|
-
-
|
|
51
|
-
|
|
58
|
+
- name: Checkout
|
|
59
|
+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
60
|
+
|
|
61
|
+
- name: Set up uv
|
|
62
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
52
63
|
with:
|
|
53
64
|
version: latest
|
|
54
65
|
enable-cache: true
|
|
@@ -63,7 +74,7 @@ jobs:
|
|
|
63
74
|
run: uv run pytest
|
|
64
75
|
|
|
65
76
|
- name: Upload test results to Codecov
|
|
66
|
-
uses: codecov/codecov-action@
|
|
77
|
+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
|
67
78
|
with:
|
|
68
79
|
use_oidc: true
|
|
69
80
|
fail_ci_if_error: false
|
|
@@ -73,7 +84,7 @@ jobs:
|
|
|
73
84
|
python-${{ matrix.python-version }}
|
|
74
85
|
|
|
75
86
|
- name: Upload coverage report
|
|
76
|
-
uses: codecov/codecov-action@
|
|
87
|
+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
|
77
88
|
with:
|
|
78
89
|
use_oidc: true
|
|
79
90
|
fail_ci_if_error: false
|
{pydantic_fixedwidth-0.2.3 → pydantic_fixedwidth-0.3.1}/.github/workflows/prepare-release.yaml
RENAMED
|
@@ -7,8 +7,16 @@ on:
|
|
|
7
7
|
description: Semver-style tag for release (e.g., v1.0.0)
|
|
8
8
|
required: true
|
|
9
9
|
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}
|
|
12
|
+
cancel-in-progress: false
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
UV_FROZEN: 1
|
|
16
|
+
|
|
10
17
|
jobs:
|
|
11
18
|
create-pr:
|
|
19
|
+
name: Create PR
|
|
12
20
|
runs-on: ubuntu-latest
|
|
13
21
|
timeout-minutes: 5
|
|
14
22
|
permissions:
|
|
@@ -22,30 +30,46 @@ jobs:
|
|
|
22
30
|
exit 1
|
|
23
31
|
fi
|
|
24
32
|
|
|
25
|
-
-
|
|
26
|
-
|
|
33
|
+
- name: Checkout
|
|
34
|
+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
35
|
+
|
|
36
|
+
- name: Set up uv
|
|
37
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
27
38
|
with:
|
|
28
39
|
version: latest
|
|
29
40
|
enable-cache: true
|
|
30
41
|
|
|
31
42
|
- name: Set version
|
|
43
|
+
env:
|
|
44
|
+
UV_FROZEN: 0 # Allow updating lockfile
|
|
32
45
|
run: |
|
|
33
46
|
tag="${{ inputs.tag }}"
|
|
34
47
|
tag_no_v="${tag#v}"
|
|
35
48
|
uv version "${tag#v}"
|
|
36
49
|
|
|
37
50
|
- name: Generate GitHub App token
|
|
38
|
-
uses: actions/create-github-app-token@
|
|
51
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
39
52
|
id: generate-token
|
|
40
53
|
with:
|
|
41
54
|
app-id: ${{ vars.GH_APP_ID }}
|
|
42
55
|
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
|
43
56
|
|
|
44
57
|
- name: Create pull request
|
|
45
|
-
uses: peter-evans/create-pull-request@
|
|
58
|
+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
46
59
|
with:
|
|
47
60
|
token: ${{ steps.generate-token.outputs.token }}
|
|
48
61
|
sign-commits: true
|
|
49
62
|
title: Release ${{ inputs.tag }}
|
|
63
|
+
body: |
|
|
64
|
+
This pull request prepares the repository for the ${{ inputs.tag }} release.
|
|
65
|
+
|
|
66
|
+
### Changes
|
|
67
|
+
- Bumps package version to `${{ inputs.tag }}` (without creating a git tag)
|
|
68
|
+
- Ready for review and merge
|
|
69
|
+
|
|
70
|
+
### Next steps
|
|
71
|
+
1. Review and merge this PR
|
|
72
|
+
2. Create and publish a GitHub release with tag `${{ inputs.tag }}`
|
|
73
|
+
3. The release workflow will automatically build and publish the package to PyPI
|
|
50
74
|
branch: release/${{ inputs.tag }}
|
|
51
75
|
delete-branch: true
|
|
@@ -4,18 +4,26 @@ on:
|
|
|
4
4
|
release:
|
|
5
5
|
types: [published]
|
|
6
6
|
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}
|
|
9
|
+
cancel-in-progress: false
|
|
10
|
+
|
|
7
11
|
env:
|
|
8
12
|
UV_FROZEN: 1
|
|
9
13
|
|
|
10
14
|
jobs:
|
|
11
15
|
release:
|
|
16
|
+
name: Release
|
|
12
17
|
runs-on: ubuntu-latest
|
|
13
|
-
timeout-minutes:
|
|
18
|
+
timeout-minutes: 10
|
|
14
19
|
permissions:
|
|
15
20
|
contents: write
|
|
16
21
|
steps:
|
|
17
|
-
-
|
|
18
|
-
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
24
|
+
|
|
25
|
+
- name: Set up uv
|
|
26
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
19
27
|
with:
|
|
20
28
|
version: latest
|
|
21
29
|
enable-cache: true
|
|
@@ -27,22 +35,23 @@ jobs:
|
|
|
27
35
|
run: uv build
|
|
28
36
|
|
|
29
37
|
- name: Create release
|
|
30
|
-
uses: softprops/action-gh-release@
|
|
38
|
+
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
|
|
31
39
|
with:
|
|
32
40
|
tag_name: ${{ github.event.release.tag_name }}
|
|
33
|
-
generate_release_notes:
|
|
41
|
+
generate_release_notes: false
|
|
34
42
|
files: dist/*
|
|
35
43
|
|
|
36
44
|
- name: Show files
|
|
37
45
|
run: ls -l --all --recursive dist
|
|
38
46
|
|
|
39
47
|
- name: Upload release distributions
|
|
40
|
-
uses: actions/upload-artifact@
|
|
48
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
41
49
|
with:
|
|
42
50
|
name: release-dists
|
|
43
51
|
path: dist/
|
|
44
52
|
|
|
45
53
|
publish-pypi:
|
|
54
|
+
name: Publish to PyPI
|
|
46
55
|
needs: release
|
|
47
56
|
runs-on: ubuntu-latest
|
|
48
57
|
environment: pypi
|
|
@@ -51,7 +60,7 @@ jobs:
|
|
|
51
60
|
id-token: write
|
|
52
61
|
steps:
|
|
53
62
|
- name: Download release distributions
|
|
54
|
-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
63
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
55
64
|
with:
|
|
56
65
|
name: release-dists
|
|
57
66
|
path: dist/
|
|
@@ -60,6 +69,6 @@ jobs:
|
|
|
60
69
|
run: ls -l --all --recursive dist
|
|
61
70
|
|
|
62
71
|
- name: Publish release distributions to PyPI
|
|
63
|
-
uses: pypa/gh-action-pypi-publish@
|
|
72
|
+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
|
|
64
73
|
with:
|
|
65
74
|
skip-existing: true
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
.devcontainer
|
|
2
|
+
.vscode
|
|
1
3
|
junit.xml
|
|
2
|
-
**/*.ipynb
|
|
3
|
-
tmp/
|
|
4
|
-
.tmp/
|
|
5
|
-
.devcontainer/
|
|
6
|
-
.vscode/
|
|
7
4
|
|
|
8
|
-
# Created by https://www.toptal.com/developers/gitignore/api/git,linux,macos,python,windows,visualstudiocode
|
|
9
|
-
# Edit at https://www.toptal.com/developers/gitignore?templates=git,linux,macos,python,windows,visualstudiocode
|
|
5
|
+
# Created by https://www.toptal.com/developers/gitignore/api/git,linux,macos,direnv,dotenv,python,windows,visualstudiocode
|
|
6
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=git,linux,macos,direnv,dotenv,python,windows,visualstudiocode
|
|
7
|
+
|
|
8
|
+
### direnv ###
|
|
9
|
+
.direnv
|
|
10
|
+
.envrc
|
|
11
|
+
|
|
12
|
+
### dotenv ###
|
|
13
|
+
.env
|
|
10
14
|
|
|
11
15
|
### Git ###
|
|
12
16
|
# Created by git for backups. To disable backups in Git:
|
|
@@ -194,7 +198,6 @@ celerybeat.pid
|
|
|
194
198
|
*.sage.py
|
|
195
199
|
|
|
196
200
|
# Environments
|
|
197
|
-
.env
|
|
198
201
|
.venv
|
|
199
202
|
env/
|
|
200
203
|
venv/
|
|
@@ -288,4 +291,4 @@ $RECYCLE.BIN/
|
|
|
288
291
|
# Windows shortcuts
|
|
289
292
|
*.lnk
|
|
290
293
|
|
|
291
|
-
# End of https://www.toptal.com/developers/gitignore/api/git,linux,macos,python,windows,visualstudiocode
|
|
294
|
+
# End of https://www.toptal.com/developers/gitignore/api/git,linux,macos,direnv,dotenv,python,windows,visualstudiocode
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
default_stages: [pre-commit]
|
|
2
1
|
fail_fast: true
|
|
3
2
|
repos:
|
|
4
3
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
@@ -12,7 +11,7 @@ repos:
|
|
|
12
11
|
hooks:
|
|
13
12
|
- id: check-file-pair
|
|
14
13
|
args:
|
|
15
|
-
- --from=
|
|
14
|
+
- --from=pydantic_fixedwidth
|
|
16
15
|
- --to=tests
|
|
17
16
|
- --include=*.py
|
|
18
17
|
- --exclude=errors.py,_*.py
|
|
@@ -48,7 +47,3 @@ repos:
|
|
|
48
47
|
types: [python]
|
|
49
48
|
pass_filenames: false
|
|
50
49
|
entry: uv run pytest
|
|
51
|
-
|
|
52
|
-
ci:
|
|
53
|
-
autofix_prs: true
|
|
54
|
-
autoupdate_schedule: quarterly
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[python]": {
|
|
3
|
+
"editor.defaultFormatter": "charliermarsh.ruff"
|
|
4
|
+
},
|
|
5
|
+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
|
|
6
|
+
"python.testing.pytestArgs": [
|
|
7
|
+
"--no-cov" // Fix debugger not stopping if pytest-cov is installed
|
|
8
|
+
],
|
|
9
|
+
"python.testing.pytestEnabled": true,
|
|
10
|
+
"python.testing.unittestEnabled": false
|
|
11
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ❤️🔥 Contributing to this project
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **pydantic-fixedwidth**!
|
|
4
|
+
|
|
5
|
+
## 🐛 Reporting issues
|
|
6
|
+
|
|
7
|
+
Please report issues in our [GitHub repository](https://github.com/lasuillard-s/pydantic-fixedwidth/issues). Before submitting an issue, please search for existing issues to avoid duplicates.
|
|
8
|
+
|
|
9
|
+
## 🏗️ Project overview
|
|
10
|
+
|
|
11
|
+
This project provides a small Python library (`pydantic_fixedwidth`) for parsing and serializing fixed-width data with Pydantic models.
|
|
12
|
+
|
|
13
|
+
### 🛠️ Tech stack
|
|
14
|
+
|
|
15
|
+
This project uses the following tech stack:
|
|
16
|
+
|
|
17
|
+
- [Python](https://www.python.org) 3.10+
|
|
18
|
+
- [uv](https://docs.astral.sh/uv/) for dependency management, Python installation, and packaging
|
|
19
|
+
- [Ruff](https://docs.astral.sh/ruff/) to lint and format Python code, and [Mypy](https://mypy-lang.org) for type checking
|
|
20
|
+
- [pytest](https://docs.pytest.org/en/latest) with coverage reporting for testing
|
|
21
|
+
|
|
22
|
+
### 📂 Key directory structure
|
|
23
|
+
|
|
24
|
+
- `pydantic_fixedwidth/`: The project's source code
|
|
25
|
+
- `tests/`: Project tests
|
|
26
|
+
- `flake.nix`: Flake configuration for the development environment
|
|
27
|
+
- `Justfile`: Commands for development
|
|
28
|
+
- `pyproject.toml`: Project metadata, dependencies, linting, type checking, and test configuration
|
|
29
|
+
|
|
30
|
+
## 🔧 Set up the development environment
|
|
31
|
+
|
|
32
|
+
For development, the following tools are required:
|
|
33
|
+
|
|
34
|
+
### ❄️ Tools managed via Nix Flakes
|
|
35
|
+
|
|
36
|
+
This repository uses [Nix Flakes](https://nix.dev/concepts/flakes.html) to manage tools. The following tools are automatically installed (requires `nix`):
|
|
37
|
+
|
|
38
|
+
- `pre-commit`
|
|
39
|
+
- `just`
|
|
40
|
+
- `uv`
|
|
41
|
+
- `pipx`
|
|
42
|
+
|
|
43
|
+
Run `nix develop` to start the development environment, then run `just install` to install dependencies.
|
|
44
|
+
|
|
45
|
+
If you prefer to use a [Dev Container](https://containers.dev), a configuration file ([devcontainer.json](./.devcontainer.example/devcontainer.json)) is provided with Nix support and Python tooling extensions.
|
|
46
|
+
|
|
47
|
+
## ✅ Verifying changes
|
|
48
|
+
|
|
49
|
+
Before pushing your code, verify that your changes adhere to the project's coding standards. Run `just ci` to execute all necessary formatters, linters, type checks, and tests. Alternatively, let the `pre-commit` hooks handle this automatically.
|
|
50
|
+
|
|
51
|
+
## ✨ Submitting changes
|
|
52
|
+
|
|
53
|
+
Please submit pull requests on GitHub. Before opening a PR, ensure your changes pass all checks by running `just ci`.
|
|
54
|
+
|
|
55
|
+
## 🚀 Release process
|
|
56
|
+
|
|
57
|
+
This project's package is published to PyPI through GitHub Releases:
|
|
58
|
+
|
|
59
|
+
1. Prepare a release via the [Prepare Release](https://github.com/lasuillard-s/pydantic-fixedwidth/actions/workflows/prepare-release.yaml) workflow using a tag that starts with `v`.
|
|
60
|
+
2. Review and merge the preparation PR.
|
|
61
|
+
3. Create and publish a new release in GitHub Releases.
|
|
62
|
+
4. The [release workflow](./.github/workflows/release.yaml) will attach the built distributions to the GitHub Release and publish them to PyPI.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
_default:
|
|
2
|
+
just --list
|
|
3
|
+
|
|
4
|
+
# Install deps and tools
|
|
5
|
+
install:
|
|
6
|
+
uv python install
|
|
7
|
+
uv sync --frozen
|
|
8
|
+
|
|
9
|
+
# Update deps and tools
|
|
10
|
+
update:
|
|
11
|
+
uv sync --upgrade
|
|
12
|
+
pre-commit autoupdate
|
|
13
|
+
|
|
14
|
+
alias up := update
|
|
15
|
+
|
|
16
|
+
# =============================================================================
|
|
17
|
+
# Development
|
|
18
|
+
# =============================================================================
|
|
19
|
+
|
|
20
|
+
# Build this project
|
|
21
|
+
build:
|
|
22
|
+
uv build
|
|
23
|
+
|
|
24
|
+
# Run all checks
|
|
25
|
+
ci: lint test
|
|
26
|
+
|
|
27
|
+
# Autoformat code
|
|
28
|
+
format:
|
|
29
|
+
uv run ruff format .
|
|
30
|
+
|
|
31
|
+
alias fmt := format
|
|
32
|
+
|
|
33
|
+
# Apply autofixes
|
|
34
|
+
fix:
|
|
35
|
+
uv run ruff check --fix .
|
|
36
|
+
uv run ruff format .
|
|
37
|
+
|
|
38
|
+
# Run all linters
|
|
39
|
+
lint:
|
|
40
|
+
uv run ruff format --check .
|
|
41
|
+
uv run ruff check .
|
|
42
|
+
uv run mypy --show-error-codes --pretty .
|
|
43
|
+
|
|
44
|
+
# Run all tests
|
|
45
|
+
test:
|
|
46
|
+
uv run pytest
|
|
47
|
+
|
|
48
|
+
# =============================================================================
|
|
49
|
+
# Utility
|
|
50
|
+
# =============================================================================
|
|
51
|
+
|
|
52
|
+
# Remove temporary files
|
|
53
|
+
clean:
|
|
54
|
+
rm -rf \
|
|
55
|
+
.mypy_cache/ \
|
|
56
|
+
.pytest_cache/ \
|
|
57
|
+
.ruff_cache/ \
|
|
58
|
+
dist/ \
|
|
59
|
+
coverage.xml \
|
|
60
|
+
junit.xml
|
|
61
|
+
find . -path '*/__pycache__*' -delete
|
|
62
|
+
find . -path "*.log*" -delete
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-fixedwidth
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Custom Pydantic models for
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Custom Pydantic models for serializing and deserializing fixed-width data.
|
|
5
5
|
Project-URL: Homepage, https://github.com/lasuillard-s/pydantic-fixedwidth
|
|
6
6
|
Project-URL: Repository, https://github.com/lasuillard-s/pydantic-fixedwidth.git
|
|
7
7
|
Project-URL: Issues, https://github.com/lasuillard-s/pydantic-fixedwidth/issues
|
|
8
|
+
Author-email: Yuchan Lee <lasuillard@gmail.com>
|
|
8
9
|
License-Expression: MIT
|
|
9
10
|
License-File: LICENSE
|
|
10
|
-
Requires-Python: <4.0,>=3.
|
|
11
|
+
Requires-Python: <4.0,>=3.10
|
|
11
12
|
Requires-Dist: pydantic<3,>=2
|
|
12
13
|
Description-Content-Type: text/markdown
|
|
13
14
|
|
|
@@ -17,8 +18,11 @@ Description-Content-Type: text/markdown
|
|
|
17
18
|
[](https://codecov.io/gh/lasuillard-s/pydantic-fixedwidth)
|
|
18
19
|
[](https://pypi.org/project/pydantic-fixedwidth/)
|
|
19
20
|
|
|
20
|
-
Custom Pydantic models for serializing and deserializing fixed-width
|
|
21
|
+
Custom Pydantic models for serializing and deserializing fixed-width data.
|
|
21
22
|
|
|
23
|
+
## ✨ Features
|
|
24
|
+
|
|
25
|
+
This small Python package provides tools for working with fixed-width data and for serializing and deserializing it using Pydantic models.
|
|
22
26
|
|
|
23
27
|
## 🚀 Quick Start
|
|
24
28
|
|
|
@@ -74,3 +78,11 @@ parsed_request = SomeRequest.parse_bytes(b)
|
|
|
74
78
|
|
|
75
79
|
assert parsed_request == some_request
|
|
76
80
|
```
|
|
81
|
+
|
|
82
|
+
## 💖 Contributing
|
|
83
|
+
|
|
84
|
+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for information on contributing to this project.
|
|
85
|
+
|
|
86
|
+
## 📜 License
|
|
87
|
+
|
|
88
|
+
This project is licensed under the MIT License.
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
[](https://codecov.io/gh/lasuillard-s/pydantic-fixedwidth)
|
|
5
5
|
[](https://pypi.org/project/pydantic-fixedwidth/)
|
|
6
6
|
|
|
7
|
-
Custom Pydantic models for serializing and deserializing fixed-width
|
|
7
|
+
Custom Pydantic models for serializing and deserializing fixed-width data.
|
|
8
8
|
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
This small Python package provides tools for working with fixed-width data and for serializing and deserializing it using Pydantic models.
|
|
9
12
|
|
|
10
13
|
## 🚀 Quick Start
|
|
11
14
|
|
|
@@ -61,3 +64,11 @@ parsed_request = SomeRequest.parse_bytes(b)
|
|
|
61
64
|
|
|
62
65
|
assert parsed_request == some_request
|
|
63
66
|
```
|
|
67
|
+
|
|
68
|
+
## 💖 Contributing
|
|
69
|
+
|
|
70
|
+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for information on contributing to this project.
|
|
71
|
+
|
|
72
|
+
## 📜 License
|
|
73
|
+
|
|
74
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodes": {
|
|
3
|
+
"flake-utils": {
|
|
4
|
+
"inputs": {
|
|
5
|
+
"systems": "systems"
|
|
6
|
+
},
|
|
7
|
+
"locked": {
|
|
8
|
+
"lastModified": 1731533236,
|
|
9
|
+
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
10
|
+
"owner": "numtide",
|
|
11
|
+
"repo": "flake-utils",
|
|
12
|
+
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
13
|
+
"type": "github"
|
|
14
|
+
},
|
|
15
|
+
"original": {
|
|
16
|
+
"owner": "numtide",
|
|
17
|
+
"repo": "flake-utils",
|
|
18
|
+
"type": "github"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"nixpkgs": {
|
|
22
|
+
"locked": {
|
|
23
|
+
"lastModified": 1781577229,
|
|
24
|
+
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
|
|
25
|
+
"owner": "nixos",
|
|
26
|
+
"repo": "nixpkgs",
|
|
27
|
+
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
|
|
28
|
+
"type": "github"
|
|
29
|
+
},
|
|
30
|
+
"original": {
|
|
31
|
+
"owner": "nixos",
|
|
32
|
+
"ref": "nixos-unstable",
|
|
33
|
+
"repo": "nixpkgs",
|
|
34
|
+
"type": "github"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"root": {
|
|
38
|
+
"inputs": {
|
|
39
|
+
"flake-utils": "flake-utils",
|
|
40
|
+
"nixpkgs": "nixpkgs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"systems": {
|
|
44
|
+
"locked": {
|
|
45
|
+
"lastModified": 1681028828,
|
|
46
|
+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
47
|
+
"owner": "nix-systems",
|
|
48
|
+
"repo": "default",
|
|
49
|
+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
50
|
+
"type": "github"
|
|
51
|
+
},
|
|
52
|
+
"original": {
|
|
53
|
+
"owner": "nix-systems",
|
|
54
|
+
"repo": "default",
|
|
55
|
+
"type": "github"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"root": "root",
|
|
60
|
+
"version": 7
|
|
61
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
inputs = {
|
|
3
|
+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
4
|
+
flake-utils.url = "github:numtide/flake-utils";
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
outputs =
|
|
8
|
+
{
|
|
9
|
+
self,
|
|
10
|
+
nixpkgs,
|
|
11
|
+
flake-utils,
|
|
12
|
+
}:
|
|
13
|
+
flake-utils.lib.eachDefaultSystem (
|
|
14
|
+
system:
|
|
15
|
+
let
|
|
16
|
+
pkgs = import nixpkgs { inherit system; };
|
|
17
|
+
|
|
18
|
+
# BUG: https://github.com/nixos/nixpkgs/issues/522307
|
|
19
|
+
fixedPipx = pkgs.python3Packages.toPythonApplication (
|
|
20
|
+
pkgs.python3Packages.pipx.overridePythonAttrs (oldAttrs: {
|
|
21
|
+
doCheck = false;
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
in
|
|
25
|
+
{
|
|
26
|
+
devShells.default = pkgs.mkShell {
|
|
27
|
+
packages = with pkgs; [
|
|
28
|
+
pre-commit
|
|
29
|
+
just
|
|
30
|
+
uv
|
|
31
|
+
fixedPipx
|
|
32
|
+
];
|
|
33
|
+
shellHook = ''
|
|
34
|
+
pre-commit install
|
|
35
|
+
'';
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -3,8 +3,9 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import logging
|
|
5
5
|
from collections import OrderedDict
|
|
6
|
+
from collections.abc import Callable # noqa: TC003
|
|
6
7
|
from functools import partial
|
|
7
|
-
from typing import Any,
|
|
8
|
+
from typing import Any, ClassVar, Literal
|
|
8
9
|
|
|
9
10
|
from pydantic import BaseModel, ConfigDict, Field
|
|
10
11
|
from pydantic.fields import FieldInfo # noqa: TC002
|