diff --git a/CHANGELOG.md b/CHANGELOG.md index 81157874..eb7c280d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,270 +1,259 @@ -## CHANGELOG +# CHANGELOG -### NEXT RELEASE +## v7.0.0 (2022-04-14) -* Bumps minimum Python version from 2.7 to 3.6 -* Bumps all dependencies -* Add the `update_brand()` method to the User object -* Removes `_max_timeout` and instead uses a flat 60-second timeout for requests -* Adds Python version to user-agent header on requests -* Removes `shipment.get_rates()` method since the shipment object already has rates. If you need to get new rates for a shipment, please use the `shipment.regenerate_rates()` method. -* Add `retrieve_me()` convenience function that allow users to retrieve without specifying an ID. -* Remove `blob` class since it's never being used -* Remove `track_with_code` in shipment class since it's no longer being used -* Add support for `columns` and `additional_columns` on Report creation -* Must pass a list object to `Shipment.lowest_rate()` rather than a comma-separated list -* Removes the unusable `carrier` param from `Address.create_and_verify()` along with the dead `message` conditional check +Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md). -### v6.0.0 2021-10-12 +### Breaking Changes -* JSON encodes POST bodies instead of form encoding them -* Adds support for `tax_identifiers` -* Black formatting and iSort tools added to repo -* Bumps `requests` from v1 to v2 -* Various refactor efforts and code cleanup +- Bumps minimum Python version from 2.7 to 3.6 +- Bumps all dependencies +- Removes `shipment.get_rates()` method since the shipment object already has rates. If you need to get new rates for a shipment, please use the `shipment.regenerate_rates()` method. +- Removes `track_with_code` in shipment class since it's no longer being used +- Removes the unusable `carrier` param from `Address.create_and_verify()` along with the dead `message` conditional check +- Must pass a list object to `shipment.lowest_rate()` rather than a comma-separated list -### v5.1.3 2021-07-20 +### Features -* Remove 2015-vintage experimental "`all_updated`" action from trackers -* Correct references of `contact@easypost.com` to `support@easypost.com` -* Clean up address verify property and some miscellaneous request logic +- Adds the `update_brand()` method to the User object +- Adds Python version to user-agent header on requests +- Adds `retrieve_me()` convenience function that allow users to retrieve without specifying an ID. -### v5.1.2 2021-06-10 +### Chores -* Strips away the `result` key from SmartRate and simply returns an array of SmartRate objects +- Broke out the entire project into separate modules based on object +- Removes `_max_timeout` and instead uses a flat 60-second timeout for requests +- Added Makefile for much easier development management +- Added typehints throughout the project +- Consolidated all dependencies from various requirements files to `setup.py` +- Added a comprehensive test suite that tests all interfaces of the project +- Documented each interface of the project via docstrings -### 5.1.1 2021-05-18 +## v6.0.0 (2021-10-12) -* fix: stops appending smartrates to Shipment object +Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md). -### 5.1.0 2021-05-14 +- JSON encodes POST bodies instead of form encoding them +- Adds support for `tax_identifiers` +- Black formatting and iSort tools added to repo +- Bumps `requests` from v1 to v2 +- Various refactor efforts and code cleanup -* Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates()` on a shipment) +## v5.1.3 (2021-07-20) -### 5.0.0 2020-08-10 +- Remove 2015-vintage experimental "`all_updated`" action from trackers +- Correct references of `contact@easypost.com` to `support@easypost.com` +- Clean up address verify property and some miscellaneous request logic -* Add `all` method for retrieving Events -* _[backwards-compatibility break]_ Remove `all` method for some un-supported types: CustomsItem, CustomsInfo, Pickup, and Order +## vv5.1.2 (2021-06-10) -### 4.1.0 2020-05-11 +- Strips away the `result` key from SmartRate and simply returns an array of SmartRate objects -* change tests to use [vcrpy](https://github.com/kevin1024/vcrpy) so they are more reliable -* add `original_exception` to `easypost.Error` in cases where we are re-raising an underlying error (e.g., an HTTP exception) -* fix a bunch of flake8 warnings -* [potentially-breaking] soft-deprecate Python 3.3 and 3.4. these have been dropped by most of the libraries we use, so probably don't work anyway. -* Swap GET to POST on Refund method +## v5.1.1 (2021-05-18) -### 4.0.2 2020-05-05 +- fix: stops appending smartrates to Shipment object -* cleaned up how the `__version__` attribute is populated to no longer throw warnings (#95, #98, #104) -* added some misding reports -* fix stale tests -* move testing infrastructure from travis-ci.org to travis-ci.com +## v5.1.0 (2021-05-14) -### 4.0.1 2020-03-06 +- Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates()` on a shipment) -* Fixed a bug that would not create reports properly -* Fixed stale unit tests +## v5.0.0 (2020-08-10) -### 4.0.0 2019-07-09 +- Add `all` method for retrieving Events +- _[backwards-compatibility break]_ Remove `all` method for some un-supported types: CustomsItem, CustomsInfo, Pickup, and Order -* Update some `setup.py` fields -* Formally remove Python 2.6 support (which has been broken for several years) +## v4.1.0 (2020-05-11) -### 3.6.5 2019-07-09 +- change tests to use [vcrpy](https://github.com/kevin1024/vcrpy) so they are more reliable +- add `original_exception` to `easypost.Error` in cases where we are re-raising an underlying error (e.g., an HTTP exception) +- fix a bunch of flake8 warnings +- [potentially-breaking] soft-deprecate Python 3.3 and 3.4. these have been dropped by most of the libraries we use, so probably don't work anyway. +- Swap GET to POST on Refund method -* Fix broken pickup tests -* Fix broken reports tests -* Make tests run on Python 3.7 -* Fix typo in `install_requires` causing `six` to not be installed by pip (gh-84 from @roehnan) +## v4.0.2 (2020-05-05) -### 3.6.4 2018-04-09 (never actually released) -* Update user tests +- cleaned up how the `__version__` attribute is populated to no longer throw warnings (#95, #98, #104) +- added some misding reports +- fix stale tests +- move testing infrastructure from travis-ci.org to travis-ci.com -### 3.6.3 2018-02-05 +## v4.0.1 (2020-03-06) -* Fix issue with responses that contain an `api_key` field (gh-67) -* Fix tests to take into account new label fee +- Fixed a bug that would not create reports properly +- Fixed stale unit tests -### 3.6.2 2017-05-23 +## v4.0.0 (2019-07-09) -* Report.retrieve no longer requires a type to be passed +- Update some `setup.py` fields +- Formally remove Python 2.6 support (which has been broken for several years) -### 3.6.1 2017-05-09 +## v3.6.5 (2019-07-09) -* Modernize tests; make tests able to run in parallel; etc. -* Clarify in README and `setup.py` the supported Python versions -* Add top-level `timeout` variable for setting the HTTP timeout on requests +- Fix broken pickup tests +- Fix broken reports tests +- Make tests run on Python 3.7 +- Fix typo in `install_requires` causing `six` to not be installed by pip (gh-84 from @roehnan) -### 3.6.0 2017-04-04 +## v3.6.4 (2018-04-09) -* Changed Report CRUD signatures. requires report type to be passed +**NOTE:** This version was never released -### 3.5.2 2017-02-14 +- Update user tests -* Added `get_rates` method to Order objects +## v3.6.3 (2018-02-05) +- Fix issue with responses that contain an `api_key` field (gh-67) +- Fix tests to take into account new label fee -### 3.5.1 2017-01-19 +## v3.6.2 (2017-05-23) -* Fixed create for ScanForms +- Report.retrieve no longer requires a type to be passed +## v3.6.1 (2017-05-09) -### 3.5.0 2017-01-18 +- Modernize tests; make tests able to run in parallel; etc. +- Clarify in README and `setup.py` the supported Python versions +- Add top-level `timeout` variable for setting the HTTP timeout on requests -* Added basic CRUD methods for Webhook Objects -* Fixed Order test +## v3.6.0 (2017-04-04) +- Changed Report CRUD signatures. requires report type to be passed -### 3.4.0 2016-12-20 +## v3.5.2 (2017-02-14) -* Added session pooling +- Added `get_rates` method to Order objects +## v3.5.1 (2017-01-19) -### 3.3.0 2016-12-15 +- Fixed create for ScanForms -* Added support for Report objects +## v3.5.0 (2017-01-18) +- Added basic CRUD methods for Webhook Objects +- Fixed Order test -### 3.2.2 2016-07-29 +## v3.4.0 (2016-12-20) -* Added support for Insurance objects +- Added session pooling +## v3.3.0 (2016-12-15) -### 3.2.1 2016-07-18 +- Added support for Report objects -* Added `to_json` method for EasyPost object. Thanks ThePsyjo! +## v3.2.2 (2016-07-29) +- Added support for Insurance objects -### 3.2.0 2016-05-17 +## v3.2.1 (2016-07-18) -* Remove `api_keys` from object dumps -* Fixed address tests to keep them in line with the new API messages -* This was previously known as version 3.1.3 +- Added `to_json` method for EasyPost object. Thanks ThePsyjo! +## v3.2.0 (2016-05-17) -### 3.1.2 2016-03-04 +- Remove `api_keys` from object dumps +- Fixed address tests to keep them in line with the new API messages +- This was previously known as version 3.1.3 -* Added a suite of unittest tests. Thanks wyounas! +## v3.1.2 (2016-03-04) +- Added a suite of unittest tests. Thanks wyounas! -### 3.1.1 2016-02-12 +## v3.1.1 (2016-02-12) -* Added ability to interact with Users (create, retrieve and update) +- Added ability to interact with Users (create, retrieve and update) +## v3.1.0 (2015-12-08) -### 3.1.0 2015-12-08 +- Add verifications to Address.create -* Add verifications to Address.create +## v3.0.6 (2015-11-24) +- Added Blob.retrieve for fetching urls for blobs stored by EasyPost. -### 3.0.6 2015-11-24 +## v3.0.5 (2015-11-18) -* Added Blob.retrieve for fetching urls for blobs stored by EasyPost. +- Changed the interface on `Tracker.create_list` to return True rather than the + Trackers themselves +## v3.0.4 (2015-11-16) -### 3.0.5 2015-11-18 +- Minor bugfix -* Changed the interface on `Tracker.create_list` to return True rather than the -Trackers themselves +## v3.0.3 (2015-11-16) +- Added a `Tracker.all_updated` method for retrieving a large number of Trackers + by status or `tracking_details` updated datetime -### 3.0.4 2015-11-16 +## v3.0.2 (2015-11-10) -* Minor bugfix +- Added a `Tracker.create_list` method for creating a large number of Trackers + at once +## v3.0.1 (2015-11-04) -### 3.0.3 2015-11-16 +- Fixed some examples and added some new ones, particularly dealing with Tracker.all -* Added a `Tracker.all_updated` method for retrieving a large number of Trackers -by status or `tracking_details` updated datetime +## v3.0.0 (2015-10-19) +- Fixed bug where retrieving a shipment by tracking code or reference doesn't set the ID properly -### 3.0.2 2015-11-10 +## v2.0.16 (2015-08-10) -* Added a `Tracker.create_list` method for creating a large number of Trackers -at once +- Added ability to interact with carrier accounts (full CRUD) +## v2.0.15 (2015-07-31) -### 3.0.1 2015-11-04 +- Fixed bug with address verification url rendering -* Fixed some examples and added some new ones, particularly dealing with Tracker.all +## v2.0.14 (2015-03-30) +- Fix numerous bugs, including Python3 encoding -### 3.0.0 2015-10-19 +## v2.0.13 (2015-01-09) -* Fixed bug where retrieving a shipment by tracking code or reference doesn't set the ID properly +- Added python3 support +## v2.0.12 (2014-11-04) -### 2.0.16 2015-08-10 +- Added tracker to shipment response +- Added tracker example -* Added ability to interact with carrier accounts (full CRUD) +## v2.0.11 (2014-09-19) +- Added Order support. -### 2.0.15 2015-07-31 +## v2.0.10 (2014-09-10) -* Fixed bug with address verification url rendering +- Added Pickup cancellation method. -### 2.0.14 2015-03-30 +## v2.0.9 (2014-09-02) -* Fix numerous bugs, including Python3 encoding +- Added Pickup resource for scheduling pickups. +## v2.0.6 (2013-10-17) -### 2.0.13 2015-01-09 +- Added Event resource for webhook digestion. +- Added buy method to Batch. -* Added python3 support +## v2.0.5 (2013-09-22) +- Bug Fix: UTF-8 input handled more gracefully. -### 2.0.12 2014-11-04 +## v2.0.4 (2013-07-31) -* Added tracker to shipment response -* Added tracker example +- API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks. +## v2.0.3 (2013-07-23) -### 2.0.11 2014-09-19 +- API Addition: `Shipment.track_with_code` returns tracking details for any tracking code. -* Added Order support. +## v2.0.2 (2013-07-07) +- Bug fix: `address.create_and_verify` is now a classmethod. -### 2.0.10 2014-09-10 +## v2.0.1 (2013-07-05) -* Added Pickup cancellation method. - - -### 2.0.9 2014-09-02 - -* Added Pickup resource for scheduling pickups. - - -### 2.0.6 2013-10-17 - -* Added Event resource for webhook digestion. -* Added buy method to Batch. - - -### 2.0.5 2013-09-22 - -* Bug Fix: UTF-8 input handled more gracefully. - - -### 2.0.4 2013-07-31 - -* API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks. - - -### 2.0.3 2013-07-23 - -* API Addition: `Shipment.track_with_code` returns tracking details for any tracking code. - - -### 2.0.2 2013-07-07 - -* Bug fix: `address.create_and_verify` is now a classmethod. - - -### 2.0.1 2013-07-05 - -* Added function to Address to all creating and verifying at the same time. -* Add label function to Shipment to request specific label `file_formats` (pdf, epl2, zpl). -* Add insure function to Shipment. Add insurance to any shipment in one call! -* Fixed `shipment.get_rates` bug. +- Added function to Address to all creating and verifying at the same time. +- Add label function to Shipment to request specific label `file_formats` (pdf, epl2, zpl). +- Add insure function to Shipment. Add insurance to any shipment in one call! +- Fixed `shipment.get_rates` bug. diff --git a/Makefile b/Makefile index 8de32aec..b916e2d3 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ help: ## build - Builds the project in preparation for release build: - $(PYTHON_BINARY) setup.py sdist bdist_wheel + $(VIRTUAL_BIN)/python setup.py sdist bdist_wheel ## coverage - Test the project and generate an HTML coverage report coverage: @@ -18,11 +18,8 @@ coverage: ## clean - Remove the virtual environment and clear out .pyc files clean: - rm -rf $(VIRTUAL_ENV) + rm -rf $(VIRTUAL_ENV) dist/ build/ *.egg-info/ find . -name '*.pyc' -delete - rm -rf dist - rm -rf build - rm -rf *.egg-info ## black - Runs the Black Python formatter against the project black: @@ -39,13 +36,20 @@ format: black isort lint mypy format-check: black-check isort-check lint mypy ## install - Install the project locally -install: - $(PYTHON_BINARY) -m venv $(VIRTUAL_ENV) +install: | venv install-dev + +## install-dev - Install dev requirements +install-dev: | venv $(VIRTUAL_BIN)/pip install -e ."[dev]" -install-pypy: - $(PYTHON_BINARY) -m venv $(VIRTUAL_ENV) +## install-pypy - Install dev requirements for pypy +install-pypy: | venv $(VIRTUAL_BIN)/pip install -e ."[pypy_dev]" + +## install-release - Install release requirements +install-release: | venv + $(VIRTUAL_BIN)/pip install -e ."[release]" + ## isort - Sorts imports throughout the project isort: $(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ $(TEST_DIR)/ @@ -62,8 +66,16 @@ lint: mypy: $(VIRTUAL_BIN)/mypy $(PROJECT_NAME)/ $(TEST_DIR)/ +## publish - Publish the project to PyPI +publish: + $(VIRTUAL_BIN)/twine upload dist/* + ## test - Test the project test: $(VIRTUAL_BIN)/pytest -.PHONY: help build coverage clean black black-check format format-check install isort isort-check lint mypy test +## venv - Create the virtual environment +venv: + $(PYTHON_BINARY) -m venv $(VIRTUAL_ENV) + +.PHONY: help build coverage clean black black-check format format-check install install-dev install-pypy install-release isort isort-check lint mypy publish test diff --git a/README.md b/README.md index 52dd9eb6..567d199a 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ print(shipment) API Documentation can be found at: https://easypost.com/docs/api. +Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md). + ## Development ```bash diff --git a/UPGRADE_GUIDE.md b/UPGRADE_GUIDE.md new file mode 100644 index 00000000..013b0a7a --- /dev/null +++ b/UPGRADE_GUIDE.md @@ -0,0 +1,68 @@ +# Upgrade Guide + +Use the following guide to assist in the upgrade process of the `easypost-python` library between major versions. + +- [Upgrading from 6.x to 7.0](#upgrading-from-6x-to-70) +- [Upgrading from 5.x to 6.0](#upgrading-from-5x-to-60) + +## Upgrading from 6.x to 7.0 + +### 7.0 High Impact Changes + +- [Updating Dependencies](#70-updating-dependencies) +- [`shipment.lowest_rate()` Now Expects a List](#70-shipmentlowestrate-now-expects-a-list) + +### 7.0 Medium Impact Changes + +- [Removal of `get_rates()` Shipment Method](#70-removal-of-getrates-shipment-method) + +## 7.0 Updating Dependencies + +Likelihood of Impact: High + +**Python 3.6 Required** + +easypost-python now requires Python 3.6 or greater and has dropped support for Python 2. + +**Dependencies** + +All dependencies had minor version bumps. + +## 7.0 `shipment.lowest_rate()` Now Expects a List + +Previously the `shipment.lowest_rate()` function expected a comma separated string list of filter criteria (carriers and services). These params have been corrected to expect an actual list object. + +```python +# Previous expectation +shipment.lowest_rate(carriers="USPS,FedEx", services="...") + +# Current expectation +shipment.lowest_rate(carriers=["USPS", "FedEx"], services="...") +``` + +## 7.0 Removal of `get_rates()` Shipment Method + +Likelihood of Impact: Medium + +The HTTP method used for the `get_rates` endpoint at the API level has changed from `POST` to `GET` and will only retrieve rates for a shipment instead of regenerating them. A new `/rerate` endpoint has been introduced to replace this functionality; In this library, you can now call the `shipment.regenerate_rates()` method to regenerate rates. Due to the logic change, the `get_rates` method has been removed since a Shipment inherently already has rates associated. + +## Upgrading from 5.x to 6.0 + +### 6.0 High Impact Changes + +- [Updating Dependencies](#60-updating-dependencies) +- [JSON Encoded Bodies](#60-json-encoded-bodies) + +## 6.0 Updating Dependencies + +Likelihood of Impact: High + +**Dependencies** + +Bumps the `requests` library from v1 to v2. + +## 6.0 JSON Encoded Bodies + +Likelihood of Impact: High + +All `POST` and `PUT` request bodies are now JSON encoded instead of form-encoded. You may see subtle inconsistencies to how certain data types were previously sent to the API. We have taken steps to mitigate and test against these edge cases. diff --git a/easypost/version.py b/easypost/version.py index 42dcba82..3e815a09 100644 --- a/easypost/version.py +++ b/easypost/version.py @@ -1,4 +1,4 @@ -VERSION = "6.0.0" +VERSION = "7.0.0" elements = VERSION.split("-") numbers = [str(v) for v in elements[0].split(".")] diff --git a/setup.py b/setup.py index 1eff5ed5..9a292116 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ from setuptools import setup + REQUIREMENTS = [ "requests >= 2.4.3", - "typing-extensions" + "typing-extensions", ] DEV_REQUIREMENTS = [ @@ -22,12 +23,17 @@ "mypy", ] +RELEASE_REQUIREMENTS = [ + "twine==3.8.*", # Twine 4.0+ drops support for Python 3.6 + "wheel", +] + with open("README.md", encoding="utf-8") as f: long_description = f.read() setup( name="easypost", - version="6.0.0", + version="7.0.0", description="EasyPost Shipping API Client Library for Python", author="EasyPost", author_email="support@easypost.com", @@ -37,9 +43,10 @@ extras_require={ "dev": DEV_REQUIREMENTS + CPYTHON_DEV_REQUIREMENTS, "pypy_dev": DEV_REQUIREMENTS, # no cpython requirements + "release": RELEASE_REQUIREMENTS, }, package_data={ - 'easypost': ['py.typed'] + "easypost": ["py.typed"], }, test_suite="test", long_description=long_description,