From 1388b369aed61e585dcd4dbf8d56474f5bfe4d4e Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Fri, 9 Jan 2026 13:41:30 -0700 Subject: [PATCH 1/2] chore: convert setup.py to pyproject.toml --- .gitignore | 2 - Makefile | 12 ++-- easypost/requestor.py | 1 + .../services/referral_customer_service.py | 1 + pyproject.toml | 70 ++++++++++++++++++ setup.py | 72 ------------------- tests/conftest.py | 1 + tests/test_address.py | 1 + tests/test_api_key.py | 1 + tests/test_base_service.py | 1 + tests/test_batch.py | 1 + tests/test_beta_rate.py | 1 + tests/test_beta_referral_customer.py | 1 + tests/test_billing.py | 3 +- tests/test_carrier_account.py | 1 + tests/test_claim.py | 1 + tests/test_customs_info.py | 1 + tests/test_customs_item.py | 1 + tests/test_easypost_client.py | 1 + tests/test_end_shipper.py | 1 + tests/test_error.py | 1 + tests/test_event.py | 1 + tests/test_insurance.py | 1 + tests/test_order.py | 1 + tests/test_parcel.py | 1 + tests/test_pickup.py | 1 + tests/test_rate.py | 1 + tests/test_referral_customer.py | 1 + tests/test_refund.py | 1 + tests/test_report.py | 1 + tests/test_scan_form.py | 1 + tests/test_shipment.py | 1 + tests/test_tracker.py | 1 + tests/test_user.py | 1 + tests/test_webhook.py | 1 + 35 files changed, 108 insertions(+), 81 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 88f80afd..4a55e336 100644 --- a/.gitignore +++ b/.gitignore @@ -25,5 +25,3 @@ Icon test venv virtualenv -/.flake8 -/pyproject.toml diff --git a/Makefile b/Makefile index 8b43916d..ba9871a0 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,11 @@ help: ## black - Runs the Black Python formatter against the project black: - $(VIRTUAL_BIN)/black $(PROJECT_NAME)/ $(TEST_DIR)/ --config examples/style_guides/python/pyproject.toml + $(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)/ --config examples/style_guides/python/pyproject.toml --check + $(VIRTUAL_BIN)/black $(PROJECT_NAME)/ $(TEST_DIR)/ --check ## build - Builds the project in preparation for release build: @@ -35,7 +35,7 @@ docs: ## flake8 - Lint the project with flake8 flake8: - $(VIRTUAL_BIN)/flake8 $(PROJECT_NAME)/ $(TEST_DIR)/ --append-config examples/style_guides/python/.flake8 + $(VIRTUAL_BIN)/flake8 $(PROJECT_NAME)/ $(TEST_DIR)/ ## init-examples-submodule - Initialize the examples submodule init-examples-submodule: @@ -54,11 +54,11 @@ update-examples-submodule: ## isort - Sorts imports throughout the project isort: - $(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ $(TEST_DIR)/ --settings-file examples/style_guides/python/pyproject.toml + $(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)/ --settings-file examples/style_guides/python/pyproject.toml --check-only + $(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ $(TEST_DIR)/ --check-only ## lint - Run linters on the project lint: black-check isort-check flake8 mypy scan @@ -68,7 +68,7 @@ lint-fix: black isort ## mypy - Run mypy type checking on the project mypy: - $(VIRTUAL_BIN)/mypy $(PROJECT_NAME)/ $(TEST_DIR)/ --config-file examples/style_guides/python/pyproject.toml --install-types --non-interactive + $(VIRTUAL_BIN)/mypy $(PROJECT_NAME)/ $(TEST_DIR)/ --install-types --non-interactive ## release - Cuts a release for the project on GitHub (requires GitHub CLI) # tag = The associated tag title of the release diff --git a/easypost/requestor.py b/easypost/requestor.py index 9f22b9e4..5b92ba74 100644 --- a/easypost/requestor.py +++ b/easypost/requestor.py @@ -14,6 +14,7 @@ from urllib.parse import urlencode import requests + from easypost.constant import ( API_VERSION, COMMUNICATION_ERROR, diff --git a/easypost/services/referral_customer_service.py b/easypost/services/referral_customer_service.py index ff74bce7..17a3c533 100644 --- a/easypost/services/referral_customer_service.py +++ b/easypost/services/referral_customer_service.py @@ -5,6 +5,7 @@ ) import requests + from easypost.constant import ( _FILTERS_KEY, SEND_STRIPE_DETAILS_ERROR, diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..aa935e8d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,70 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "easypost" +description = "EasyPost Shipping API Client Library for Python" +version = "10.3.0" +readme = "README.md" +requires-python = ">=3.9" +license = { file = "LICENSE" } +authors = [{ name = "EasyPost", email = "support@easypost.com" }] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Programming Language :: Python", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Libraries", +] +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-cov == 6.*", + "pytest-vcr == 1.*", + "pytest == 8.*", + "vcrpy == 7.*", +] } +[project.urls] +Docs = "https://docs.easypost.com" +Tracker = "https://github.com/EasyPost/easypost-python/issues" +Source = "https://github.com/EasyPost/easypost-python" + +[tool.setuptools.packages.find] +exclude = ["docs", "examples", "tests"] + +[tool.setuptools.package-data] +easypost = ["py.typed"] + +[tool.black] +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" diff --git a/setup.py b/setup.py deleted file mode 100644 index 732e0b28..00000000 --- a/setup.py +++ /dev/null @@ -1,72 +0,0 @@ -from setuptools import ( - find_packages, - setup, -) - - -REQUIREMENTS = [ - "requests >= 2.4.3", -] - -DEV_REQUIREMENTS = [ - "bandit==1.8.*", - "black==25.*", - "build==1.2.*", - "flake8==6.*", - "isort==6.*", - "mypy==1.15.*", - "pdoc==15.*", - "pytest-cov==6.*", - "pytest-vcr==1.*", - "pytest==8.*", - "vcrpy==7.*", -] - -with open("README.md", encoding="utf-8") as f: - long_description = f.read() - -setup( - name="easypost", - version="10.3.0", - description="EasyPost Shipping API Client Library for Python", - author="EasyPost", - author_email="support@easypost.com", - url="https://easypost.com/", - packages=find_packages( - exclude=[ - "docs", - "examples", - "tests", - ] - ), - install_requires=REQUIREMENTS, - extras_require={ - "dev": DEV_REQUIREMENTS, - }, - package_data={ - "easypost": ["py.typed"], - }, - test_suite="test", - long_description=long_description, - long_description_content_type="text/markdown", - project_urls={ - "Docs": "https://docs.easypost.com", - "Tracker": "https://github.com/EasyPost/easypost-python/issues", - "Source": "https://github.com/EasyPost/easypost-python", - }, - python_requires=">=3.9, <4", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Programming Language :: Python", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "License :: OSI Approved :: MIT License", - "Topic :: Software Development :: Libraries", - ], -) diff --git a/tests/conftest.py b/tests/conftest.py index 1e7d5bea..4fb5daca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,6 +8,7 @@ ) import pytest + from easypost.easypost_client import EasyPostClient diff --git a/tests/test_address.py b/tests/test_address.py index 346a9309..ff2a71ac 100644 --- a/tests/test_address.py +++ b/tests/test_address.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_api_key.py b/tests/test_api_key.py index fa63fc2c..07764d6e 100644 --- a/tests/test_api_key.py +++ b/tests/test_api_key.py @@ -1,4 +1,5 @@ import pytest + from easypost.models import ApiKey diff --git a/tests/test_base_service.py b/tests/test_base_service.py index 35770d87..766ba73a 100644 --- a/tests/test_base_service.py +++ b/tests/test_base_service.py @@ -1,6 +1,7 @@ from unittest.mock import patch import pytest + from easypost.constant import NO_MORE_PAGES_ERROR from easypost.errors import EndOfPaginationError diff --git a/tests/test_batch.py b/tests/test_batch.py index c0d38b5e..9e7ddee2 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -3,6 +3,7 @@ import time import pytest + from easypost.models import Batch diff --git a/tests/test_beta_rate.py b/tests/test_beta_rate.py index 8c228fbf..6d1e579d 100644 --- a/tests/test_beta_rate.py +++ b/tests/test_beta_rate.py @@ -1,4 +1,5 @@ import pytest + from easypost.util import get_lowest_stateless_rate diff --git a/tests/test_beta_referral_customer.py b/tests/test_beta_referral_customer.py index fbeea445..4860ddf8 100644 --- a/tests/test_beta_referral_customer.py +++ b/tests/test_beta_referral_customer.py @@ -1,4 +1,5 @@ import pytest + from easypost.errors.api.api_error import ApiError diff --git a/tests/test_billing.py b/tests/test_billing.py index fa6adcd2..320dbb4b 100644 --- a/tests/test_billing.py +++ b/tests/test_billing.py @@ -1,7 +1,8 @@ from unittest.mock import patch -import easypost import pytest + +import easypost from easypost.errors import InvalidObjectError diff --git a/tests/test_carrier_account.py b/tests/test_carrier_account.py index 57554394..edf6f976 100644 --- a/tests/test_carrier_account.py +++ b/tests/test_carrier_account.py @@ -1,4 +1,5 @@ import pytest + from easypost.errors.api.api_error import ApiError from easypost.models import CarrierAccount diff --git a/tests/test_claim.py b/tests/test_claim.py index 1cc38f3b..7f474901 100644 --- a/tests/test_claim.py +++ b/tests/test_claim.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_customs_info.py b/tests/test_customs_info.py index 6a7cf925..34a49ca3 100644 --- a/tests/test_customs_info.py +++ b/tests/test_customs_info.py @@ -1,4 +1,5 @@ import pytest + from easypost.models import CustomsInfo diff --git a/tests/test_customs_item.py b/tests/test_customs_item.py index 15de1738..2427394e 100644 --- a/tests/test_customs_item.py +++ b/tests/test_customs_item.py @@ -1,4 +1,5 @@ import pytest + from easypost.models import CustomsItem diff --git a/tests/test_easypost_client.py b/tests/test_easypost_client.py index 5609484b..20721d83 100644 --- a/tests/test_easypost_client.py +++ b/tests/test_easypost_client.py @@ -3,6 +3,7 @@ import pytest import requests + from easypost.easypost_client import EasyPostClient from easypost.errors import TimeoutError diff --git a/tests/test_end_shipper.py b/tests/test_end_shipper.py index cd27936d..8602810c 100644 --- a/tests/test_end_shipper.py +++ b/tests/test_end_shipper.py @@ -1,4 +1,5 @@ import pytest + from easypost.models import EndShipper diff --git a/tests/test_error.py b/tests/test_error.py index 99c5ebc4..32c77849 100644 --- a/tests/test_error.py +++ b/tests/test_error.py @@ -1,4 +1,5 @@ import pytest + from easypost.errors.api.api_error import ApiError diff --git a/tests/test_event.py b/tests/test_event.py index 5abf7c7f..d7f5eebb 100644 --- a/tests/test_event.py +++ b/tests/test_event.py @@ -3,6 +3,7 @@ import time import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_insurance.py b/tests/test_insurance.py index 98ca885a..20f4b18d 100644 --- a/tests/test_insurance.py +++ b/tests/test_insurance.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_order.py b/tests/test_order.py index 4e556179..a500b9c2 100644 --- a/tests/test_order.py +++ b/tests/test_order.py @@ -1,4 +1,5 @@ import pytest + from easypost.errors import FilteringError from easypost.models import ( Order, diff --git a/tests/test_parcel.py b/tests/test_parcel.py index 0faee13c..acfdb858 100644 --- a/tests/test_parcel.py +++ b/tests/test_parcel.py @@ -1,4 +1,5 @@ import pytest + from easypost.models import Parcel diff --git a/tests/test_pickup.py b/tests/test_pickup.py index f142c4f0..9a6d90b2 100644 --- a/tests/test_pickup.py +++ b/tests/test_pickup.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_rate.py b/tests/test_rate.py index cf482464..993c9bd5 100644 --- a/tests/test_rate.py +++ b/tests/test_rate.py @@ -1,4 +1,5 @@ import pytest + from easypost.models import Rate diff --git a/tests/test_referral_customer.py b/tests/test_referral_customer.py index 19305081..da4dbbd6 100644 --- a/tests/test_referral_customer.py +++ b/tests/test_referral_customer.py @@ -2,6 +2,7 @@ from unittest.mock import patch import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_refund.py b/tests/test_refund.py index 359758ee..16a751ce 100644 --- a/tests/test_refund.py +++ b/tests/test_refund.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_report.py b/tests/test_report.py index 5aa61bd8..cda07a2b 100644 --- a/tests/test_report.py +++ b/tests/test_report.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_scan_form.py b/tests/test_scan_form.py index 09e7509e..2a87d728 100644 --- a/tests/test_scan_form.py +++ b/tests/test_scan_form.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_shipment.py b/tests/test_shipment.py index ec98ca69..3d557352 100644 --- a/tests/test_shipment.py +++ b/tests/test_shipment.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_tracker.py b/tests/test_tracker.py index afc71c0f..2554feb9 100644 --- a/tests/test_tracker.py +++ b/tests/test_tracker.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _FILTERS_KEY, _TEST_FAILED_INTENTIONALLY_ERROR, diff --git a/tests/test_user.py b/tests/test_user.py index d407764c..deab7f4a 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -1,4 +1,5 @@ import pytest + from easypost.constant import ( _TEST_FAILED_INTENTIONALLY_ERROR, NO_MORE_PAGES_ERROR, diff --git a/tests/test_webhook.py b/tests/test_webhook.py index 021ae77a..13c5e648 100644 --- a/tests/test_webhook.py +++ b/tests/test_webhook.py @@ -1,4 +1,5 @@ import pytest + from easypost.errors import SignatureVerificationError from easypost.models import Webhook from easypost.util import validate_webhook From 0183b903950fe48977c1cdf16bade1b67ccdb805 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Fri, 9 Jan 2026 13:43:23 -0700 Subject: [PATCH 2/2] chore: add missing newline --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index aa935e8d..aa8150b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ optional-dependencies = { dev = [ "pytest == 8.*", "vcrpy == 7.*", ] } + [project.urls] Docs = "https://docs.easypost.com" Tracker = "https://github.com/EasyPost/easypost-python/issues"