Skip to content

Commit

Permalink
Merge pull request #3 from p2p-ld/vendor-nptyping
Browse files Browse the repository at this point in the history
Vendor nptyping
  • Loading branch information
sneakers-the-rat authored Jul 31, 2024
2 parents 8007ceb + fef528f commit 880dafb
Show file tree
Hide file tree
Showing 41 changed files with 2,504 additions and 327 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main


permissions:
contents: read

jobs:
ruff:
name: Ruff Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1

black:
name: Black Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
53 changes: 40 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,34 @@ name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
strategy:
matrix:
python-version: ["3.9", "3.11", "3.12"]
platform: ["ubuntu-latest", "macos-latest", "windows-latest"]
numpy-version: ["<2.0.0", ">=2.0.0"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude:
- numpy-version: "<2.0.0"
python-version: "3.10"
- numpy-version: "<2.0.0"
python-version: "3.11"
- platform: "macos-latest"
python-version: "3.10"
- platform: "macos-latest"
python-version: "3.11"
- platform: "windows-latest"
python-version: "3.10"
- platform: "windows-latest"
python-version: "3.11"

runs-on: ubuntu-latest
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
Expand All @@ -21,21 +41,28 @@ jobs:
cache: 'pip'

- name: Install dependencies
run: pip install -e ".[tests,linkml]"
run: pip install -e ".[tests]"

- name: Install numpy version
run: pip install "numpy${{ matrix.numpy-version }}"

- name: Run Tests
run: pytest

- name: Report coverage
if: ${{ matrix.python-version }} == "3.11"
run: "coveralls --service=github"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Parallel
uses: coverallsapp/[email protected]
if: runner.os != 'macOS'
with:
flag-name: run-${{ join(matrix.*, '-') }}
parallel: true
debug: true

lint:
finish-coverage:
needs: test
if: ${{ always() }}
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
- uses: psf/black@stable
- name: Coveralls Finished
uses: coverallsapp/[email protected]
with:
parallel-finished: true
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,11 @@ dumped = instance.model_dump_json(context={'zarr_dump_array': True})
"hexdigest": "c51604eace325fe42bbebf39146c0956bd2ed13c"
}
}
```
```

## Vendored Dependencies

We have vendored dependencies in the `src/numpydantic/vendor` package,
and reproduced their licenses in the `licenses` directory.

- [nptyping](https://github.com/ramonhagenaars/nptyping) - `numpydantic.vendor.nptyping` - `/licenses/nptyping.txt`
27 changes: 27 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

## 1.*

### 1.2.3 - 24-07-31 - Vendor `nptyping`

`nptyping` vendored into `numpydantic.vendor.nptyping` -
`nptyping` is no longer maintained, and pins `numpy<2`.
It also has many obnoxious warnings and we have to monkeypatch it
so it performs halfway decently. Since we are en-route to deprecating
usage of `nptyping` anyway, in the meantime we have just vendored it in
(it is MIT licensed, included) so that we can make those changes ourselves
and have to patch less of it. Currently the whole package is vendored with
modifications, but will be whittled away until we have replaced it with
updated type specification system :)

Bugfix:
- [#2](https://github.com/p2p-ld/numpydantic/issues/2) - Support `numpy>=2`
- Remove deprecated numpy dtypes

CI:
- Add windows and mac tests
- Add testing with numpy>=2 and <2

DevOps:
- Make a tox file for local testing, not used in CI.

Tidying:
- Remove `monkeypatch` module! we don't need it anymore!
everything has either been upstreamed or vendored.

### 1.2.2 - 24-07-31

Add `datetime` map to numpy's :class:`numpy.datetime64` type
Expand Down
7 changes: 7 additions & 0 deletions licenses/nptyping.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2022, Ramon Hagenaars

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 880dafb

Please sign in to comment.