Skip to content
Open
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
34 changes: 9 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ TEST_DIR := tests
help:
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t

## black - Runs the Black Python formatter against the project
black:
$(VIRTUAL_BIN)/black $(PROJECT_NAME)/ $(TEST_DIR)/

## black-check - Checks if the project is formatted correctly against the Black rules
black-check:
$(VIRTUAL_BIN)/black $(PROJECT_NAME)/ $(TEST_DIR)/ --check

## build - Builds the project in preparation for release
build:
$(VIRTUAL_BIN)/python -m build
Expand All @@ -33,10 +25,6 @@ coverage:
docs:
$(VIRTUAL_BIN)/pdoc $(PROJECT_NAME) -o docs

## flake8 - Lint the project with flake8
flake8:
$(VIRTUAL_BIN)/flake8 $(PROJECT_NAME)/ $(TEST_DIR)/

## init-examples-submodule - Initialize the examples submodule
init-examples-submodule:
git submodule init
Expand All @@ -52,19 +40,15 @@ update-examples-submodule:
git submodule init
git submodule update --remote

## isort - Sorts imports throughout the project
isort:
$(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ $(TEST_DIR)/

## isort-check - Checks that imports throughout the project are sorted correctly
isort-check:
$(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ $(TEST_DIR)/ --check-only

## lint - Run linters on the project
lint: black-check isort-check flake8 mypy scan
## lint - Lints the project
lint:
$(VIRTUAL_BIN)/ruff check $(PROJECT_NAME)/ $(TEST_DIR)/
$(VIRTUAL_BIN)/ruff format --check $(PROJECT_NAME)/ $(TEST_DIR)/

## lint-fix - Runs all formatting tools against the project
lint-fix: black isort
## lint-fix - Fixes lint issues
lint-fix:
$(VIRTUAL_BIN)/ruff check --fix $(PROJECT_NAME)/ $(TEST_DIR)/
$(VIRTUAL_BIN)/ruff format $(PROJECT_NAME)/ $(TEST_DIR)/

## mypy - Run mypy type checking on the project
mypy:
Expand All @@ -84,4 +68,4 @@ scan:
test:
$(VIRTUAL_BIN)/pytest

.PHONY: help black black-check build clean coverage docs flake8 install isort isort-check lint lint-fix mypy release scan test
.PHONY: help build clean coverage docs install lint lint-fix mypy release scan test
2 changes: 1 addition & 1 deletion easypost/easypost_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def convert_to_easypost_object(
# Dynamically import class models due to circular imports of EasyPostObject
class_model = (
getattr(
importlib.import_module(f'easypost.models.{re.sub(r"(?<!^)(?=[A-Z])", "_", class_name).lower()}'),
importlib.import_module(f"easypost.models.{re.sub(r'(?<!^)(?=[A-Z])', '_', class_name).lower()}"),
class_name,
)
if class_name != EasyPostObject
Expand Down
25 changes: 3 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ classifiers = [
dependencies = ["requests >= 2.4.3"]
optional-dependencies = { dev = [
"bandit == 1.8.*",
"black == 25.*",
"build == 1.2.*",
"flake8 == 6.*",
"Flake8-pyproject == 1.2.*",
"isort == 6.*",
"mypy == 1.15.*",
"pdoc == 15.*",
"pytest == 8.*",
"pytest-cov == 6.*",
"pytest-vcr == 1.*",
"pytest == 8.*",
"ruff == 0.14.*",
"vcrpy == 7.*",
] }

Expand All @@ -51,21 +48,5 @@ exclude = ["docs", "examples", "tests"]
[tool.setuptools.package-data]
easypost = ["py.typed"]

[tool.black]
[tool.ruff]
line-length = 120

[tool.isort]
profile = "black"
line_length = 120
indent = 4
force_grid_wrap = 2
multi_line_output = 3
sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
lines_after_imports = 2
include_trailing_comma = true
use_parentheses = true

[tool.flake8]
max-line-length = 120
extend-ignore = ["E203", "F821"]
per-file-ignores = "__init__.py:F401"
2 changes: 1 addition & 1 deletion tests/test_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def assert_request(**kwargs):
assert kwargs.get("path") == "https://api.easypost.com/v2/parcels"
assert "parcel" in kwargs.get("request_body")
assert "Authorization" in kwargs.get("headers")
assert type(kwargs.get("request_timestamp")) == datetime.datetime
assert isinstance(kwargs.get("request_timestamp"), datetime.datetime)
assert uuid.UUID(str(kwargs.get("request_uuid")))

"""Test that we fire a RequestHook prior to making an HTTP request."""
Expand Down