mirror of
https://github.com/PR0M3TH3AN/python_charts.git
synced 2026-10-27 17:00:41 +00:00
Merge pull request #40 from PR0M3TH3AN/codex/update-readme-imports-to-package-qualified-style
Update README import examples
This commit is contained in:
1 file changed
+6
-6
@@ -65,10 +65,10 @@ python_charts/
|
||||
> **Note:** An empty `scripts/__init__.py` file has been added so that Python treats `scripts/` as a package. Because of this, each script can import `common.py` via:
|
||||
>
|
||||
> ```python
|
||||
> from common import fetch_series_db, save_figure, validate_dataframe, validate_overlap
|
||||
> from scripts.common import fetch_series_db, save_figure, validate_dataframe, validate_overlap
|
||||
> ```
|
||||
>
|
||||
> rather than `from scripts.common import …`. (\[Real Python]\[1], \[Software Engineering Stack Exchange]\[2])
|
||||
> rather than `from common import …`. (\[Real Python]\[1], \[Software Engineering Stack Exchange]\[2])
|
||||
|
||||
---
|
||||
|
||||
@@ -129,7 +129,7 @@ What happens under the hood:
|
||||
2. The script imports `UNRATE` and `DCOILWTICO` from `fred.db` via:
|
||||
|
||||
```python
|
||||
from common import fetch_series_db, save_figure, validate_dataframe, validate_overlap
|
||||
from scripts.common import fetch_series_db, save_figure, validate_dataframe, validate_overlap
|
||||
```
|
||||
|
||||
(\[Real Python]\[1], \[Software Engineering Stack Exchange]\[2])
|
||||
@@ -173,7 +173,7 @@ python -m scripts.custom_chart --series UNRATE DCOILWTICO --start 2000-01-01 --e
|
||||
* Internally, `custom_chart.py` invokes:
|
||||
|
||||
```python
|
||||
from common import fetch_series_db, save_figure
|
||||
from scripts.common import fetch_series_db, save_figure
|
||||
```
|
||||
|
||||
to load the requested series and save the figure.
|
||||
@@ -214,7 +214,7 @@ python -m scripts.bitcoin_m2_chart --btc-series CBBTCUSD --m2-series GLOBAL_M2 -
|
||||
1. Imports both series from `fred.db` with:
|
||||
|
||||
```python
|
||||
from common import fetch_series_db, save_figure
|
||||
from scripts.common import fetch_series_db, save_figure
|
||||
```
|
||||
|
||||
(\[Real Python]\[1], \[Software Engineering Stack Exchange]\[2])
|
||||
@@ -298,7 +298,7 @@ python-dateutil>=2.8.1
|
||||
|
||||
* **ModuleNotFoundError: `scripts.common` not found**
|
||||
|
||||
* Ensure you have added `scripts/__init__.py` and that all `from scripts.common import …` lines have been updated to `from common import …`. Then rerun:
|
||||
* Ensure you have added `scripts/__init__.py` and that all `from common import …` lines have been updated to `from scripts.common import …`. Then rerun:
|
||||
|
||||
```bash
|
||||
# Run the default lagged-oil chart via startup.sh
|
||||
|
||||
Reference in new issue
Block a user