Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ pip install -e '.[tests]'

To run the live tests, you'll need to have the `VORTEXA_API_KEY` environment variable set - `export VORTEXA_API_KEY=xyz`

run tests
run all tests

```bash
python setup.py test
pytest
```

If you're just looking to run tests in a single module (`test_vessels` in this case), you can do like this:
Expand Down
14 changes: 14 additions & 0 deletions docs/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ def copy_examples(examples_dir: str, destination_dir: str) -> None:
f_out.write("```")


def copy_css(source_dir: str, destination_dir: str) -> None:
"""Copy CSS files to the documentation build directory."""
pathlib.Path(destination_dir).mkdir(parents=True, exist_ok=True)
for file in os.listdir(source_dir):
if file.endswith(".css"):
source_path = os.path.join(source_dir, file)
dest_path = os.path.join(destination_dir, file)
with open(source_path, "r", encoding="utf-8") as f_in:
content = f_in.read()
with open(dest_path, "w", encoding="utf-8") as f_out:
f_out.write(content)


if __name__ == "__main__":
print(os.getcwd())
copy_examples("./docs/examples", "./_build/pydocmd/examples")
copy_css("./docs/css", "./_build/pydocmd/css")
5 changes: 5 additions & 0 deletions docs/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Fix long module names overflowing */
h1, h2, h3, h4, h5, h6 {
word-wrap: break-word;
overflow-wrap: break-word;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Try out the VortexaSDK"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First let's import our requirements"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from vortexasdk import AnywhereFreightPricingGetPriceDetails\n",
"from datetime import datetime"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You'll need to enter your Vortexa API key when prompted."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Get price details for an Aframax LR2 crude route from Houston to Rotterdam\n",
"result = AnywhereFreightPricingGetPriceDetails().search(\n",
" time_min=datetime(2024, 1, 1),\n",
" time_max=datetime(2024, 12, 31),\n",
" origin_port=\"7f314ba0a498c36359b1c88781e94a73e19dcc9bbb030ec6b82f944a73d4da2f\",\n",
" destination_port=\"68faf65af1345067f11dc6723b8da32f00e304a6f33c000118fccd81947deb4e\",\n",
" vessel_class=\"oil_aframax_lr2\",\n",
" product=\"crude\",\n",
" unit=\"usd_per_tonne\",\n",
")\n",
"df = result.to_df()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>vessel_class</th>\n",
" <th>max_dwt</th>\n",
" <th>suggested_tonnage</th>\n",
" <th>suggested_tonnage_overridden</th>\n",
" <th>avoid_zone</th>\n",
" <th>via_waypoint</th>\n",
" <th>rates</th>\n",
" <th>lumpsums</th>\n",
" <th>confidences</th>\n",
" <th>product</th>\n",
" <th>origin_port.id</th>\n",
" <th>origin_port.lat</th>\n",
" <th>origin_port.lon</th>\n",
" <th>destination_port.id</th>\n",
" <th>destination_port.lat</th>\n",
" <th>destination_port.lon</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>oil_aframax_lr2</td>\n",
" <td>119999.0</td>\n",
" <td>85000.0</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>None</td>\n",
" <td>[{'date': '2024-01-01', 'breakdown': [{'type':...</td>\n",
" <td>[{'date': '2024-01-01', 'breakdown': [{'type':...</td>\n",
" <td>[{'date': '2024-01-01', 'value': 2}, {'date': ...</td>\n",
" <td>crude</td>\n",
" <td>7f314ba0a498c36359b1c88781e94a73e19dcc9bbb030e...</td>\n",
" <td>29.71926</td>\n",
" <td>-95.14733</td>\n",
" <td>68faf65af1345067f11dc6723b8da32f00e304a6f33c00...</td>\n",
" <td>51.90924</td>\n",
" <td>4.27941</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" vessel_class max_dwt suggested_tonnage suggested_tonnage_overridden \\\n",
"0 oil_aframax_lr2 119999.0 85000.0 False \n",
"\n",
" avoid_zone via_waypoint rates \\\n",
"0 None None [{'date': '2024-01-01', 'breakdown': [{'type':... \n",
"\n",
" lumpsums \\\n",
"0 [{'date': '2024-01-01', 'breakdown': [{'type':... \n",
"\n",
" confidences product \\\n",
"0 [{'date': '2024-01-01', 'value': 2}, {'date': ... crude \n",
"\n",
" origin_port.id origin_port.lat \\\n",
"0 7f314ba0a498c36359b1c88781e94a73e19dcc9bbb030e... 29.71926 \n",
"\n",
" origin_port.lon destination_port.id \\\n",
"0 -95.14733 68faf65af1345067f11dc6723b8da32f00e304a6f33c00... \n",
"\n",
" destination_port.lat destination_port.lon \n",
"0 51.90924 4.27941 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"That's it! You've successfully loaded data using the Vortexa SDK. Check out https://vortechsa.github.io/python-sdk/ for more examples"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.13"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Try out the VortexaSDK"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First let's import our requirements"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from vortexasdk import AnywhereFreightPricingLatestUpdateTimestamp"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You'll need to enter your Vortexa API key when prompted."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"result = AnywhereFreightPricingLatestUpdateTimestamp().search()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"result"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"That's it! You've successfully loaded data using the Vortexa SDK. Check out https://vortechsa.github.io/python-sdk/ for more examples"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading
Loading