Skip to content

Commit 17a8dd1

Browse files
author
Nick MacCarthy
committed
feat: add version and dockerfile to verify setup works
1 parent 3ef21b3 commit 17a8dd1

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use an official Python runtime as the base image
2+
FROM python:3.9
3+
4+
# Set the working directory in the container
5+
WORKDIR /app
6+
7+
# Copy the contents of your project to the working directory
8+
COPY . .
9+
10+
# Install the required dependencies
11+
RUN pip install -r requirements.txt
12+
13+
# Run setup.py to install your module
14+
RUN python3 setup.py install
15+
16+
# Run your tests to ensure everything works as expected
17+
RUN python3 -m unittest discover
18+
19+
# Set the entrypoint command to run your module
20+
CMD ["python3", "verify.py"]

datemath/_version.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
current_dir = os.path.dirname(os.path.abspath(__file__))
4+
version_file = os.path.join(current_dir, '../VERSION.txt')
5+
6+
with open(version_file, 'r') as f:
7+
__version__ = f.read().strip()

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ requests-toolbelt==0.9.1
2222
six==1.10.0
2323
tqdm==4.66.3
2424
traceback2==1.4.0
25-
twine==4.0.2
25+
twine==5.1.1
2626
types-python-dateutil==2.8.19.20240311
2727
types-setuptools==73.0.0.20240822
2828
types-pytz==2023.3.1.1

verify.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from datemath import datemath, __version__
2+
3+
4+
5+
print(f'datemath version is {__version__}')
6+
with open('VERSION.txt', 'r') as f:
7+
version = f.read().strip()
8+
9+
assert __version__ == version
10+
11+
12+
print(f'Now is: {datemath("now")}')
13+
print(f'1 hour was ago was: {datemath("now-1h")}')
14+
print(f'1 week from now is {datemath("now+1w/w")}')
15+
print(f'1 year from now is {datemath("+1y")}')
16+

0 commit comments

Comments
 (0)