From ac8cc29623ced5f404446e5b11986232a5c2a264 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 28 Aug 2024 11:56:54 -0400 Subject: [PATCH 01/25] fix order of decription types --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 169b06f..c82cc13 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,7 @@ # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = f.read() - long_description_content_type = "text/markdown" + long_description_from_readme = f.read() with open(path.join(here, 'VERSION.txt'), encoding='utf-8') as fv: version = fv.read() @@ -31,8 +30,9 @@ description='A python module to emulate the date math used in SOLR and Elasticsearch', - long_description=long_description, - long_description_content_type='text/markdown', + long_description_content_type="text/markdown", + long_description=long_description_from_readme, + # The project's main homepage. url='https://github.com/nickmaccarthy/python-datemath', From e803d2f2a47e7683574062372e31ccd7debd2159 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 28 Aug 2024 12:04:17 -0400 Subject: [PATCH 02/25] feat: upgrade twine to 5.1.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 33b01bd..3dfa51d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ requests-toolbelt==0.9.1 six==1.10.0 tqdm==4.66.3 traceback2==1.4.0 -twine==2.0.0 +twine==5.1.1 types-python-dateutil==2.8.19.20240311 types-setuptools==73.0.0.20240822 types-pytz==2023.3.1.1 From 8637baf0088658e3c04b2579d2bed57ca76c754f Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 28 Aug 2024 12:17:13 -0400 Subject: [PATCH 03/25] twine to 4.0.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3dfa51d..9da67c8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ requests-toolbelt==0.9.1 six==1.10.0 tqdm==4.66.3 traceback2==1.4.0 -twine==5.1.1 +twine==4.0.2 types-python-dateutil==2.8.19.20240311 types-setuptools==73.0.0.20240822 types-pytz==2023.3.1.1 From 3ef21b33b25bc2f36e8cb3f5ce5a4627f7688605 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 28 Aug 2024 12:57:25 -0400 Subject: [PATCH 04/25] bump packages to support twine --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9da67c8..ab0d95a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,12 +11,12 @@ idna==3.7 linecache2==1.0.0 mypy==1.7.1 packaging==16.8 -pkginfo==1.4.2 +pkginfo>=1.8.1 Pygments==2.15.0 pyparsing==2.2.0 python-dateutil==2.8.2 pytz==2023.3 -readme-renderer==24.0 +readme-renderer>=35.0 requests==2.32.2 requests-toolbelt==0.9.1 six==1.10.0 From 17a8dd102657781341ff40fb5ac091a2e7b5d01a Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:13:44 -0400 Subject: [PATCH 05/25] feat: add version and dockerfile to verify setup works --- Dockerfile | 20 ++++++++++++++++++++ datemath/_version.py | 7 +++++++ requirements.txt | 2 +- verify.py | 16 ++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 datemath/_version.py create mode 100644 verify.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..551c3c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Python runtime as the base image +FROM python:3.9 + +# Set the working directory in the container +WORKDIR /app + +# Copy the contents of your project to the working directory +COPY . . + +# Install the required dependencies +RUN pip install -r requirements.txt + +# Run setup.py to install your module +RUN python3 setup.py install + +# Run your tests to ensure everything works as expected +RUN python3 -m unittest discover + +# Set the entrypoint command to run your module +CMD ["python3", "verify.py"] \ No newline at end of file diff --git a/datemath/_version.py b/datemath/_version.py new file mode 100644 index 0000000..0708e9a --- /dev/null +++ b/datemath/_version.py @@ -0,0 +1,7 @@ +import os + +current_dir = os.path.dirname(os.path.abspath(__file__)) +version_file = os.path.join(current_dir, '../VERSION.txt') + +with open(version_file, 'r') as f: + __version__ = f.read().strip() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index ab0d95a..18e6fc9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ requests-toolbelt==0.9.1 six==1.10.0 tqdm==4.66.3 traceback2==1.4.0 -twine==4.0.2 +twine==5.1.1 types-python-dateutil==2.8.19.20240311 types-setuptools==73.0.0.20240822 types-pytz==2023.3.1.1 diff --git a/verify.py b/verify.py new file mode 100644 index 0000000..21c23a5 --- /dev/null +++ b/verify.py @@ -0,0 +1,16 @@ +from datemath import datemath, __version__ + + + +print(f'datemath version is {__version__}') +with open('VERSION.txt', 'r') as f: + version = f.read().strip() + +assert __version__ == version + + +print(f'Now is: {datemath("now")}') +print(f'1 hour was ago was: {datemath("now-1h")}') +print(f'1 week from now is {datemath("now+1w/w")}') +print(f'1 year from now is {datemath("+1y")}') + From 6ede298ebdc3d292dce70fbc64809d01e8fe0d16 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:14:06 -0400 Subject: [PATCH 06/25] v3.0.2 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index b502146..d9c62ed 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.0.2 +3.0.2 \ No newline at end of file From 9116db1934cec2c98686bd408185f6260dd87b29 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:14:26 -0400 Subject: [PATCH 07/25] feat: add docker build and verify package for local dev --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 91f7e43..6cb2c45 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,11 @@ tests: python3 tests.py + +docker-build: + docker build -t python-datemath . + +docker-run: + docker run --rm python-datemath + +test-build: docker-build docker-run \ No newline at end of file From 47a0ce148002bd29c9e48ea0028ba539dfab7b47 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:14:46 -0400 Subject: [PATCH 08/25] feat: __all__ support which adds __version__ --- datemath/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/datemath/__init__.py b/datemath/__init__.py index cc2cb78..54ea156 100644 --- a/datemath/__init__.py +++ b/datemath/__init__.py @@ -1,4 +1,5 @@ from __future__ import annotations +from ._version import __version__ from datetime import datetime from typing import TYPE_CHECKING @@ -17,3 +18,12 @@ def dm(expr: str | int, **kwargs: Unpack[ParseParams]) -> Arrow: def datemath(expr: str | int, **kwargs: Unpack[ParseParams]) -> datetime: ''' does our datemath and returns a datetime object ''' return parse(expr, **kwargs).datetime + + +__all__ = [ + 'dm', + 'datemath', + 'parse', + 'DateMathException', + '__version__', +] \ No newline at end of file From 8ae9eca396d8c427be06cc369739a30b67bca433 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:14:59 -0400 Subject: [PATCH 09/25] chore: cleanup --- datemath/helpers.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/datemath/helpers.py b/datemath/helpers.py index 3ea145b..f94a3e7 100644 --- a/datemath/helpers.py +++ b/datemath/helpers.py @@ -1,43 +1,3 @@ -''' -A basic utility module for parsing math like strings relating to dates - -This is inspired by Date Math features in elasticsearch and aims to replicate the same functionality for python. - -DateMath (datemath or dm) suppor addition, subtraction and rounding at various granularities of "units" (a map of units to their shorthand is below for reference). -Expressions can be chanied together and are read left to right. '+' and '-' denote addition and subtraction while '/' denotes 'round', in this case is a 'round down' or floor. -Round requires a unit (/d), while addition and subtraction require an integer value and a unit (+1d). Whitespace is not allowed in the expression. Absolute datetimes with datemath -can be made as well, with the datetime and datemath expressions delinated by '||' - example '2015-01-01||+1d' == '2015-01-02' - - -Maps: - -y or Y = 'year' -M = 'month' -m = 'minute' -d or D = 'day' -w = 'week' -h or H = 'hour' -s or S = 'second' - -Examples: - -Assuming our datetime is currently: '2016-01-01T00:00:00-00:00' - -Expression: Result: -now-1h 2015-12-31T23:00:00+00:00 -now-1y 2015-01-01T00:00:00+00:00 -now+1y+2d 2017-01-03T00:00:00+00:00 -now+12h 2016-01-01T12:00:00+00:00 -now+1d/d 2016-01-03T00:00:00+00:00 -+2h 2016-01-01T02:00:00+00:00 -+1h/h 2016-01-01T02:00:00+00:00 -now+1w/w 2016-01-11T00:00:00+00:00 -now/d+7d+12h 2016-01-08T12:00:00+00:00 -2016-01-01||+1d 2016-01-02T00:00:00+00:00 -2015-01-01||+2w 2015-01-15T00:00:00+00:00 - -''' - from __future__ import annotations import os @@ -250,8 +210,6 @@ def evaluate(expression: str, now: Arrow, timeZone: str = 'UTC', roundDown: bool if debug: print('\n\n') return now - - if __name__ == "__main__": if debug: print('NOW: {0}'.format(arrow.utcnow())) if debug: print('\n\n') From b39305b40f42cb9cf7b78d659050124e73e3f76b Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:15:24 -0400 Subject: [PATCH 10/25] feat: move pypi setup from setup.py to setup.cfg, cleanup --- setup.cfg | 10 ++++++++++ setup.py | 42 ------------------------------------------ 2 files changed, 10 insertions(+), 42 deletions(-) diff --git a/setup.cfg b/setup.cfg index ac06c3e..91b414f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,6 +5,16 @@ long_description = file: README.md long_description_content_type = text/markdown author = Nick MacCarthy author_email = nickmaccarthy@gmail.com +license = Apache-2.0 +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Topic :: Software Development :: Build Tools + License :: Apache-2.0 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 [bdist_wheel] diff --git a/setup.py b/setup.py index c82cc13..8feea92 100644 --- a/setup.py +++ b/setup.py @@ -28,49 +28,10 @@ version=version, download_url = 'https://github.com/nickmaccarthy/python-datemath/tarball/{0}'.format(version), - description='A python module to emulate the date math used in SOLR and Elasticsearch', - - long_description_content_type="text/markdown", - long_description=long_description_from_readme, - - # The project's main homepage. url='https://github.com/nickmaccarthy/python-datemath', - # Author details - author='Nick MacCarthy', - author_email='nickmaccarthy@gmail.com', - - # Choose your license - license='Apache-2.0', - - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - 'Development Status :: 5 - Production/Stable', - - # Indicate who your project is intended for - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Build Tools', - - # Pick your license as you wish (should match "license" above) - 'Apache-2.0', - - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - ], - - # What does your project relate to? - keywords='date math datemath elaticsearch solr', - # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). packages=find_packages(exclude=['contrib', 'docs', 'tests']), @@ -78,9 +39,6 @@ package_data={'': ['*']}, include_package_data=True, - # Alternatively, if you want to distribute just a my_module.py, uncomment - # this: - # py_modules=["my_module"], # List run-time dependencies here. These will be installed by pip when # your project is installed. For an analysis of "install_requires" vs pip's From 56e59e47739ba4163ac43a364e548c27a21820b0 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:15:37 -0400 Subject: [PATCH 11/25] chore: bump relevant module versions --- requirements.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 18e6fc9..5b33202 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,29 +4,43 @@ arrow==1.2.3 bleach==3.3.0 certifi==2024.7.4 chardet==3.0.4 +charset-normalizer==3.3.2 clint==0.5.1 docutils==0.15.2 freezegun==1.2.2 idna==3.7 +importlib_metadata==8.4.0 +jaraco.classes==3.4.0 +jaraco.context==6.0.1 +jaraco.functools==4.0.2 +keyring==25.3.0 linecache2==1.0.0 +markdown-it-py==3.0.0 +mdurl==0.1.2 +more-itertools==10.4.0 mypy==1.7.1 +mypy-extensions==1.0.0 +nh3==0.2.18 packaging==16.8 -pkginfo>=1.8.1 +pkginfo==1.10.0 Pygments==2.15.0 pyparsing==2.2.0 python-dateutil==2.8.2 pytz==2023.3 -readme-renderer>=35.0 +readme_renderer==43.0 requests==2.32.2 requests-toolbelt==0.9.1 -six==1.10.0 +rfc3986==2.0.0 +rich==13.8.0 +six==1.16.0 tqdm==4.66.3 traceback2==1.4.0 twine==5.1.1 types-python-dateutil==2.8.19.20240311 -types-setuptools==73.0.0.20240822 types-pytz==2023.3.1.1 +types-setuptools==73.0.0.20240822 typing_extensions==4.7.1 tzdata==2024.1 urllib3==1.26.19 webencodings==0.5.1 +zipp==3.20.1 From ef50e7c077dfdcfcad5d4e90d2ae7934503a2af8 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:15:55 -0400 Subject: [PATCH 12/25] chore: CHANGELOG updated for v3.0.2 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4213dd..eca9567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.0.2] - 2024-08-27 ### added - Feat: Complete typing with strict type-checking [#43](https://github.com/nickmaccarthy/python-datemath/pull/43) Thank you @Avasam! +- Feat: Added `__version__` to to verify the version of the module. +- Feat: Addded Dockerfile and relevant verify.py to help with local development and testing +### chore +- Chore: bumped modules in requirements.txt ### fixed - Fix: removed legacy-tests.py since we no longer support python2.x - Fix: removed requirements-2.txt from manifest due to deprecation of python2 support - Fix: renamed requirements-3.txt to requirements.txt to support python3 going forward - also modifed to `release.yaml` and `tests.yaml` workflows to support this - Fix: long_description should now show up in pypi https://github.com/nickmaccarthy/python-datemath/issues/33 +- Fix: move more pypi configurations to setup.cfg and out of setup.py + ## [3.0.1] - 2024-08-23 ### fixed From 91c72b566363fc1b4e39c196610f5d69795cb191 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 12:17:01 -0400 Subject: [PATCH 13/25] chore: CHANGELOG updated for v3.0.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eca9567..e2b503d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.0.2] - 2024-08-27 +## [3.0.2] - 2024-09-11 ### added - Feat: Complete typing with strict type-checking [#43](https://github.com/nickmaccarthy/python-datemath/pull/43) Thank you @Avasam! - Feat: Added `__version__` to to verify the version of the module. From 79bad6efd976fc0a447d25a37724ccc3e81e48f4 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 14:26:31 -0400 Subject: [PATCH 14/25] fix: license classifier --- setup.cfg | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 91b414f..0d29b46 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,7 @@ [metadata] name = python-datemath description = "A python module to emulate the date math used in SOLR and Elasticsearch" +keywords = date math datemath elaticsearch solr long_description = file: README.md long_description_content_type = text/markdown author = Nick MacCarthy @@ -10,12 +11,17 @@ classifiers = Development Status :: 5 - Production/Stable Intended Audience :: Developers Topic :: Software Development :: Build Tools - License :: Apache-2.0 + License :: OSI Approved :: Apache License, Version 2.0 (Apache-2.0) Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 +[options] +python_requires = >=3.8 +install_requires = + arrow >= 1.0.3 + [bdist_wheel] universal=1 From 5dec2ee81e6dfeb2ca742964927fbce27a808d99 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 14:50:06 -0400 Subject: [PATCH 15/25] fix: license classifier --- LICENSE | 5 +++-- setup.cfg | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index 8dada3e..cbff04e 100644 --- a/LICENSE +++ b/LICENSE @@ -178,7 +178,7 @@ APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2023 Chris Smith Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -199,3 +199,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 0d29b46..27fadd6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,11 +11,14 @@ classifiers = Development Status :: 5 - Production/Stable Intended Audience :: Developers Topic :: Software Development :: Build Tools - License :: OSI Approved :: Apache License, Version 2.0 (Apache-2.0) + License :: OSI Approved :: Apache Software License + Programming Language :: Python :: 3 :: Only 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 + Operating System :: OS Independent [options] From 701d906a738704a9c1a34c7092b780113f740282 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 11 Sep 2024 14:50:13 -0400 Subject: [PATCH 16/25] fix: formatting --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2b503d..a844f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### chore - Chore: bumped modules in requirements.txt + ### fixed - Fix: removed legacy-tests.py since we no longer support python2.x - Fix: removed requirements-2.txt from manifest due to deprecation of python2 support From 52251f90f51c606d881da6a2deaf9d2793e076b1 Mon Sep 17 00:00:00 2001 From: I538638 Date: Thu, 12 Sep 2024 16:22:06 +0000 Subject: [PATCH 17/25] fix typo in changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a844f42..40dbe58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.0.2] - 2024-09-11 ### added - Feat: Complete typing with strict type-checking [#43](https://github.com/nickmaccarthy/python-datemath/pull/43) Thank you @Avasam! -- Feat: Added `__version__` to to verify the version of the module. -- Feat: Addded Dockerfile and relevant verify.py to help with local development and testing +- Feat: Added `__version__` to verify the version of the module. +- Feat: Added Dockerfile and relevant verify.py to help with local development and testing ### chore - Chore: bumped modules in requirements.txt @@ -33,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix: Bump certifi to latest: https://github.com/nickmaccarthy/python-datemath/pull/38 ### added - Feat: Typehint support: https://github.com/nickmaccarthy/python-datemath/issues/31 -- Feat: Revamed CHANGELOG.md to keepachangelog.org format +- Feat: Renamed CHANGELOG.md to keepachangelog.org format ### todo - todo: Fix pypi: https://github.com/nickmaccarthy/python-datemath/issues/33 From 0e2b0f241d09c1c1e9a9de51976101b86ed70851 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:33:58 -0400 Subject: [PATCH 18/25] fix: #17 move version our of VERSION.txt --- MANIFEST.in | 1 - VERSION.txt | 1 - datemath/_version.py | 8 +------- setup.py | 15 ++++++++------- verify.py | 4 ---- 5 files changed, 9 insertions(+), 20 deletions(-) delete mode 100644 VERSION.txt diff --git a/MANIFEST.in b/MANIFEST.in index 9dd3e50..c4747a2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ -include VERSION.txt include README.md include CHANGELOG.md include LICENSE diff --git a/VERSION.txt b/VERSION.txt deleted file mode 100644 index d9c62ed..0000000 --- a/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -3.0.2 \ No newline at end of file diff --git a/datemath/_version.py b/datemath/_version.py index 0708e9a..8d1c862 100644 --- a/datemath/_version.py +++ b/datemath/_version.py @@ -1,7 +1 @@ -import os - -current_dir = os.path.dirname(os.path.abspath(__file__)) -version_file = os.path.join(current_dir, '../VERSION.txt') - -with open(version_file, 'r') as f: - __version__ = f.read().strip() \ No newline at end of file +__version__ = "3.0.3" diff --git a/setup.py b/setup.py index 8feea92..c7995d2 100644 --- a/setup.py +++ b/setup.py @@ -8,16 +8,17 @@ from setuptools import setup, find_packages # To use a consistent encoding from codecs import open +import os from os import path here = path.abspath(path.dirname(__file__)) -# Get the long description from the README file -with open(path.join(here, 'README.md'), encoding='utf-8') as f: - long_description_from_readme = f.read() -with open(path.join(here, 'VERSION.txt'), encoding='utf-8') as fv: - version = fv.read() +version = {} +with open(os.path.join(here, 'datemath', '_version.py')) as f: + exec(f.read(), version) + VERSION = version['__version__'] + setup( name='python-datemath', @@ -25,8 +26,8 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version=version, - download_url = 'https://github.com/nickmaccarthy/python-datemath/tarball/{0}'.format(version), + version=VERSION, + download_url = 'https://github.com/nickmaccarthy/python-datemath/tarball/{0}'.format(VERSION), # The project's main homepage. url='https://github.com/nickmaccarthy/python-datemath', diff --git a/verify.py b/verify.py index 21c23a5..ec1cfdb 100644 --- a/verify.py +++ b/verify.py @@ -3,10 +3,6 @@ print(f'datemath version is {__version__}') -with open('VERSION.txt', 'r') as f: - version = f.read().strip() - -assert __version__ == version print(f'Now is: {datemath("now")}') From d95ce10cf04aac12669b325437238538494d9cb4 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:34:33 -0400 Subject: [PATCH 19/25] chore: bump module versions --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5b33202..6089176 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ more-itertools==10.4.0 mypy==1.7.1 mypy-extensions==1.0.0 nh3==0.2.18 -packaging==16.8 +packaging==24.1 pkginfo==1.10.0 Pygments==2.15.0 pyparsing==2.2.0 @@ -32,6 +32,7 @@ requests==2.32.2 requests-toolbelt==0.9.1 rfc3986==2.0.0 rich==13.8.0 +setuptools==74.1.2 six==1.16.0 tqdm==4.66.3 traceback2==1.4.0 From 6939ec5d46444bdb1904eff70755dccf5939d06f Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:37:20 -0400 Subject: [PATCH 20/25] chore: update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a844f42..746cd06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.3] - 2024-09-12 +### fixed +- Fix: issue where version wasnt getting populated +- Fix: move version out of `VERSION.txt` and into `datemath/_version.py` directly +- Fix: typos in CHANGELOG. Thank you @s00hyun! + ## [3.0.2] - 2024-09-11 ### added - Feat: Complete typing with strict type-checking [#43](https://github.com/nickmaccarthy/python-datemath/pull/43) Thank you @Avasam! From 6c4b9cd487f40cf11e8b114568bda36c7340d8f2 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:39:00 -0400 Subject: [PATCH 21/25] chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 746cd06..770d451 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [3.0.3] - 2024-09-12 +Please use 3.0.3 going forward! 3.0.2 has a breaking bug. + ### fixed - Fix: issue where version wasnt getting populated - Fix: move version out of `VERSION.txt` and into `datemath/_version.py` directly From c84062ad20aaf28ecb093c0ee79801fe6d5c3c77 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:40:31 -0400 Subject: [PATCH 22/25] fix: type set for version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c7995d2..e252cc5 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ version = {} with open(os.path.join(here, 'datemath', '_version.py')) as f: exec(f.read(), version) - VERSION = version['__version__'] + VERSION = str(version['__version__']) setup( From 2e809a8d69bd2d35c7d325701c0e6ce32db615f9 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:43:58 -0400 Subject: [PATCH 23/25] fix: type set for version --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index e252cc5..36b3376 100644 --- a/setup.py +++ b/setup.py @@ -10,14 +10,14 @@ from codecs import open import os from os import path +from typing import Dict here = path.abspath(path.dirname(__file__)) - -version = {} +version: Dict[str, str] = {} with open(os.path.join(here, 'datemath', '_version.py')) as f: exec(f.read(), version) - VERSION = str(version['__version__']) + VERSION = version['__version__'] setup( From 80205ef1ce5901b3815fb4ff99cd11b505914ded Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Thu, 12 Sep 2024 15:45:37 -0400 Subject: [PATCH 24/25] fix: verify version in tests --- .github/workflows/tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f95128b..5dc195a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -23,3 +23,5 @@ jobs: run: python3 setup.py install --user - name: verify we can import run: python3 -c "from datemath import datemath; print(datemath('now-1d'))" + - name: verify our version + run: python3 -c "import datemath; print(datemath.__version__)" \ No newline at end of file From 231b82c48702612b83a3fc8eb67e4edb3b341df0 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Mon, 16 Sep 2024 09:31:19 -0400 Subject: [PATCH 25/25] fix: cleanup --- RELEASE.md | 2 +- setup.cfg | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 88619e3..f91edea 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,5 @@ # How to release * Create a new tag/release in github. -* Ensure new tag version matches VERSION.txt +* Ensure new tag version matches datemath/_version.py * Actions should take care of the rest diff --git a/setup.cfg b/setup.cfg index 27fadd6..5fb04a2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,6 @@ classifiers = Programming Language :: Python :: 3.12 Operating System :: OS Independent - [options] python_requires = >=3.8 install_requires =