fix(packaging): use PyPI ycnbc extra

This commit is contained in:
Emerson Gomes
2026-08-23 16:43:34 -05:00
parent cbac5a9eb8
commit ee8a042b69
8 changed files with 38 additions and 29 deletions
+1
View File
@@ -21,6 +21,7 @@ unresolvable or where a dependent framework has not migrated yet.
| StatsForecast | 1.7.6 | 2.1.1 | Windows cp314 wheel resolution plus a real `Naive` forecast |
| sktime | 1.0.1 | 1.1.0 | Resolver check plus a real `NaiveForecaster` forecast |
| TimesFM | Git commit / 2.0.0 | PyPI 2.0.2 | Package API/import tests; added to `[all]` |
| ycnbc | Git commit `d5e5029` | PyPI 1.0.12 | Same 1.0.12 release; `[news-ycnbc]` / `[all-git]` no longer use a Direct URL (PyPI rejects git extras) |
| Foundation stack | Torch 2.11 / Transformers 5.12 floor | Torch 2.13 / Transformers 5.15.1 floor | Windows cp314 wheel resolution |
| Scientific/runtime packages | Earlier compatible floors | Latest compatible releases | Full `[all]` resolver pass |
| HNSW search | Opt-in helper only | `[pattern-search-hnsw]` and `[all]` | Fresh local cp314 wheel built from `hnswlib` 0.8.0 source; CI installs the extra |
+2 -1
View File
@@ -109,7 +109,8 @@ context, not a live tape.
headline will move the price.
- Optional embedding rerank (downloads a model on first use) is **off** by
default. See [ENV_VARS.md](ENV_VARS.md#news-embeddings).
- CNBC via `ycnbc` is an opt-in extra (`pip install -e ".[news-ycnbc]"`).
- CNBC via `ycnbc` is an opt-in extra (`pip install "mtdata-mcp[news-ycnbc]"`
or, from a checkout, `pip install -e ".[news-ycnbc]"`).
When `--source ycnbc` is pinned but that extra is unavailable, the command
returns `source_unavailable` with install/restart guidance instead of
presenting the missing adapter as an empty result.
+11
View File
@@ -61,6 +61,17 @@ twine upload dist/*
Upload only after the README marker is present. PyPI forbids replacing an
already-published version, so do not re-upload `0.1.0` once it is live.
PyPI also rejects distributions whose metadata contains a Direct URL
dependency (`pkg @ git+https://...`), even when it lives in an extra.
`news-ycnbc` must depend on the PyPI `ycnbc` package, not a Git pin.
Inspect the built wheel before upload:
```bash
python -c "import zipfile,sys; z=zipfile.ZipFile(sys.argv[1]); print(z.read([n for n in z.namelist() if n.endswith('METADATA')][0]).decode())" dist/mtdata_mcp-0.1.0-py3-none-any.whl
```
Confirm every `Requires-Dist` line is a package-index requirement.
---
## 3. Install mcp-publisher and publish `server.json`
+12 -11
View File
@@ -46,7 +46,8 @@ timezones, website and assistant entry points.
| Web API / UI backend only | `pip install -e .[web]` |
| Heavy forecast extras | `pip install -e .[forecast-classical]` and/or `pip install -e .[forecast-foundation]` |
| TimesFM | `pip install -e .[forecast-timesfm]` (PyPI release) |
| Git/manual experiments (`stock-pattern`, `ycnbc`) | Install only when needed |
| CNBC news | `pip install -e .[news-ycnbc]` (PyPI `ycnbc`) |
| Manual experiments (`stock-pattern`) | Install only when needed |
---
@@ -80,7 +81,7 @@ For the validated research/web environment used in local development and most do
pip install -r requirements.txt
```
This path intentionally stays on package-index releases. TimesFM 2.0.2 is now included from PyPI; Git/manual add-ons such as `stock-pattern` and `ycnbc` stay opt-in so the default install does not depend on Git checkouts.
This path intentionally stays on package-index releases. TimesFM 2.0.2 is now included from PyPI; the CNBC extra (`ycnbc`) stays opt-in via `[news-ycnbc]`, and the manual `stock-pattern` add-on stays out of the default install.
NeuralForecast-based models are also kept out of this default path: on Windows Python 3.14, `neuralforecast` cannot resolve because its required `ray` dependency does not publish Windows wheels for 3.14 (Ray has cp314 wheels for Linux/macOS only). Treat `nhits`, `tft`, `patchtst`, and `nbeatsx` as manual/nonstandard setup.
## Deeper detail: optional extras
@@ -91,7 +92,7 @@ Skip this block until candles and a simple Theta forecast already work.
The base package is intentionally lean. Install extras as needed:
> Windows note: install Visual Studio Build Tools 2022 with the **Desktop development with C++** workload before the full install or any Git-backed extra. Several optional dependencies include native extensions, and pip may need MSVC when a compatible wheel is unavailable. Git-backed extras also require Git on `PATH`.
> Windows note: install Visual Studio Build Tools 2022 with the **Desktop development with C++** workload before the full install. Several optional dependencies include native extensions, and pip may need MSVC when a compatible wheel is unavailable. The manual `stock-pattern` path also requires Git on `PATH`.
- Classical forecasting / optimization:
`pip install -e .[forecast-classical]`
@@ -105,15 +106,15 @@ The base package is intentionally lean. Install extras as needed:
`pip install -e .[dimred-ext]`
- HNSW pattern-search accelerator (source build):
`pip install -e .[pattern-search-hnsw]`
- Experimental pattern engines (Git-backed, requires manual install):
- Experimental pattern engines (requires manual install):
`pip install -e .[patterns-ext]` (Note: stock-pattern requires manual copy to site-packages; see below)
- News embeddings (semantic reranking):
`pip install -e .[news-embeddings]`
- CNBC news source (Git-backed):
- CNBC news source (PyPI):
`pip install -e .[news-ycnbc]`
- Everything from package indexes:
- Everything from package indexes except CNBC:
`pip install -e .[all]`
- Everything including Git-backed extras:
- Everything including the CNBC extra:
`pip install -e .[all-git]`
Feature notes:
@@ -131,8 +132,8 @@ Feature notes:
- Pattern-search accelerator: `hnswlib` is included in `[all]`; lean installs can use `[pattern-search-hnsw]` or the helper file below
- Barrier option pricing & Heston calibration: `QuantLib`
- Bayesian hyperparameter optimization: `optuna`
- Neural network forecasters (`nhits`, `tft`, `patchtst`, `nbeatsx`): manual/nonstandard setup only; not included in `requirements.txt` or a package extra (blocked on Windows 3.14 by missing `ray` wheels)
- TA-Lib: optional `pandas-ta` oracle backend. Indicators work without it; install `TA-Lib` if you want the C implementations
- Neural network forecasters (`nhits`, `tft`, `patchtst`, `nbeatsx`): manual/nonstandard setup only; not included in `requirements.txt` or a package extra (blocked on Windows 3.14 by missing `ray` wheels)
- TA-Lib: optional `pandas-ta` oracle backend. Indicators work without it; install `TA-Lib` if you want the C implementations
- Matplotlib: only for `scripts/backtest_plot.py` (`pip install matplotlib`)
### 5. HNSW Source-Build Path for Lean Installs
@@ -366,7 +367,7 @@ Building or developing the SPA requires Node.js 22.12 or newer.
```bash
# Once per checkout (or after UI source changes)
cd webui
npm ci
npm ci
npm run build
cd ..
@@ -475,7 +476,7 @@ python -m pytest tests/
```bash
cd webui
npm ci
npm ci
npm run dev # Development server
npm run build # Production build
```
+7 -12
View File
@@ -40,7 +40,7 @@ User tour: [WEBUI.md](WEBUI.md).
| What you see | What to try |
|--------------|-------------|
| Enablement page / “build the UI” instead of a chart | In `webui/`: `npm ci && npm run build`, then restart `mtdata-webapi`. |
| Enablement page / “build the UI” instead of a chart | In `webui/`: `npm ci && npm run build`, then restart `mtdata-webapi`. |
| Chart opens but stays empty | Pick a symbol that exists in MetaTrader 5 Market Watch, then reload. |
| Connection chip is not ready | MetaTrader 5 must be running and logged in. Check `http://127.0.0.1:8000/api/v1/ready`. |
| Overlay or forecast banner error | The rest of the chart can still work. Retry after `/ready` is healthy. |
@@ -346,24 +346,19 @@ MTDATA_CLI_DEBUG=1 mtdata-cli forecast_generate EURUSD --horizon 12
## Optional Dependency Issues
### Git-backed Extra Fails to Install
### Manual stock-pattern Extra Fails to Install
**Symptom:** `pip install -e .[patterns-ext]` or `pip install -e .[news-ycnbc]` fails during clone/build on Windows.
**Symptom:** `pip install -e .[patterns-ext]` does not install `stock-pattern` because that repository has no packaging metadata.
**Solution:**
1. Install Visual Studio Build Tools 2022 with the **Desktop development with C++** workload.
2. Make sure Git is installed and available on `PATH`.
3. Install the stable base stack first:
1. Make sure Git is installed and available on `PATH`.
2. Install the stable base stack first:
```bash
pip install -r requirements.txt
```
4. From the repository root, retry only the extra you need:
```bash
pip install -e .[patterns-ext]
pip install -e .[news-ycnbc]
```
3. Follow the manual copy steps in [SETUP.md](SETUP.md#6-manual-stock-pattern-installation).
If a Git-backed extra still fails, leave it out and use the rest of mtdata without that integration. TimesFM, `chronos2`, and `chronos_bolt` are available from package-index install paths.
If that still fails, leave it out and use the rest of mtdata without that integration. CNBC news (`ycnbc`), TimesFM, `chronos2`, and `chronos_bolt` are available from package-index extras.
### Optional hnswlib Source Build Fails
+2 -2
View File
@@ -97,7 +97,7 @@ news-embeddings = [
"huggingface-hub>=1.28.0,<2",
]
news-ycnbc = [
"ycnbc @ git+https://github.com/codestorm-official/ycnbc.git@d5e50293be499b617edaa10a03467b4184193a4e",
"ycnbc>=1.0.12",
]
dimred-ext = [
"umap-learn>=0.5.12",
@@ -153,7 +153,7 @@ all-git = [
"uvicorn[standard]>=0.52.4",
"sentence-transformers>=5.7.0,<6",
"umap-learn>=0.5.12",
"ycnbc @ git+https://github.com/codestorm-official/ycnbc.git@d5e50293be499b617edaa10a03467b4184193a4e",
"ycnbc>=1.0.12",
]
[project.scripts]
+2 -2
View File
@@ -1,7 +1,7 @@
# Full-feature local/dev install for Python 3.14 using package-index releases only.
# The base package is intentionally leaner; use this file when you want
# the validated research/web stack without Git-backed extras.
# Optional Git/manual add-ons (stock-pattern and ycnbc) are documented in docs/SETUP.md.
# the validated research/web stack without opt-in extras such as CNBC news.
# Optional add-ons (stock-pattern and ycnbc) are documented in docs/SETUP.md.
# The full stack includes the source-built hnswlib accelerator. Lean installs can
# add it separately through requirements-optional-src.txt or [pattern-search-hnsw].
+1 -1
View File
@@ -1420,7 +1420,7 @@ class YCNBCNewsSource:
return "the optional ycnbc package is not installed"
def install_hint(self) -> str:
return 'pip install -e ".[news-ycnbc]"'
return 'pip install "mtdata-mcp[news-ycnbc]"'
def fetch_general_candidates(self, limit: int) -> List[NewsItem]:
if not self.is_available():