macrotrace 0.1.0__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.
Files changed (78) hide show
  1. macrotrace-0.1.0/.github/workflows/ci.yml +33 -0
  2. macrotrace-0.1.0/.github/workflows/docs.yml +79 -0
  3. macrotrace-0.1.0/.github/workflows/release.yml +71 -0
  4. macrotrace-0.1.0/.gitignore +161 -0
  5. macrotrace-0.1.0/.pre-commit-config.yaml +23 -0
  6. macrotrace-0.1.0/.python-version +1 -0
  7. macrotrace-0.1.0/CHANGELOG.md +19 -0
  8. macrotrace-0.1.0/LICENSE +674 -0
  9. macrotrace-0.1.0/PKG-INFO +175 -0
  10. macrotrace-0.1.0/README.md +135 -0
  11. macrotrace-0.1.0/macrotrace/__init__.py +39 -0
  12. macrotrace-0.1.0/macrotrace/_paths.py +37 -0
  13. macrotrace-0.1.0/macrotrace/cli.py +73 -0
  14. macrotrace-0.1.0/macrotrace/graphing.py +183 -0
  15. macrotrace-0.1.0/macrotrace/models/__init__.py +31 -0
  16. macrotrace-0.1.0/macrotrace/models/db.py +265 -0
  17. macrotrace-0.1.0/macrotrace/models/mt/__init__.py +8 -0
  18. macrotrace-0.1.0/macrotrace/models/mt/analysis.py +990 -0
  19. macrotrace-0.1.0/macrotrace/models/mt/observation.py +9 -0
  20. macrotrace-0.1.0/macrotrace/models/mt/plotter.py +818 -0
  21. macrotrace-0.1.0/macrotrace/models/mt/series_metadata.py +61 -0
  22. macrotrace-0.1.0/macrotrace/models/mt/time_series.py +1088 -0
  23. macrotrace-0.1.0/macrotrace/ons_cli/__init__.py +0 -0
  24. macrotrace-0.1.0/macrotrace/ons_cli/cli.py +1197 -0
  25. macrotrace-0.1.0/macrotrace/ons_cli/common.py +437 -0
  26. macrotrace-0.1.0/macrotrace/ons_cli/tui.py +1450 -0
  27. macrotrace-0.1.0/macrotrace/py.typed +0 -0
  28. macrotrace-0.1.0/macrotrace/sources/__init__.py +8 -0
  29. macrotrace-0.1.0/macrotrace/sources/base.py +936 -0
  30. macrotrace-0.1.0/macrotrace/sources/example.py +190 -0
  31. macrotrace-0.1.0/macrotrace/sources/fred.py +686 -0
  32. macrotrace-0.1.0/macrotrace/sources/ons.py +1135 -0
  33. macrotrace-0.1.0/macrotrace/sources/rtdsm.py +15 -0
  34. macrotrace-0.1.0/pyproject.toml +140 -0
  35. macrotrace-0.1.0/scripts/backstop_ingest.py +336 -0
  36. macrotrace-0.1.0/tests/assets/mt/time_series/expected_vm.csv +16 -0
  37. macrotrace-0.1.0/tests/assets/mt/time_series/from_dataframe.csv +7057 -0
  38. macrotrace-0.1.0/tests/assets/mt/time_series/from_dataframe_with_tz.csv +7057 -0
  39. macrotrace-0.1.0/tests/models/mt/series/test_db_path_forwarding.py +73 -0
  40. macrotrace-0.1.0/tests/models/mt/series/test_init.py +1390 -0
  41. macrotrace-0.1.0/tests/models/mt/series/test_series.py +1229 -0
  42. macrotrace-0.1.0/tests/models/mt/test_analysis.py +1217 -0
  43. macrotrace-0.1.0/tests/models/mt/test_metadata.py +99 -0
  44. macrotrace-0.1.0/tests/models/mt/test_plotter.py +874 -0
  45. macrotrace-0.1.0/tests/models/mt/utils.py +278 -0
  46. macrotrace-0.1.0/tests/models/test_db_models.py +663 -0
  47. macrotrace-0.1.0/tests/ons_cli/test_cli.py +1315 -0
  48. macrotrace-0.1.0/tests/ons_cli/test_common.py +626 -0
  49. macrotrace-0.1.0/tests/ons_cli/test_root_cli.py +80 -0
  50. macrotrace-0.1.0/tests/ons_cli/test_tui.py +2044 -0
  51. macrotrace-0.1.0/tests/ons_cli/utils.py +83 -0
  52. macrotrace-0.1.0/tests/sources/base/fixtures.py +56 -0
  53. macrotrace-0.1.0/tests/sources/base/test_base_api_client.py +253 -0
  54. macrotrace-0.1.0/tests/sources/base/test_base_dataset_manager.py +276 -0
  55. macrotrace-0.1.0/tests/sources/base/test_base_observation_manager.py +18 -0
  56. macrotrace-0.1.0/tests/sources/base/test_base_release_manager.py +338 -0
  57. macrotrace-0.1.0/tests/sources/base/test_base_series_manager.py +332 -0
  58. macrotrace-0.1.0/tests/sources/base/test_base_update_manager.py +656 -0
  59. macrotrace-0.1.0/tests/sources/base/test_base_update_state.py +69 -0
  60. macrotrace-0.1.0/tests/sources/base/test_db_path_resolution.py +76 -0
  61. macrotrace-0.1.0/tests/sources/fred/fixtures.py +56 -0
  62. macrotrace-0.1.0/tests/sources/fred/test_fred_api_client.py +23 -0
  63. macrotrace-0.1.0/tests/sources/fred/test_fred_dataset_manager.py +454 -0
  64. macrotrace-0.1.0/tests/sources/fred/test_fred_observation_manager.py +314 -0
  65. macrotrace-0.1.0/tests/sources/fred/test_fred_release_manager.py +313 -0
  66. macrotrace-0.1.0/tests/sources/fred/test_fred_series_manager.py +26 -0
  67. macrotrace-0.1.0/tests/sources/fred/test_fred_tz_handling.py +255 -0
  68. macrotrace-0.1.0/tests/sources/fred/test_fred_update_manager.py +65 -0
  69. macrotrace-0.1.0/tests/sources/ons/fixtures.py +56 -0
  70. macrotrace-0.1.0/tests/sources/ons/test_ons_api_client.py +149 -0
  71. macrotrace-0.1.0/tests/sources/ons/test_ons_dataset_manager.py +760 -0
  72. macrotrace-0.1.0/tests/sources/ons/test_ons_observation_manager.py +420 -0
  73. macrotrace-0.1.0/tests/sources/ons/test_ons_release_manager.py +588 -0
  74. macrotrace-0.1.0/tests/sources/ons/test_ons_series_manager.py +11 -0
  75. macrotrace-0.1.0/tests/sources/ons/test_ons_update_manager.py +33 -0
  76. macrotrace-0.1.0/tests/test_package_init.py +54 -0
  77. macrotrace-0.1.0/tests/test_paths.py +59 -0
  78. macrotrace-0.1.0/uv.lock +4223 -0
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test (Python ${{ matrix.python-version }} on ${{ matrix.os }})
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest]
17
+ python-version: ["3.11", "3.12", "3.13"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v6
23
+ with:
24
+ enable-cache: true
25
+
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ run: uv python install ${{ matrix.python-version }}
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --all-extras --dev --python ${{ matrix.python-version }}
31
+
32
+ - name: Run tests
33
+ run: uv run --python ${{ matrix.python-version }} pytest
@@ -0,0 +1,79 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ workflow_dispatch:
8
+
9
+ concurrency:
10
+ group: pages
11
+ cancel-in-progress: false
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write # mike pushes versioned docs to gh-pages
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v5
25
+
26
+ - name: Set up Python
27
+ run: uv python install 3.13
28
+
29
+ - name: Install docs deps
30
+ run: uv sync --group docs
31
+
32
+ - name: Configure git for mike
33
+ run: |
34
+ git config user.name "github-actions[bot]"
35
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
36
+
37
+ - name: Deploy dev docs (push to main)
38
+ if: github.ref == 'refs/heads/main'
39
+ run: |
40
+ uv run mike deploy --push --update-aliases dev
41
+ if ! uv run mike list 2>/dev/null | grep -qE '^[0-9]'; then
42
+ uv run mike set-default --push dev
43
+ fi
44
+
45
+ - name: Deploy versioned docs (tag push)
46
+ if: startsWith(github.ref, 'refs/tags/v')
47
+ run: |
48
+ VERSION="${GITHUB_REF_NAME#v}"
49
+ if [[ "$VERSION" =~ (rc|a|b|dev|alpha|beta) ]]; then
50
+ uv run mike deploy --push "$VERSION"
51
+ else
52
+ uv run mike deploy --push --update-aliases "$VERSION" latest
53
+ uv run mike set-default --push latest
54
+ fi
55
+
56
+ - name: Checkout gh-pages for Pages upload
57
+ uses: actions/checkout@v4
58
+ with:
59
+ ref: gh-pages
60
+ path: gh-pages-build
61
+
62
+ - name: Upload Pages artifact
63
+ uses: actions/upload-pages-artifact@v3
64
+ with:
65
+ path: gh-pages-build
66
+
67
+ deploy:
68
+ needs: build
69
+ runs-on: ubuntu-latest
70
+ permissions:
71
+ pages: write
72
+ id-token: write
73
+ environment:
74
+ name: github-pages
75
+ url: ${{ steps.deployment.outputs.page_url }}
76
+ steps:
77
+ - name: Deploy to GitHub Pages
78
+ id: deployment
79
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,71 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build distributions
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Install uv
15
+ uses: astral-sh/setup-uv@v6
16
+ with:
17
+ enable-cache: true
18
+
19
+ - name: Build sdist and wheel
20
+ run: uv build
21
+
22
+ - name: Validate metadata
23
+ run: uvx twine check dist/*
24
+
25
+ - name: Smoketest wheel in clean env
26
+ run: |
27
+ uv venv .smoketest
28
+ uv pip install --python .smoketest/bin/python dist/macrotrace-*.whl
29
+ .smoketest/bin/python -c "from macrotrace import MTTimeSeries; print(MTTimeSeries)"
30
+
31
+ - name: Upload dist artifact
32
+ uses: actions/upload-artifact@v4
33
+ with:
34
+ name: dist
35
+ path: dist/
36
+
37
+ testpypi:
38
+ name: Publish to TestPyPI
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment:
42
+ name: testpypi
43
+ url: https://test.pypi.org/p/macrotrace
44
+ permissions:
45
+ id-token: write
46
+ steps:
47
+ - uses: actions/download-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ - uses: pypa/gh-action-pypi-publish@release/v1
53
+ with:
54
+ repository-url: https://test.pypi.org/legacy/
55
+
56
+ pypi:
57
+ name: Publish to PyPI
58
+ needs: testpypi
59
+ runs-on: ubuntu-latest
60
+ environment:
61
+ name: pypi
62
+ url: https://pypi.org/p/macrotrace
63
+ permissions:
64
+ id-token: write
65
+ steps:
66
+ - uses: actions/download-artifact@v4
67
+ with:
68
+ name: dist
69
+ path: dist/
70
+
71
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,161 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105
+ __pypackages__/
106
+
107
+ # Celery stuff
108
+ celerybeat-schedule
109
+ celerybeat.pid
110
+
111
+ # SageMath parsed files
112
+ *.sage.py
113
+
114
+ # Environments
115
+ .env
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # PyCharm
148
+ # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
151
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
152
+ #.idea/
153
+ .DS_Store
154
+ .vscode/
155
+ *.db
156
+ *.db-wal
157
+ *.db-shm
158
+ *.sqlite
159
+ .mplconfig/
160
+ .local/
161
+ .claude/
@@ -0,0 +1,23 @@
1
+ exclude: ^(notebooks|dist|site|\.venv)/|\.(csv|ipynb|png|gif|jpg|jpeg|svg|pdf|dbml)$
2
+
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ - id: check-yaml
10
+ - id: check-toml
11
+ - id: check-added-large-files
12
+ args: [--maxkb=1024]
13
+
14
+ - repo: https://github.com/psf/black
15
+ rev: 25.1.0
16
+ hooks:
17
+ - id: black
18
+
19
+ - repo: https://github.com/astral-sh/ruff-pre-commit
20
+ rev: v0.8.6
21
+ hooks:
22
+ - id: ruff
23
+ args: [--fix]
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
4
+ versions follow [SemVer](https://semver.org/).
5
+
6
+ ## 0.1.0 — 2026-04-28
7
+
8
+ First public release.
9
+
10
+ - **Sources:** vintage-aware ingestion from FRED and ONS, with a local
11
+ SQLite store (`MacroTrace.db`) and shared request cache.
12
+ - **Time series:** `MTTimeSeries` with `as_of(...)`, vintage- and
13
+ data-window filtering, `from_dataframe`, and pandas / Darts export.
14
+ - **Analysis:** revision metrics, vintage comparison, decomposition
15
+ across vintages, biasedness regression, and revision autocorrelation.
16
+ - **Plotting:** Plotly-based vintage, revision, and decomposition plots
17
+ via `MTTimeSeriesPlotter`.
18
+ - **CLI / TUI:** `macrotrace ons explorer` and `macrotrace ons tui`
19
+ (the latter via the optional `ons-tui` extra).