Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
get rid of plugin mechanism (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh authored May 4, 2020
1 parent d764ffc commit c833e7b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ jobs:
python: ['3.6', '3.7']

steps:
- uses: actions/checkout@v2

- name: Cleanup directory
run: |
# Remove the source code so that it doesn't conflict with the wheel
# installation.
rm -rf allennlp_models/
- name: Setup Python
uses: actions/setup-python@v1
with:
Expand All @@ -98,9 +106,13 @@ jobs:
run: |
pip install $(ls dist/*.whl)
- name: Ensure models plugin found
- name: Ensure models automatically loaded
run: |
./scripts/ensure_models_found.py
- name: Ensure versions match
run: |
python -c 'from allennlp.common.plugins import discover_plugins; assert "allennlp_plugins.allennlp_models" in list(discover_plugins())'
./scripts/ensure_versions_match.py
publish:
name: PyPI
Expand Down
Empty file removed allennlp_plugins/__init__.py
Empty file.
8 changes: 0 additions & 8 deletions allennlp_plugins/allennlp_models/__init__.py

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/ensure_models_found.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python

"""
Ensures models are automatically found by allennlp.
"""

from allennlp.common.plugins import import_plugins
from allennlp.models import Model


import_plugins()
Model.by_name("copynet_seq2seq")
11 changes: 11 additions & 0 deletions scripts/ensure_versions_match.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python

"""
Ensures allennlp and models versions are the same.
"""

from allennlp.version import VERSION as CORE_VERSION
from allennlp_models.version import VERSION as MODELS_VERSION


assert CORE_VERSION == MODELS_VERSION, f"core: {CORE_VERSION}, models: {MODELS_VERSION}"

0 comments on commit c833e7b

Please sign in to comment.