Skip to content

Commit

Permalink
Release 0.9.0
Browse files Browse the repository at this point in the history
Add support for urllib3 2.x
  • Loading branch information
sigmavirus24 committed Feb 8, 2024
1 parent 4c400ba commit c5e5305
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 72 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish to PyPI

on:
push:
tags:
- "*"

permissions:
contents: read

jobs:
build:
name: "Build dists"
runs-on: "ubuntu-latest"
environment:
name: "publish"
outputs:
hashes: ${{ steps.hash.outputs.hashes }}

steps:
- name: "Checkout repository"
uses: "actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3"

- name: "Setup Python"
uses: "actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b"
with:
python-version: "3.x"

- name: "Install dependencies"
run: python -m pip install build==0.8.0

- name: "Build dists"
run: |
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \
python -m build
- name: "Generate hashes"
id: hash
run: |
cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)"
- name: "Upload dists"
uses: "actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce"
with:
name: "dist"
path: "dist/"
if-no-files-found: error
retention-days: 5

provenance:
needs: [build]
permissions:
actions: read
contents: write
id-token: write # Needed to access the workflow's OIDC identity.
uses: "slsa-framework/slsa-github-generator/.github/workflows/[email protected]"
with:
base64-subjects: "${{ needs.build.outputs.hashes }}"
upload-assets: true
compile-generator: true # Workaround for https://github.com/slsa-framework/slsa-github-generator/issues/1163

publish:
name: "Publish"
if: startsWith(github.ref, 'refs/tags/')
needs: ["build", "provenance"]
permissions:
contents: write
id-token: write
runs-on: "ubuntu-latest"

steps:
- name: "Download dists"
uses: "actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a"
with:
name: "dist"
path: "dist/"

- name: "Publish dists to PyPI"
uses: "pypa/gh-action-pypi-publish@48b317d84d5f59668bb13be49d1697e36b3ad009"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ docs/_build
tags
build/
dist/
.pytest_cache/*
4 changes: 3 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
History
=======

0.8.2 - 2018-10-21
0.9.0 - 2024-02-06
------------------

- Add support for urllib3 2.0
- Fix documentation
- Add support for binary serializer storage;
useful with custom serializers (such as pickle based),
however all builtin betamax serializers remain text based.
Expand Down
71 changes: 70 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,71 @@
[wheel]
[metadata]
name = betamax
version = attr: betamax.__version__
description = A VCR imitation for python-requests
long_description = file: README.rst
long_description_content_type = text/x-rst
url = https://github.com/sigmavirus24/betamax
author = Ian Stapleton Cordasco
author_email = [email protected]
license = Apache-2.0
license_files = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Quality Assurance

[options]
packages = find:
include_package_data = True
install_requires =
requests >= 2.0
python_requires = >=3.8.1
package_dir =
=src

[options.packages.find]
where = src
exclude =
tests
tests.integration

[options.package_data]
* = LICENSE AUTHORS.rst HISTORY.rst README.rst

[options.entry_points]
pytest11 =
pytest-betamax = betamax.fixtures.pytest

[bdist_wheel]
universal = 1

[coverage:run]
source =
betamax
tests
plugins = covdefaults

#[coverage:report]
#fail_under = 70

#[mypy]
#check_untyped_defs = true
#disallow_any_generics = true
#disallow_incomplete_defs = true
#disallow_untyped_defs = true
#no_implicit_optional = true
#warn_unused_ignores = true
#
#[mypy-tests.*]
#disallow_untyped_defs = false
67 changes: 1 addition & 66 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,69 +1,4 @@
"""Packaging logic for betamax."""
import os
import re
import sys

import setuptools

packages = setuptools.find_packages(
"src",
exclude=["tests", "tests.integration"],
)
requires = ["requests >= 2.0"]

__version__ = ""
with open("src/betamax/__init__.py", "r") as fd:
reg = re.compile(r"__version__ = [\'']([^\'']*)[\'']")
for line in fd:
m = reg.match(line)
if m:
__version__ = m.group(1)
break

if not __version__:
raise RuntimeError("Cannot find version information")

if sys.argv[-1] in ["submit", "publish"]:
os.system("python setup.py sdist bdist_wheel upload")
sys.exit()


def data_for(filename):
"""Read the file data for a filename."""
with open(filename) as fd:
content = fd.read()
return content


setuptools.setup(
name="betamax",
version=__version__,
description="A VCR imitation for python-requests",
long_description="\n\n".join([data_for("README.rst"),
data_for("HISTORY.rst")]),
license="Apache 2.0",
author="Ian Stapleton Cordasco",
author_email="[email protected]",
url="https://github.com/sigmavirus24/betamax",
packages=packages,
package_dir={"": "src"},
package_data={"": ["LICENSE", "AUTHORS.rst"]},
include_package_data=True,
install_requires=requires,
entry_points={
"pytest11": ["pytest-betamax = betamax.fixtures.pytest"]
},
python_requires='>=3.8',
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
]
)
setuptools.setup()
4 changes: 2 additions & 2 deletions src/betamax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
__all__ = ('BetamaxError', 'Betamax', 'BaseMatcher', 'BaseSerializer',
'use_cassette')
__author__ = 'Ian Stapleton Cordasco'
__copyright__ = 'Copyright 2013-2018 Ian Stapleton Cordasco'
__copyright__ = 'Copyright 2013- Ian Stapleton Cordasco'
__license__ = 'Apache 2.0'
__title__ = 'betamax'
__version__ = '0.8.2'
__version__ = '0.9.0'
__version_info__ = tuple(int(i) for i in __version__.split('.'))
1 change: 1 addition & 0 deletions tests/cassettes/FakeBetamaxTestCase.test_fake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"http_interactions": [], "recorded_with": "betamax/0.8.2"}
1 change: 1 addition & 0 deletions tests/cassettes/test_record_once.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"http_interactions": [], "recorded_with": "betamax/0.8.2"}
10 changes: 8 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ deps =
flake8-docstrings
commands = flake8 {posargs} src/betamax

[testenv:build]
deps =
build
commands =
python -m build

[testenv:release]
deps =
twine >= 1.5.0
wheel
{[testenv:build]deps}
commands =
python setup.py sdist bdist_wheel
{[testenv:build]commands}
twine upload --skip-existing {posargs} dist/*

[testenv:docs]
Expand Down

0 comments on commit c5e5305

Please sign in to comment.