Skip to content

Commit 9387da5

Browse files
committed
Unvendor libraries
1 parent 06582bf commit 9387da5

File tree

144 files changed

+389
-38215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+389
-38215
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
actions: read
2222
with:
2323
wheel-name-pattern: "srsly-*.whl"
24-
pure-python: false
24+
pure-python: true
2525
create-release: ${{ startsWith(github.ref, 'refs/tags/release-') || startsWith(github.ref, 'refs/tags/prerelease-') }}
2626
secrets:
2727
gh-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,26 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
env:
17-
MODULE_NAME: 'srsly'
1817
RUN_MYPY: 'false'
1918

2019
jobs:
2120
tests:
21+
name: ${{ matrix.python_version }} ${{ matrix.os }} numpy=${{ matrix.numpy }}
2222
strategy:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-latest, windows-latest]
26-
# FIXME: ujson segfault on 3.14
27-
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
26+
# Note: ruamel.yaml does not support Python 3.13t
27+
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
28+
numpy: [true]
29+
include:
30+
- os: ubuntu-latest
31+
python_version: "3.9"
32+
numpy: false
33+
- os: ubuntu-latest
34+
python_version: "3.14"
35+
numpy: false
36+
2837
runs-on: ${{ matrix.os }}
2938

3039
steps:
@@ -35,46 +44,26 @@ jobs:
3544
uses: actions/setup-python@v6
3645
with:
3746
python-version: ${{ matrix.python_version }}
38-
architecture: x64
39-
40-
- name: Build sdist
41-
run: |
42-
python -m pip install -U build pip setuptools
43-
python -m pip install -U -r requirements.txt
44-
python -m build --sdist
4547

4648
- name: Run mypy
47-
shell: bash
4849
if: ${{ env.RUN_MYPY == 'true' }}
4950
run: |
50-
python -m mypy $MODULE_NAME
51-
52-
- name: Delete source directory
53-
shell: bash
54-
run: |
55-
rm -rf $MODULE_NAME
51+
python -m pip install mypy
52+
python -m mypy srsly
5653
57-
- name: Uninstall all packages
58-
run: |
59-
python -m pip freeze > installed.txt
60-
python -m pip uninstall -y -r installed.txt
54+
- name: Install package
55+
run: python -m pip install .
6156

62-
- name: Install from sdist
57+
- name: Test that numpy was not installed
6358
shell: bash
64-
run: |
65-
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
66-
python -m pip install dist/$SDIST
59+
run: if pip list | grep -q '^numpy'; then exit 1; fi
6760

68-
- name: Test import
69-
shell: bash
70-
run: |
71-
python -c "import $MODULE_NAME" -Werror
61+
- name: Install numpy
62+
if: ${{ matrix.numpy }}
63+
run: python -m pip install numpy
7264

7365
- name: Install test requirements
74-
run: |
75-
python -m pip install -U -r requirements.txt
66+
run: python -m pip install pytest
7667

7768
- name: Run tests
78-
shell: bash
79-
run: |
80-
python -m pytest --pyargs $MODULE_NAME -Werror
69+
run: pytest

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.env/
22
.env*
33
.vscode/
4-
cythonize.json
54

65
# Byte-compiled / optimized / DLL files
76
__pycache__/
@@ -108,8 +107,5 @@ venv.bak/
108107
# mypy
109108
.mypy_cache/
110109

111-
# Cython intermediate files
112-
*.cpp
113-
114110
# Vim files
115111
*.sw*

README.md

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# srsly: Modern high-performance serialization utilities for Python
44

55
This package bundles some of the best Python serialization libraries into one
6-
standalone package, with a high-level API that makes it easy to write code
6+
convenience package, with a high-level API that makes it easy to write code
77
that's correct across platforms and Pythons. This allows us to provide all the
88
serialization utilities we need in a single binary wheel. Currently supports
99
**JSON**, **JSONL**, **MessagePack**, **Pickle** and **YAML**.
@@ -24,31 +24,24 @@ wrap the multiple serialization formats we need to support (especially `json`,
2424
`msgpack` and `pickle`). These wrapping functions ended up duplicated across our
2525
codebases, so we wanted to put them in one place.
2626

27-
At the same time, we noticed that having a lot of small dependencies was making
28-
maintenance harder, and making installation slower. To solve this, we've made
29-
`srsly` standalone, by including the component packages directly within it. This
30-
way we can provide all the serialization utilities we need in a single binary
31-
wheel.
32-
33-
`srsly` currently includes forks of the following packages:
27+
`srsly` currently includes wrappers around the following packages:
3428

