Skip to content

Commit

Permalink
PYTHON-3882 [python-bsonjs] Support Python 3.7-3.12 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Jul 31, 2023
1 parent eb31188 commit f5d7af2
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 61 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
env:
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_TEST_SKIP: '*universal2:arm64'
CIBW_BUILD: "cp36-macosx_x86_64 cp38-macosx_universal2 cp36-win* cp36-manylinux_{x86_64,i686}"
CIBW_BUILD: "cp37-macosx_x86_64 cp38-macosx_universal2 cp37-win* cp37-manylinux_{x86_64,i686}"
- uses: actions/upload-artifact@v2
with:
name: python_bsonjs-3.6-${{ matrix.os }}-wheel
name: python_bsonjs-3.7-${{ matrix.os }}-wheel
path: ./wheelhouse/*.whl
if-no-files-found: error
test-non-linux-wheels:
Expand All @@ -38,17 +38,18 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-2019]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
name: Test CPython ${{ matrix.python-version }}-${{ matrix.os }}
steps:
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Download a previously created wheel
uses: actions/download-artifact@v2
with:
name: python_bsonjs-3.6-${{ matrix.os }}-wheel
name: python_bsonjs-3.7-${{ matrix.os }}-wheel
- name: Test wheel
shell: bash
run: |
Expand All @@ -64,14 +65,14 @@ jobs:
matrix:
os: [ubuntu-latest]
container: ['manylinux2014_i686', 'manylinux2014_x86_64']
python-version: ['cp36-cp36m', 'cp37-cp37m', 'cp38-cp38',
'cp39-cp39', 'cp310-cp310', 'cp311-cp311']
python-version: ['cp37-cp37m', 'cp38-cp38',
'cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312']
name: Test CPython ${{ matrix.python-version }}-${{ matrix.container }}
steps:
- name: Download a previously created wheel
uses: actions/download-artifact@v2
with:
name: python_bsonjs-3.6-${{ matrix.os }}-wheel
name: python_bsonjs-3.7-${{ matrix.os }}-wheel
- name: Test wheel
run: |
docker run --rm --volume `pwd`:/python quay.io/pypa/${{ matrix.container }} /bin/bash -c "/opt/python/${{ matrix.python-version }}/bin/python -m pip install -U pip && /opt/python/${{ matrix.python-version }}/bin/python -m pip install --find-links=/python/ --no-index python_bsonjs && /opt/python/${{ matrix.python-version }}/bin/python -m pip list | grep python-bsonjs && /opt/python/${{ matrix.python-version }}/bin/python -c 'from bsonjs import dumps'"
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-18.04, windows-2019]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
os: [macos-latest, ubuntu-latest, windows-2019]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# use pip rather than easy_install to install pymongo
- name: Install pymongo
run: |
python -m pip install pymongo
allow-prereleases: true
- name: Test with python
run: |
python -m pip install -e . -v
python setup.py test
python -m pip install -v -e ".[test]"
pytest
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ like so
Installing From Source
======================

python-bsonjs supports CPython 3.6+.
python-bsonjs supports CPython 3.7+.

Compiler
````````
Expand All @@ -119,7 +119,7 @@ You must build python-bsonjs separately for each version of Python. On
Windows this means you must use the same C compiler your Python version was
built with.

- Python 3.6 and up requires Microsoft Visual Studio 2015
- Windows build requires Microsoft Visual Studio 2015

Source
``````
Expand All @@ -133,12 +133,12 @@ Install

Once you have the source properly downloaded, build and install the package::

$ python setup.py install
$ pip install -v .

Test
````

To run the test suite::

$ python setup.py test
$ python -m pytest

42 changes: 42 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "python-bsonjs"
version = "0.3.0"
description = "A library for converting between BSON and JSON."
readme = "README.rst"
license = { file = "LICENSE" }
requires-python = ">=3.7"
authors = [
{ name = "Shane Harvey", email = "[email protected]" },
]
keywords = [
"BSON",
"JSON",
"PyMongo",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Homepage = "https://github.com/mongodb-labs/python-bsonjs"

[project.optional-dependencies]
test = ["pymongo>=4", "pytest"]
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

40 changes: 2 additions & 38 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,8 @@
import glob
import sys


from setuptools import setup, Extension

with open("README.rst") as f:
try:
description = f.read()
except Exception:
description = ""

tests_require = ["pymongo>=3.4.0"]

libraries = []
if sys.platform == "win32":
libraries.append("ws2_32")
Expand All @@ -34,34 +25,6 @@
libraries.append("rt")

setup(
name="python-bsonjs",
version="0.3.0",
description="A library for converting between BSON and JSON.",
long_description=description,
author="Shane Harvey",
author_email="[email protected]",
url="https://github.com/mongodb-labs/python-bsonjs",
keywords=["BSON", "JSON", "PyMongo"],
test_suite="test",
tests_require=tests_require,
license="Apache License, Version 2.0",
python_requires=">=3.6",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"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"],
ext_modules=[
Extension(
"bsonjs",
Expand All @@ -75,5 +38,6 @@
("Py_LIMITED_API", "0x03060000")],
libraries=libraries
)
]
],
options={'bdist_wheel': {'py_limited_api': 'cp37'} }
)

0 comments on commit f5d7af2

Please sign in to comment.