From 0cdf8bea5954fa0a08d9c801337be77f37b39627 Mon Sep 17 00:00:00 2001 From: DonHaul Date: Mon, 2 Dec 2024 14:02:35 +0100 Subject: [PATCH] generic: bump and clean dependencies add dockerfiles for local tesing * ref: cern-sis/issues-inspire/issues/625 --- .github/workflows/bump-and-publish.yml | 2 +- .github/workflows/test-python-2.yml | 5 ++--- .github/workflows/test-python-3.yml | 2 +- Dockerfile.py2 | 4 ++++ README.rst => README.md | 29 +++++++++++++++++++------- run-tests.sh | 24 --------------------- setup.py | 14 ++++++------- 7 files changed, 36 insertions(+), 44 deletions(-) create mode 100644 Dockerfile.py2 rename README.rst => README.md (69%) delete mode 100755 run-tests.sh diff --git a/.github/workflows/bump-and-publish.yml b/.github/workflows/bump-and-publish.yml index 56c2e40..99cc49e 100644 --- a/.github/workflows/bump-and-publish.yml +++ b/.github/workflows/bump-and-publish.yml @@ -62,7 +62,7 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel - pip install -e .[tests,elasticsearch5] + pip install -e .[tests] - name: Show python dependencies run: | diff --git a/.github/workflows/test-python-2.yml b/.github/workflows/test-python-2.yml index 5c340ce..951269e 100644 --- a/.github/workflows/test-python-2.yml +++ b/.github/workflows/test-python-2.yml @@ -23,8 +23,7 @@ jobs: wget https://bootstrap.pypa.io/pip/2.7/get-pip.py ${{ matrix.python }} get-pip.py ${{ matrix.python }} -m ${{ matrix.pip }} install --user --upgrade pip - ${{ matrix.python }} -m ${{ matrix.pip }} --no-cache-dir install --user setuptools wheel "urllib3==1.25.11" - ${{ matrix.python }} -m ${{ matrix.pip }} --no-cache-dir install --user -e .[tests,elasticsearch5] + ${{ matrix.python }} -m ${{ matrix.pip }} --no-cache-dir install --user -e .[tests] - name: Show python dependencies run: | @@ -33,4 +32,4 @@ jobs: - name: Run tests run: | - ./run-tests.sh + pytest tests diff --git a/.github/workflows/test-python-3.yml b/.github/workflows/test-python-3.yml index 3ae06cf..0d41271 100644 --- a/.github/workflows/test-python-3.yml +++ b/.github/workflows/test-python-3.yml @@ -39,4 +39,4 @@ jobs: - name: Run tests run: | - ./run-tests.sh + pytest tests diff --git a/Dockerfile.py2 b/Dockerfile.py2 new file mode 100644 index 0000000..367be38 --- /dev/null +++ b/Dockerfile.py2 @@ -0,0 +1,4 @@ +FROM python:2.7.18-buster +COPY . . +RUN python -m pip install -e .[tests] +CMD ["/bin/bash"] diff --git a/README.rst b/README.md similarity index 69% rename from README.rst rename to README.md index 8189cd7..3754900 100644 --- a/README.rst +++ b/README.md @@ -1,4 +1,5 @@ -.. + + + # INSPIRE-Utils -=============== - INSPIRE-Utils -=============== +### About +INSPIRE-specific utils. -About -===== -INSPIRE-specific utils. +### Development + +Tests should be run both for python 2 and python 3. +For python 2 its recommended to run them through docker: +```bash +# building the image python 3 and python 2 +docker build -f Dockerfile.py2 -t inspire-utils:py2 . +docker run inspire-utils:py2 pytest tests +``` + +For python 3 you can run them locally: +```bash +pip install .[tests] +pytest tests +``` + diff --git a/run-tests.sh b/run-tests.sh deleted file mode 100755 index 073b5e5..0000000 --- a/run-tests.sh +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of INSPIRE. -# Copyright (C) 2014-2024 CERN. -# -# INSPIRE is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# INSPIRE is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with INSPIRE. If not, see . -# -# In applying this license, CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set -e -py.test tests diff --git a/setup.py b/setup.py index 3c9c5d0..4a7487d 100644 --- a/setup.py +++ b/setup.py @@ -25,18 +25,16 @@ URL = "https://github.com/inspirehep/inspire-utils" -with open("README.rst") as f: +with open("README.md") as f: readme = f.read() install_requires = [ - 'Unidecode~=1.0,>=1.0.22', - 'babel~=2.0,>=2.5.1', + 'Unidecode~=1.0,>=1.2.0', + 'babel~=2.9,>=2.9.1', 'lxml~=5.0', - 'nameparser~=0.0,>=0.5.3;python_version <= "2.7"', - 'nameparser~=1.1,>=1.1.3;python_version >= "3.6"', - 'python-dateutil~=2.0,>=2.6.1', - 'six~=1.0,>=1.10.0', - 'urllib3~=1.0,<=1.26.12' + 'nameparser~=1.1,>=1.1.3', + 'python-dateutil~=2.9,>=2.9.0', + 'six~=1.0,>=1.10.0' ] docs_require = []