3529
- [`ujson`](https://github.com/esnme/ultrajson)
3630
- [`msgpack`](https://github.com/msgpack/msgpack-python)
37-
- [`msgpack-numpy`](https://github.com/lebedov/msgpack-numpy)
3831
- [`cloudpickle`](https://github.com/cloudpipe/cloudpickle)
3932
- [`ruamel.yaml`](https://github.com/pycontribs/ruamel-yaml) (without unsafe
4033
implementations!)
4134

42-
## Installation
35+
Additionally, it includes a heavily customized fork of
36+
[`msgpack-numpy`](https://github.com/lebedov/msgpack-numpy), with corrected
37+
round-trip behaviour for np.float64 objects.
4338

44-
> ⚠️ Note that `v2.x` is only compatible with **Python 3.6+**. For 2.7+
45-
> compatibility, use `v1.x`.
4639

47-
`srsly` can be installed from pip. Before installing, make sure that your `pip`,
48-
`setuptools` and `wheel` are up to date.
40+
## Installation
41+
42+
`srsly` can be installed from pip.
4943

5044
```bash
51-
python -m pip install -U pip setuptools wheel
5245
python -m pip install srsly
5346
```
5447

@@ -58,12 +51,15 @@ Or from conda via conda-forge:
5851
conda install -c conda-forge srsly
5952
```
6053

61-
Alternatively, you can also compile the library from source. You'll need to make
62-
sure that you have a development environment with a Python distribution
63-
including header files, a compiler (XCode command-line tools on macOS / OS X or
64-
Visual C++ build tools on Windows), pip and git installed.
54+
This will automatically install/upgrade all dependencies.
6555

66-
Install from source:
56+
numpy and cupy are optional dependencies for msgpack.
57+
If numpy is installed, numpy objects can be serialized.
58+
If cupy is installed, cupy objects will be automaticaly converted
59+
to numpy and then serialized.
60+
61+
62+
Alternatively, you can also install the library from the repository:
6763

6864
```bash
6965
# clone the repo
@@ -74,10 +70,7 @@ cd srsly
7470
python -m venv .env
7571
source .env/bin/activate
7672

77-
# update pip
78-
python -m pip install -U pip setuptools wheel
79-
80-
# compile and install from source
73+
# install from source
8174
python -m pip install .
8275
```
8376

@@ -86,7 +79,6 @@ mode without build isolation:
8679

8780
```bash
8881
# install in editable mode
89-
python -m pip install -r requirements.txt
9082
python -m pip install --no-build-isolation --editable .
9183

9284
# run test suite

pyproject.toml

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,3 @@
11
[build-system]
2-
requires = [
3-
"setuptools",
4-
"cython>=0.29.1",
5-
]
2+
requires = ["setuptools"]
63
build-backend = "setuptools.build_meta"
7-
8-
[tool.cibuildwheel]
9-
build = "*"
10-
skip = [
11-
"cp38*", # Obsolete
12-
"cp314-*", # FIXME ujson segfaults
13-
"cp314t-*", # TODO free-threading support (note: 3.13t is skipped by default)
14-
]
15-
test-skip = ""
16-
17-
archs = ["native"]
18-
19-
build-frontend = "default"
20-
config-settings = {}
21-
dependency-versions = "pinned"
22-
environment = {}
23-
environment-pass = []
24-
build-verbosity = 0
25-
26-
before-all = ""
27-
before-build = ""
28-
repair-wheel-command = ""
29-
30-
test-command = ""
31-
before-test = ""
32-
test-requires = []
33-
test-extras = []
34-
35-
container-engine = "docker"
36-
37-
manylinux-x86_64-image = "manylinux2014"
38-
manylinux-i686-image = "manylinux2014"
39-
manylinux-aarch64-image = "manylinux2014"
40-
manylinux-ppc64le-image = "manylinux2014"
41-
manylinux-s390x-image = "manylinux2014"
42-
manylinux-pypy_x86_64-image = "manylinux2014"
43-
manylinux-pypy_i686-image = "manylinux2014"
44-
manylinux-pypy_aarch64-image = "manylinux2014"
45-
46-
musllinux-x86_64-image = "musllinux_1_2"
47-
musllinux-i686-image = "musllinux_1_2"
48-
musllinux-aarch64-image = "musllinux_1_2"
49-
musllinux-ppc64le-image = "musllinux_1_2"
50-
musllinux-s390x-image = "musllinux_1_2"
51-
52-
53-
[tool.cibuildwheel.linux]
54-
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
55-
56-
[tool.cibuildwheel.macos]
57-
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
58-
59-
[tool.cibuildwheel.windows]
60-
61-
[tool.cibuildwheel.pyodide]
62-
63-

requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.cfg

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,26 @@ classifiers =
1212
Intended Audience :: Developers
1313
Intended Audience :: Science/Research
1414
License :: OSI Approved :: MIT License
15-
Operating System :: POSIX :: Linux
16-
Operating System :: MacOS :: MacOS X
17-
Operating System :: Microsoft :: Windows
18-
Programming Language :: Cython
15+
Operating System :: OS Independent
1916
Programming Language :: Python :: 3
2017
Programming Language :: Python :: 3.9
2118
Programming Language :: Python :: 3.10
2219
Programming Language :: Python :: 3.11
2320
Programming Language :: Python :: 3.12
2421
Programming Language :: Python :: 3.13
22+
Programming Language :: Python :: 3.14
2523
Topic :: Scientific/Engineering
2624

2725
[options]
2826
zip_safe = true
2927
include_package_data = true
30-
# FIXME ujson segfaults on 3.14
31-
python_requires = >=3.9,<3.14
32-
setup_requires =
33-
cython>=0.29.1
28+
python_requires = >=3.9
3429
install_requires =
35-
catalogue>=2.0.3,<2.1.0
30+
catalogue>=2.0.10,<3
31+
cloudpickle >=3.1.2,<4
32+
msgpack >=1.1,<2
33+
ruamel.yaml >=0.18.16,<1
34+
ujson >=5.11.0,<6
3635

3736
[options.entry_points]
3837
# If spaCy is installed in the same environment as srsly, it will automatically
@@ -44,7 +43,7 @@ spacy_readers =
4443
srsly.read_msgpack.v1 = srsly:read_msgpack
4544

4645
[bdist_wheel]
47-
universal = false
46+
universal = true
4847

4948
[sdist]
5049
formats = gztar
@@ -55,11 +54,6 @@ max-line-length = 80
5554
select = B,C,E,F,W,T4,B9
5655
exclude =
5756
srsly/__init__.py
58-
srsly/msgpack/__init__.py
59-
srsly/cloudpickle/__init__.py
6057

6158
[mypy]
6259
ignore_missing_imports = True
63-
64-
[mypy-srsly.cloudpickle.*]
65-
ignore_errors=True

0 commit comments

Comments
 (0)