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
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.1.2"
current_version = "0.1.3"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13
3.14
18,955 changes: 18,955 additions & 0 deletions assets/postman_collection/tmo_api_collection_20251117.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.1.3] - 2025-11-18
### Added

- Add updated TMO API spec 20251117.

### Changed
- Updated to Python 3.14 for development

### Fixed

- Fixed path processing issue in tmoapi download.

## [0.1.2] - 2025-11-12
### Added

Expand Down Expand Up @@ -57,6 +69,7 @@ All notable changes to this project will be documented in this file.
- Contributing: Development Setup, Testing, Code Style
- Changelog

[0.1.3]: https://github.com/inntran/tmo-api-python/releases/tag/v0.1.3
[0.1.2]: https://github.com/inntran/tmo-api-python/releases/tag/v0.1.2
[0.1.1]: https://github.com/inntran/tmo-api-python/releases/tag/v0.1.1
[0.1.0]: https://github.com/inntran/tmo-api-python/releases/tag/v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tmo-api"
version = "0.1.2"
version = "0.1.3"
description = "Wrapper for The Mortgage Office API"
readme = "README.md"
license = { text = "Apache-2.0" }
Expand Down Expand Up @@ -46,7 +46,7 @@ tmoapi = "tmo_api.cli.tmoapi:main"
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"black>=23.0.0",
"black>=25.11.0",
"flake8>=6.0.0",
"isort>=5.12.0",
"mypy>=1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/tmo_api/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
__all__ = ["__version__"]

# Keep this in sync with pyproject.toml
__version__ = "0.1.2"
__version__ = "0.1.3"
45 changes: 21 additions & 24 deletions src/tmo_api/cli/tmoapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,27 @@
}


def get_package_assets_dir() -> Path: # pragma: no cover
"""Get the assets directory from the installed package.
def find_assets_dir() -> Path: # pragma: no cover
"""Find the assets/postman_collection directory.

Checks in order:
1. Project root's assets directory (for development) - looks for pyproject.toml
2. Installed package's assets directory (for production)

Returns:
Path to the assets/postman_collection directory in the installed package
Path to the assets/postman_collection directory (may not exist yet)
"""
# Get the package installation directory
# First, try to find project root by looking for pyproject.toml (development mode)
current = Path.cwd()
for parent in [current] + list(current.parents):
if (parent / "pyproject.toml").exists():
return parent / "assets" / "postman_collection"

# Fall back to package installation directory (production mode)
# __file__ is .../tmo_api/cli/tmoapi.py
# parent.parent is .../tmo_api/
package_dir = Path(__file__).parent.parent
assets_dir = package_dir / "assets" / "postman_collection"
return assets_dir
return package_dir / "assets" / "postman_collection"


def find_api_spec(api_spec: Optional[str]) -> Path: # pragma: no cover
Expand All @@ -60,16 +69,16 @@ def find_api_spec(api_spec: Optional[str]) -> Path: # pragma: no cover
if api_spec:
doc_path = Path(api_spec)
else:
# First, look in the package's assets directory (for end users)
assets_dir = get_package_assets_dir()
# Check the assets directory (works for both development and production)
assets_dir = find_assets_dir()
if assets_dir.exists():
candidates = sorted(assets_dir.glob("tmo_api_collection_*.json"), reverse=True)
if candidates:
doc_path = candidates[0]
if doc_path.exists():
return doc_path

# Fall back to current directory (for development)
# Fall back to current directory
candidates = sorted(Path(".").glob("tmo_api_collection_*.json"), reverse=True)
if candidates:
doc_path = candidates[0]
Expand Down Expand Up @@ -280,21 +289,9 @@ def get_assets_output_path(filename: str) -> Path: # pragma: no cover
Returns:
Path to save the file in assets/postman_collection
"""
# Find the project root by looking for pyproject.toml
current = Path.cwd()
project_root = None
for parent in [current] + list(current.parents):
if (parent / "pyproject.toml").exists():
project_root = parent
break

if project_root:
assets_dir = project_root / "assets" / "postman_collection"
assets_dir.mkdir(parents=True, exist_ok=True)
return assets_dir / filename
else:
# Fallback to current directory
return Path(filename)
assets_dir = find_assets_dir()
assets_dir.mkdir(parents=True, exist_ok=True)
return assets_dir / filename


def get_filename_from_data(data: Dict[str, Any]) -> str:
Expand Down
Loading