Skip to content

Commit

Permalink
Merge branch 'main' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
davebulaval committed Jul 9, 2024
2 parents f6ae639 + 4c12bb6 commit cc07b1c
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish a Docker image as a Github Package
name: Publish Docker Image

on:
release:
Expand Down
30 changes: 11 additions & 19 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,16 @@ on:
types: [ created ]

jobs:
deploy:

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/project/deepparse/
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
DEEPPARSE_RELEASE_BUILD=1 python setup.py sdist bdist_wheel
twine upload dist/*
# retrieve your distributions here

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,8 @@
- Fix circular import in the API app.
- Fix deprecated `max_request_body_size` in Sentry.

## 0.9.11

- Fix Sentry version error in Docker Image.

## dev
4 changes: 2 additions & 2 deletions app_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fastapi[all]
fastapi[all]==0.109.1
uvicorn
sentry-sdk[fastapi]
sentry-sdk[fastapi]>=2.0.0
python-decouple
pydantic
4 changes: 2 additions & 2 deletions deepparse/parser/address_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ def __init__(
# Validate if we have the proper metadata, it has at least the parser model type
# if no other thing have been modified.
error_text = (
"You are not using the proper retrained checkpoint for Deepparse, since we also export other"
"informations along with the model weights. "
"You are not using the proper retrained checkpoint for Deepparse, since we also export other "
"information's along with the model weights. "
"When we retrain an AddressParser, by default, we create a "
"checkpoint name 'retrained_modeltype_address_parser.ckpt'. "
"Where 'modeltype' is the AddressParser model type (e.g. 'fasttext', 'bpemb'). "
Expand Down
24 changes: 12 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,25 @@ def main():
long_description=readme,
long_description_content_type="text/markdown",
extras_require={
"colorama": "colorama>=0.4.3",
"app": ["fastapi[all]==0.99.1", "uvicorn==0.22.0", "sentry-sdk[fastapi]==1.28.1", "python-decouple==3.8"],
"colorama": "colorama",
"app": ["fastapi[all]>=0.109.1", "uvicorn==0.22.0", "sentry-sdk[fastapi]>=2.0.0", "python-decouple==3.8"],
"all": [
"colorama>=0.4.3", # colorama
"fastapi[all]==0.109.1", # app requirements
"colorama>", # colorama
"fastapi[all]>=0.109.1", # app requirements
"uvicorn==0.22.0",
"sentry-sdk[fastapi]>=1.28.1",
"sentry-sdk[fastapi]>=2.0.0",
"python-decouple==3.8",
"black", # code formatting requirements
"pylint==2.16.2",
"pylint",
"pylint-django[with_django]==2.5.3",
"pre-commit==3.3.3",
"pycountry==22.3.5", # tests requirements
"pytest==7.4.0",
"pytest-asyncio==0.21.1",
"pytest_cov==4.1.0",
"pytest-env==0.8.2",
"pytest-mock==3.11.1",
"pytest-xdist[psutil]==3.3.1",
"pytest",
"pytest-asyncio",
"pytest_cov",
"pytest-env",
"pytest-mock",
"pytest-xdist[psutil]",
"tensorboard==2.13.0",
"sphinx==6.2.1", # documentation requirements
"sphinx_rtd_theme==1.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,6 @@ def test_givenAFasttextAddressParser_whenRetrain_thenTrainingOccur(self):

self.assertIsNotNone(performance_after_training)

@patch("deepparse.validations.poutyne")
def test_givenAnAddressParser_whenRetrainWithPoutyne17andBefore_thenTrainingOccurWithAWarningPrint(
self, poutyne_mock
):
poutyne_mock.version.__version__ = "1.7"
self._capture_output()
address_parser = AddressParser(
model_type=self.a_fasttext_model_type,
device=self.a_cpu_device,
verbose=self.verbose,
)

address_parser.retrain(
self.training_container,
train_ratio=self.a_train_ratio,
epochs=self.a_single_epoch,
batch_size=self.a_batch_size,
num_workers=self.a_number_of_workers,
logging_path=self.a_checkpoints_saving_dir,
)

actual = self.test_out.getvalue()

expected = (
"You are using a older version of Poutyne that does not support properly error management."
" Due to that, we cannot show retrain progress. To fix that, update Poutyne to the newest version.\n"
)

self.assertEqual(actual, expected)

@patch("deepparse.validations.poutyne")
def test_givenAnAddressParser_whenRetrainWithPoutyne18andAfter_thenTrainingOccurWithoutAWarningPrint(
self, poutyne_mock
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.10
0.9.11

0 comments on commit cc07b1c

Please sign in to comment.