Skip to content

Commit

Permalink
Remove shared_library key (#31)
Browse files Browse the repository at this point in the history
* Remove shared_library key

* changelog

* Put back shared_library key but exclude from output

* Fix test

* lint

* Remove lint job

* Rollback python version in ci

* Update test
  • Loading branch information
ryanking13 authored Aug 9, 2024
1 parent 5212b7f commit 1cd330f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
21 changes: 2 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,16 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Lint
run: |
pre-commit run -a
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment: PyPi-deploy
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.11.1
python-version: 3.12
- name: Install requirements and build wheel
shell: bash -l {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: "3.11"
python: "3.12"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.1.0a7] - 2024-08-08

### Added

- `shared_library` key is removed from the lock file.
[#31](https://github.com/pyodide/pyodide-lock/pull/31)

## [0.1.0a6] - 2024-04-03

### Added

- The `info` field now contains an optional `abi_version`.
[#86](https://github.com/pyodide/pyodide-lock/pull/86)
[#27](https://github.com/pyodide/pyodide-lock/pull/27)

## [0.1.0a5] - 2024-04-03

Expand Down
4 changes: 2 additions & 2 deletions pyodide_lock/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class PackageSpec(BaseModel):
imports: list[str] = []
depends: list[str] = []
unvendored_tests: bool = False
# This field is deprecated
shared_library: bool = False
# This field is deprecated and will not be included in the output
shared_library: bool = Field(default=False, exclude=True)
model_config = ConfigDict(extra="forbid")


Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
),
"imports": ["numpy"],
"depends": [],
"shared_library": False,
}
},
}
Expand Down
12 changes: 11 additions & 1 deletion tests/test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def test_lock_spec_parsing(pyodide_version, tmp_path):
assert spec.info == spec2.info
assert set(spec.packages.keys()) == set(spec2.packages.keys())
for key in spec.packages:
assert spec.packages[key] == spec2.packages[key]
pkg1 = spec.packages[key]
pkg2 = spec2.packages[key]
assert pkg1.model_dump() == pkg2.model_dump()


def test_check_wheel_filenames(example_lock_data):
Expand Down Expand Up @@ -103,3 +105,11 @@ def test_extra_config_forbidden(example_lock_data):

with pytest.raises(ValidationError, match="Extra inputs are not permitted"):
PackageSpec(**package_data)


def test_exclude_key(example_lock_data):
spec = PyodideLockSpec(**example_lock_data)
dump = spec.model_dump()
assert "packages" in dump
for pkg in dump["packages"].values():
assert "shared_library" not in pkg
1 change: 0 additions & 1 deletion tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def test_self_wheel(example_lock_spec):
imports=["pyodide_lock"],
depends=["pydantic"],
unvendored_tests=False,
shared_library=False,
)

assert example_lock_spec.packages["pyodide-lock"] == expected
Expand Down

0 comments on commit 1cd330f

Please sign in to comment.