diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 36d58e9e3..9b27f4215 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,19 +2,54 @@ name: Continuous Delivery on: push: - tags: 'demo' + tags: 'v*' # push events to matching v*, i.e. v1.0, v20.15.10 + +env: + PYTHON_DEFAULT_VERSION: 3.8 jobs: - demo: + deploy: + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + B2_PYPI_PASSWORD: ${{ secrets.B2_PYPI_PASSWORD }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.8 + - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: ${{ env.PYTHON_DEFAULT_VERSION }} - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Install dependencies run: python -m pip install --upgrade nox pip - + - name: Build the distribution + id: build + run: nox -vs build + - name: Read the Changelog + id: read-changelog + uses: mindsers/changelog-reader-action@v1 + with: + version: ${{ steps.build.outputs.version }} + - name: Create GitHub release + id: create-release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref }} + release_name: ${{ steps.build.outputs.version }} + body: ${{ steps.read-changelog.outputs.log_entry }} + draft: false + prerelease: false + - name: Upload the distribution to GitHub + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: ${{ steps.build.outputs.asset_path }} + asset_name: ${{ steps.build.outputs.asset_name }} + asset_content_type: application/gzip + - name: Upload the distribution to PyPI + if: ${{ env.B2_PYPI_PASSWORD != '' }} + uses: pypa/gh-action-pypi-publish@v1.3.1 + with: + user: __token__ + password: ${{ env.B2_PYPI_PASSWORD }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..6d717279d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,89 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +### Added +* Support for bucket to bucket sync + +### Removed +* Drop Python 2 and Python 3.4 support :tada: +* Remove `--prefix` from `ls` (it didn't really work, use `folderName` argument) + +## [1.1.4] - 2020-07-15 +### Added +* Allow specifying custom realm in B2Session.authorize_account + +## [1.1.2] - 2020-07-06 +### Fixed +* Fix upload part for file range on Python 2.7 + +## [1.1.0] - 2020-06-24 +### Added +* Add `list_file_versions` method to buckets. +* Add server-side copy support for large files +* Add ability to synthesize objects from local and remote sources +* Add AuthInfoCache, InMemoryCache and AbstractCache to public interface +* Add ability to filter in ScanPoliciesManager based on modification time +* Add ScanPoliciesManager and SyncReport to public interface +* Add md5 checksum to FileVersionInfo +* Add more keys to dicts returned by as_dict() methods + +### Changed +* Make sync treat hidden files as deleted +* Ignore urllib3 "connection pool is full" warning + +### Removed +* Remove arrow warnings caused by https://github.com/crsmithdev/arrow/issues/612 + +### Fixed +* Fix handling of modification time of files + +## [1.0.2] - 2019-10-15 +### Changed +* Remove upper version limit for arrow dependency + +## [1.0.0] - 2019-10-03 +### Fixed +* Minor bug fix. + +## [1.0.0-rc1] - 2019-07-09 +### Deprecated +* Deprecate some transitional method names to v0 in preparation for v1.0.0. + +## [0.1.10] - 2019-07-09 +### Removed +* Remove a parameter (which did nothing, really) from `b2sdk.v1.Bucket.copy_file` signature + +## [0.1.8] - 2019-06-28 +### Added +* Add support for b2_copy_file +* Add support for `prefix` parameter on ls-like calls + +## [0.1.6] - 2019-04-24 +### Changed +* Rename account ID for authentication to application key ID. +Account ID is still backwards compatible, only the terminology +has changed. + +### Fixed +* Fix transferer crashing on empty file download attempt + + +## [0.1.4] - 2019-04-04 +### Added +Initial official release of SDK as a separate package (until now it was a part of B2 CLI) + +[Unreleased]: https://github.com/Backblaze/b2-sdk-python/compare/v1.1.4...HEAD +[1.1.4]: https://github.com/Backblaze/b2-sdk-python/compare/v1.1.2...v1.1.4 +[1.1.2]: https://github.com/Backblaze/b2-sdk-python/compare/v1.1.0...v1.1.2 +[1.1.0]: https://github.com/Backblaze/b2-sdk-python/compare/v1.0.2...v1.1.0 +[1.0.2]: https://github.com/Backblaze/b2-sdk-python/compare/v1.0.0...v1.0.2 +[1.0.0]: https://github.com/Backblaze/b2-sdk-python/compare/v1.0.0-rc1...v1.0.0 +[1.0.0-rc1]: https://github.com/Backblaze/b2-sdk-python/compare/v0.1.10...v1.0.0-rc1 +[0.1.10]: https://github.com/Backblaze/b2-sdk-python/compare/v0.1.8...v0.1.10 +[0.1.8]: https://github.com/Backblaze/b2-sdk-python/compare/v0.1.6...v0.1.8 +[0.1.6]: https://github.com/Backblaze/b2-sdk-python/compare/v0.1.4...v0.1.6 +[0.1.4]: https://github.com/Backblaze/b2-sdk-python/compare/4fd290c...v0.1.4 diff --git a/MANIFEST.in b/MANIFEST.in index c9134ed81..a7da3fcb4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,2 @@ -include README.md include requirements.txt include LICENSE diff --git a/README.md b/README.md index a69274797..0def9ecfa 100644 --- a/README.md +++ b/README.md @@ -30,84 +30,9 @@ Therefore when setting up b2sdk as a dependency, please make sure to match the v b2sdk>=0.0.0,<1.0.0 ``` - # Release History -## Not released yet - -* Drop Python 2 and Python 3.4 support :tada: -* Support for bucket to bucket sync - -## 1.1.4 (2020-07-15) - -* Allow specifying custom realm in B2Session.authorize_account - -## 1.1.2 (2020-07-06) - -* Fix upload part for file range on Python 2.7 - -## 1.1.0 (2020-06-24) - -* Make sync treat hidden files as deleted -* Remove arrow warnings caused by https://github.com/crsmithdev/arrow/issues/612 -* Add `list_file_versions` method to buckets. -* Add server-side copy support for large files -* Add ability to synthesize objects from local and remote sources -* Add AuthInfoCache, InMemoryCache and AbstractCache to public interface -* Ignore urllib3 "connection pool is full" warning -* Add ability to filter in ScanPoliciesManager based on modification time -* Add ScanPoliciesManager and SyncReport to public interface -* Add md5 checksum to FileVersionInfo -* Add more keys to dicts returned by as_dict() methods -* Fix handling of modification time of files - -## 1.0.2 (2019-10-15) - -Changes: - -* Remove upper version limit for arrow dependency - -## 1.0.0 (2019-10-03) - -Changes: - -* Minor bug fix. - -## 1.0.0-rc1 (2019-07-09) - -Changes: - -* Deprecate some transitional method names to v0 in preparation for v1.0.0. - -## 0.1.10 (2019-07-09) - -Changes: - -* Remove a parameter (which did nothing, really) from `b2sdk.v1.Bucket.copy_file` signature - - -## 0.1.8 (2019-06-28) - -Changes: - -* Add support for b2_copy_file -* Add support for `prefix` parameter on ls-like calls - - -## 0.1.6 (2019-04-24) - -Changes: - -* Fix transferer crashing on empty file download attempt -* Rename account ID for authentication to application key ID. -Account ID is still backwards compatible, only the terminology -has changed. - - -## 0.1.4 (2019-04-04) - -Initial official release of SDK as a separate package (until now it was a part of B2 CLI) - +Please refer to the [changelog](CHANGELOG.md). # Developer Info diff --git a/README.release.md b/README.release.md index c2080c148..6f4e3ac5a 100644 --- a/README.release.md +++ b/README.release.md @@ -3,23 +3,27 @@ - Get the Nox: - `pip install -U nox` - Bump the version number to an even number in `b2sdk/version.py`. -- Update the release history in `README.md` by changing "not released yet" to the current date for this release. +- Update the release history in `CHANGELOG.md`: + - Change "Unreleased" to the current release version and date. + - Create empty "Unreleased" section. + - Add proper link to the new release (at the bottom of the file). Use GitHub [compare feature](https://docs.github.com/en/free-pro-team@latest/github/committing-changes-to-your-project/comparing-commits#comparing-tags) between two tags. + - Update "Unreleased" link (at the bottom of the file). - Run linters and tests: - `export B2_TEST_APPLICATION_KEY=your_app_key` - `export B2_TEST_APPLICATION_KEY_ID=your_app_key_id` - `nox -x` - Build docs locally: - `nox --non-interactive -xs doc` -- Commit and push to GitHub, then wait for build to complete successfully. +- Commit and push to GitHub, then wait for CI workflow to complete successfully. - No need to make a branch. Push straight to `master`. - Tag in git and push tag to origin. (Version tags look like "v0.4.6".) - - `git tag vx.x.x` - - `git push origin vx.x.x` -- Build the distribution and upload to PyPI. - - `nox -xs build deploy` -- Install using pip and verify that it gets the correct version. -- Update for dev + - `git tag vx.x.x` + - `git push origin vx.x.x` +- Wait for CD workflow to complete successfully. + - Verify that the GitHub release is created + - Verify that the release has been uploaded to the PyPI +- Install using pip and verify that it gets the correct version: + - `pip install -U b2sdk` +- Update for dev: - Bump the version number to an odd number (for example: 1.0.2 -> 1.0.3) - - Add a "not released yet" section in the release history, like: 0.8.5 (not released yet) - - Commit the changes -- Push to GitHub again. + - Commit the changes and push to GitHub again. diff --git a/doc/source/quick_start.rst b/doc/source/quick_start.rst index 5b018c333..c7c9650bc 100644 --- a/doc/source/quick_start.rst +++ b/doc/source/quick_start.rst @@ -133,7 +133,7 @@ File actions .. tip:: Sync is the preferred way of getting files into and out of B2 cloud, because it can achieve *highest performance* due to parallelization of scanning and data transfer operations. - To learn more about sync, see `Sync `_. + To learn more about sync, see :ref:`sync`. Use the functions described below only if you *really* need to transfer a single file. @@ -282,7 +282,7 @@ Get file metadata Copy file ========= -Please switch to :meth:`b2sdk.v2.Bucket.copy`. +Please switch to :meth:`b2sdk.v1.Bucket.copy`. .. code-block:: python diff --git a/doc/source/tutorial.rst b/doc/source/tutorial.rst index e582169cb..3e13a5ca2 100644 --- a/doc/source/tutorial.rst +++ b/doc/source/tutorial.rst @@ -29,6 +29,8 @@ Account authorization .. code-block:: python + >>> from b2sdk.v1 import B2Api + >>> b2_api = B2Api(info) >>> application_key_id = '4a5b6c7d8e9f' >>> application_key = '001b8e23c26ff6efb941e237deb182b9599a84bef7' >>> b2_api.authorize_account("production", application_key_id, application_key) diff --git a/noxfile.py b/noxfile.py index da7e80456..0d83a20e1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -10,6 +10,7 @@ import os import subprocess +from glob import glob import nox @@ -147,12 +148,16 @@ def build(session): session.run('rm', '-rf', 'build', 'dist', 'b2sdk.egg-info', external=True) session.run('python', 'setup.py', 'sdist', *session.posargs) + # Set outputs for GitHub Actions + if CI: + asset_path = glob('dist/*')[0] + print('::set-output name=asset_path::', asset_path, sep='') -@nox.session(python=PYTHON_DEFAULT_VERSION) -def deploy(session): - """Deploy the distribution to the PyPi.""" - session.install('twine') - session.run('twine', 'upload', 'dist/*') + asset_name = os.path.basename(asset_path) + print('::set-output name=asset_name::', asset_name, sep='') + + version = os.environ['GITHUB_REF'].replace('refs/tags/v', '') + print('::set-output name=version::', version, sep='') @nox.session(python=PYTHON_DEFAULT_VERSION) diff --git a/setup.py b/setup.py index 08b2eb769..609e5b90b 100644 --- a/setup.py +++ b/setup.py @@ -117,7 +117,7 @@ # If there are data files included in your packages that need to be # installed, specify them here. - package_data={'b2sdk': ['requirements.txt']}, + package_data={'b2sdk': ['requirements.txt', 'LICENSE']}, # Although 'package_data' is the preferred approach, in some case you may # need to place data files outside of your packages. See: