From a7091f6446baa0fc7c2ca30755229e8b906d0f2c Mon Sep 17 00:00:00 2001 From: Cole Crawford <16374762+ColeDCrawford@users.noreply.github.com> Date: Mon, 6 May 2024 16:45:21 -0400 Subject: [PATCH 1/5] WIP moving CI to Github Actions - Tests are failing due to testInterval(), but are being run correctly. On Python 3.12, `nose` is failing. We should upgrade to `nose2`, or more likely, switch from unittest + nose to pytest. - Move tox config to setup.cfg for now - TODO move to pyproject.toml instead of setup.cfg - TODO remove .travis.yml --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ setup.cfg | 13 +++++++++++++ setup.py | 7 +++++-- tox.ini | 8 -------- 4 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 tox.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6efba4d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + +jobs: + python-unit: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + defaults: + run: + working-directory: . + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: '**/setup.cfg' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Install test dependencies + run: pip install .[test] + + - name: Run unit tests + run: tox diff --git a/setup.cfg b/setup.cfg index 082465a..f17fb34 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,16 @@ formats = bdist_wheel [wheel] universal = 1 + +[testenv] +deps = + nose + django +commands = + nosetests + +[tox:tox] +minversion = 4.0 +env_list = + py{38,39,310,311,312} +isolated_build = True diff --git a/setup.py b/setup.py index 8fcc6aa..5046357 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,10 @@ def readme(): 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], ) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index f70761f..0000000 --- a/tox.ini +++ /dev/null @@ -1,8 +0,0 @@ -[tox] -envlist = py27,py36 - -[testenv] -deps= - nose - django -commands=nosetests From 782d1a1fe08c97712a493a79ea1a30b1d02dd103 Mon Sep 17 00:00:00 2001 From: Cole Crawford <16374762+ColeDCrawford@users.noreply.github.com> Date: Mon, 6 May 2024 17:49:26 -0400 Subject: [PATCH 2/5] Implement pyproject.toml Remove setup.cfg and setup.py in favor of pyproject.toml Nose and Tox are next to go. Nose seems to be failing on Python 3.10, no need for it any more as pytest should cover its features. Likely no need for tox either as we are using the matrix strategy in Github Actions, though it could be useful for local dev --- pyproject.toml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 18 ------------- setup.py | 57 ---------------------------------------- 3 files changed, 70 insertions(+), 75 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1ca1138 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,70 @@ +[project] +name = "edtf" +version = "5.0.0" +dependencies = [ + "python-dateutil", + "pyparsing", + "six" +] +description = "Python implementation of Library of Congress EDTF (Extended Date Time Format) specification" +requires-python = ">=3.8" +readme = {file = "README.txt", content-type = "text/markdown"} +authors = [ + { name = "The Interaction Consortium", email = "studio@interaction.net.au"}, + { name = "Alastair Weakley"}, + { name = "James Murty"}, + { name = "Mark Finger" }, + { name = "Sabine Müller" }, + { name = "Cole Crawford" } +] +maintainers = [ + { name = "The Interaction Consortium", email = "studio@interaction.net.au" } +] +classifiers = [ + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +[project.optional-dependencies] +test = [ + "django", + "nose", + "tox" +] + +[project.urls] +homepage = "https://github.com/ixc/python-edtf" +issues = "https://github.com/ixc/python-edtf/issues" +repository = "https://github.com/ixc/python-edtf.git" +changelog = "https://github.com/ixc/python-edtf/blob/main/changelog.rst" + +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.wheel] +universal = false + +[tool.tox] +legacy_tox_ini = """ + [tox] + min_version = 4.0 + env_list = py{38,39,310,311,312} + isolated_build = true + skip_missing_interpreters = True + + [testenv] + deps = + nose + django + commands = nosetests +""" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f17fb34..0000000 --- a/setup.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[devpi:upload] -formats = bdist_wheel - -[wheel] -universal = 1 - -[testenv] -deps = - nose - django -commands = - nosetests - -[tox:tox] -minversion = 4.0 -env_list = - py{38,39,310,311,312} -isolated_build = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 5046357..0000000 --- a/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -from __future__ import print_function - -import setuptools -import sys - -version = '5.0.0' - -def readme(): - with open('README.md') as f: - return f.read() - -setuptools.setup( - name='edtf', - version=version, - #use_scm_version={'version_scheme': 'post-release'}, - url='https://github.com/ixc/python-edtf', - author='The Interaction Consortium', - author_email='studio@interaction.net.au', - description='Python implementation of Library of Congress EDTF (Extended ' - 'Date Time Format) specification', - long_description=readme(), - long_description_content_type="text/markdown", - license='MIT', - packages=setuptools.find_packages(), - include_package_data=True, - install_requires=[ - 'python-dateutil', - 'pyparsing', - 'six' - ], - extras_require={ - 'test': [ - 'django', - 'nose', - 'tox', - ], - }, - setup_requires=[ - 'setuptools_scm >=5.0.2, <6.0.0', - ], - keywords=[ - 'edtf', - ], - classifiers=[ - 'Intended Audience :: Developers', - 'Intended Audience :: End Users/Desktop', - 'License :: OSI Approved :: MIT License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - ], -) From f88c88ee033daa76bf07b21cc0f65a08e82f9461 Mon Sep 17 00:00:00 2001 From: Cole Crawford <16374762+ColeDCrawford@users.noreply.github.com> Date: Mon, 6 May 2024 22:31:54 -0400 Subject: [PATCH 3/5] Switch to Pytest --- .github/workflows/ci.yml | 12 ++++++------ pyproject.toml | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6efba4d..6106282 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,15 +22,15 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' - cache-dependency-path: '**/setup.cfg' + cache-dependency-path: '**/pyproject.toml' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Install test dependencies - run: pip install .[test] + pip install .[test] - name: Run unit tests - run: tox + run: | + pytest edtf/tests.py + pytest edtf/natlang/tests.py + pytest edtf/parser/tests.py diff --git a/pyproject.toml b/pyproject.toml index 1ca1138..9f755fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,8 +37,7 @@ classifiers = [ [project.optional-dependencies] test = [ "django", - "nose", - "tox" + "pytest" ] [project.urls] @@ -64,7 +63,7 @@ legacy_tox_ini = """ [testenv] deps = - nose + pytest django - commands = nosetests + commands = pytest """ \ No newline at end of file From acebbff11cdc5197ace70d189dbdfc3cd5cb8063 Mon Sep 17 00:00:00 2001 From: Cole Crawford <16374762+ColeDCrawford@users.noreply.github.com> Date: Tue, 7 May 2024 10:52:55 -0400 Subject: [PATCH 4/5] Pytest config --- .github/workflows/ci.yml | 4 +--- .gitignore | 1 + pyproject.toml | 7 ++++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6106282..34cbabc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,4 @@ jobs: - name: Run unit tests run: | - pytest edtf/tests.py - pytest edtf/natlang/tests.py - pytest edtf/parser/tests.py + pytest diff --git a/.gitignore b/.gitignore index ba74660..ab3165a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ __pycache__/ # Distribution / packaging .Python env/ +venv/ build/ develop-eggs/ dist/ diff --git a/pyproject.toml b/pyproject.toml index 9f755fb..444298e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,4 +66,9 @@ legacy_tox_ini = """ pytest django commands = pytest -""" \ No newline at end of file +""" + +[tool.pytest.ini_options] +python_files = ["tests.py", "test_*.py", "*_test.py", "*_tests.py"] +python_classes = ["Test*", "*Tests"] +python_functions = ["test_*"] From f37831fb2d7dafea7867b9ab253aa04b4d2c620f Mon Sep 17 00:00:00 2001 From: Cole Crawford <16374762+ColeDCrawford@users.noreply.github.com> Date: Tue, 7 May 2024 12:29:35 -0400 Subject: [PATCH 5/5] Remove TravisCI config, update changelog --- .travis.yml | 12 ------------ changelog.rst | 3 +++ 2 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e3377a3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python -sudo: false -cache: pip -python: -- '3.6' -- '2.7' -before_install: -- pip install nose coverage 'django<2' -script: -- nosetests --verbose --with-coverage --cover-package=edtf -after_success: -- coverage report diff --git a/changelog.rst b/changelog.rst index 690f2ed..6a302ae 100644 --- a/changelog.rst +++ b/changelog.rst @@ -8,6 +8,9 @@ In development -------------------------- * Breaking Changes: Rename project back to edtf from edtf2, after the merge of work form https://github.com/saw-leipzig/python-edtf/ +* Breaking Changes: Drop support for Python 2 and Python 3 versions below 3.8. `v5` will support Python 3.8 to 3.12 at release. +* Switch from `tox` and `nose` to `pytest` for testing. +* Consolidate config and packaging from `setup.py` and `setup.cfg` to `pyproject.toml`. 5.0.0 (2023-10-04) ------------------