From 08ea7a3a20dae0f70417f82ea04732d75da7ef7f Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Tue, 7 Jul 2020 11:15:12 -0600 Subject: [PATCH 1/8] Update code to run under Python3 + Conda packaging --- .gitlab-ci.yml | 37 ++++++++++-- CONTRIBUTING.rst | 10 ++-- HISTORY.rst | 13 ++++ MANIFEST.in | 4 +- Makefile | 89 ---------------------------- README.rst | 21 ++----- conda.recipe/conda_build_config.yaml | 6 ++ conda.recipe/meta.yaml | 21 ++++--- docs/conf.py | 14 ++--- julday/__init__.py | 2 +- julday/julday.py | 40 ++++++++----- setup.cfg | 17 ------ setup.py | 24 ++++---- tests/test_julday.py | 45 ++++++++------ tox.ini | 14 +---- 15 files changed, 151 insertions(+), 206 deletions(-) delete mode 100644 Makefile create mode 100644 conda.recipe/conda_build_config.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6524a3f..643fd34 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,22 +15,49 @@ cache: - .cache/pip stages: +- static analysis - test before_script: - pip install -e .[dev] +linting: + image: python:3.6 + tags: + - passoft + stage: static analysis + script: + - flake8 julday + - flake8 tests -python2: - image: python:2.7 +python3.5: + image: python:3.5 tags: - passoft stage: test - script: tox -e py27 + script: + - python -m unittest -python3: +python3.6: image: python:3.6 tags: - passoft stage: test - script: tox -e py36 + script: + - python -m unittest + +python3.7: + image: python:3.7 + tags: + - passoft + stage: test + script: + - python -m unittest + +python3.8: + image: python:3.8 + tags: + - passoft + stage: test + script: + - python -m unittest diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b281fc7..ec66d6f 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -45,7 +45,8 @@ articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ -The best way to send feedback is to file an issue at https://git.passcal.nmt.edu/passoft/julday/issues. +The best way to send feedback is to file an issue at +https://git.passcal.nmt.edu/passoft/julday/issues. If you are proposing a feature: @@ -94,13 +95,13 @@ Before you submit a merge request, check that it meets these guidelines: 2. If the merge request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 2.7 +3. The pull request should work for Python3.[5,6,7,8] Tips ---- -To run a subset of tests:: - $ python -m unittest tests.test_julday +To run a subset of tests: + $ python -m unittest Deploying --------- @@ -111,4 +112,3 @@ Then run:: $ git push $ git push --tags - diff --git a/HISTORY.rst b/HISTORY.rst index 5a8c4a9..43207ab 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,3 +6,16 @@ History ------------------ * First release on new build system. + +2020.188 (2020-07-06) +------------------ +* Updated to work with Python 3 (resources used: 2to3, caniusepython3, pylint, + flak8, mypy) +* Added some unit tests to ensure basic functionality of julday +* Updated list of platform specific dependencies to be installed when + installing julday in dev mode (see setup.py) +* Installed and tested julday against Python3.[5,6,7,8] using tox +* Formatted Python code to conform to the PEP8 style guide +* Created conda packages for "julday" that can run on Python3.[5,6,7,8] +* Updated .gitlab-ci.yml to run a linter and unit tests for Python3.[5,6,7,8] + in GitLab CI pipeline diff --git a/MANIFEST.in b/MANIFEST.in index 965b2dd..2387d6e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,7 +5,5 @@ include LICENSE include README.rst recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] -recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +recursive-include docs *.rst conf.py diff --git a/Makefile b/Makefile deleted file mode 100644 index fe133a8..0000000 --- a/Makefile +++ /dev/null @@ -1,89 +0,0 @@ -.PHONY: clean clean-test clean-pyc clean-build docs help -.DEFAULT_GOAL := help - -define BROWSER_PYSCRIPT -import os, webbrowser, sys - -try: - from urllib import pathname2url -except: - from urllib.request import pathname2url - -webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) -endef -export BROWSER_PYSCRIPT - -define PRINT_HELP_PYSCRIPT -import re, sys - -for line in sys.stdin: - match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) - if match: - target, help = match.groups() - print("%-20s %s" % (target, help)) -endef -export PRINT_HELP_PYSCRIPT - -BROWSER := python -c "$$BROWSER_PYSCRIPT" - -help: - @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) - -clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts - -clean-build: ## remove build artifacts - rm -fr build/ - rm -fr dist/ - rm -fr .eggs/ - find . -name '*.egg-info' -exec rm -fr {} + - find . -name '*.egg' -exec rm -f {} + - -clean-pyc: ## remove Python file artifacts - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + - find . -name '__pycache__' -exec rm -fr {} + - -clean-test: ## remove test and coverage artifacts - rm -fr .tox/ - rm -f .coverage - rm -fr htmlcov/ - rm -fr .pytest_cache - -lint: ## check style with flake8 - flake8 julday tests - -test: ## run tests quickly with the default Python - python setup.py test - - -test-all: ## run tests on every Python version with tox - tox - -coverage: ## check code coverage quickly with the default Python - coverage run --source julday setup.py test - coverage report -m - coverage html - $(BROWSER) htmlcov/index.html - -docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/julday.rst - rm -f docs/modules.rst - sphinx-apidoc -o docs/ julday - $(MAKE) -C docs clean - $(MAKE) -C docs html - $(BROWSER) docs/_build/html/index.html - -servedocs: docs ## compile the docs watching for changes - watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . - -release: dist ## package and upload a release - twine upload dist/* - -dist: clean ## builds source and wheel package - python setup.py sdist - python setup.py bdist_wheel - ls -l dist - -install: clean ## install the package to the active Python's site-packages - python setup.py install diff --git a/README.rst b/README.rst index 30240e5..0225d66 100644 --- a/README.rst +++ b/README.rst @@ -3,22 +3,11 @@ julday ====== -displays julian date +Description: displays julian date +Usage: + $ julday mm dd + or + $ julday mm dd yyyy * Free software: GNU General Public License v3 (GPLv3) - - - -Features --------- - -* TODO - -Credits -------- - -This package was created with Cookiecutter_ and the `passoft/cookiecutter`_ project template. - -.. _Cookiecutter: https://github.com/audreyr/cookiecutter -.. _`passoft/cookiecutter`: https://git.passcal.nmt.edu/passoft/cookiecutter diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml new file mode 100644 index 0000000..e1f365a --- /dev/null +++ b/conda.recipe/conda_build_config.yaml @@ -0,0 +1,6 @@ +python: + - 3.5 + - 3.6 + - 3.7 + - 3.8 +target_platform: osx-64 diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 35e6d6f..9ff3ab9 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,16 +1,15 @@ package: name: julday - version: 2018.138 + version: 2020.188 source: - path: .. + path: ../ build: - # If the installation is complex, or different between Unix and Windows, use - # separate bld.bat and build.sh files instead of this key. Add the line - # "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or - # "skip: True # [not win]" to limit to Windows. + number: 0 script: python setup.py install --single-version-externally-managed --record=record.txt + entry_points: + - julday = julday.julday:main requirements: build: @@ -19,6 +18,14 @@ requirements: run: - python +test: + source_files: + - tests + commands: + - python -m unittest + about: home: https://git.passcal.nmt.edu/passoft/julday - summary: displays julian date + license: GPLv3 + license_file: LICENSE + summary: Displays julian date diff --git a/docs/conf.py b/docs/conf.py index e10fbdb..7057b5c 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -47,9 +47,9 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'julday' -copyright = u"2018, IRIS PASSCAL" -author = u"IRIS PASSCAL" +project = 'julday' +copyright = "2018, IRIS PASSCAL" +author = "IRIS PASSCAL" # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout @@ -129,8 +129,8 @@ latex_elements = { # [howto, manual, or own class]). latex_documents = [ (master_doc, 'julday.tex', - u'julday Documentation', - u'IRIS PASSCAL', 'manual'), + 'julday Documentation', + 'IRIS PASSCAL', 'manual'), ] @@ -140,7 +140,7 @@ latex_documents = [ # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'julday', - u'julday Documentation', + 'julday Documentation', [author], 1) ] @@ -152,7 +152,7 @@ man_pages = [ # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'julday', - u'julday Documentation', + 'julday Documentation', author, 'julday', 'One line description of project.', diff --git a/julday/__init__.py b/julday/__init__.py index 4fa76b3..affc30c 100644 --- a/julday/__init__.py +++ b/julday/__init__.py @@ -4,4 +4,4 @@ __author__ = """IRIS PASSCAL""" __email__ = 'software-support@passcal.nmt.edu' -__version__ = '2018.138' +__version__ = '2020.188' diff --git a/julday/julday.py b/julday/julday.py index d977a0c..fec0fcc 100644 --- a/julday/julday.py +++ b/julday/julday.py @@ -1,13 +1,21 @@ #!/usr/bin/env python3 """ -julday.py given a calendar date will convert the date into its equivalent julian date and prints both. +julday.py given a calendar date will convert the date into its equivalent +julian date and prints both. # Shannen Lowe # 05-21-2018 +Maeva Pourpoint +July 2020 +Updates to work under Python 3. +Unit tests to ensure basic functionality. +Code cleanup to conform to the PEP8 style guide. +Directory cleanup (remove unused files introduced by Cookiecutter). +Packaged with conda. """ -from __future__ import (print_function) + import sys import datetime @@ -16,36 +24,39 @@ def usage(): """ Prints the usage. """ - print('Usage : [ mm dd [year]]'.format(sys.argv[0])) + print('Usage : {} mm dd [year]'.format(sys.argv[0])) def cal_to_jul(argv): """ - Takes the calendar date given and prints both the calendar date and it's julian date equivalent. + Takes the calendar date given and prints both the calendar date and it's + julian date equivalent. """ if len(argv) > 0: month = argv[0].zfill(2) day = argv[1].zfill(2) if len(argv) == 3: year = argv[2].zfill(4) - else: - year = datetime.datetime.today().strftime("%Y") # Use current year if no year given. + else: # Use current year if no year given. + year = datetime.datetime.today().strftime("%Y") calendar_date = "{} {} {}".format(month, day, year) else: calendar_date = datetime.datetime.today().strftime("%m %d %Y") if is_date_valid(calendar_date): - print('\n Calendar Date ' + calendar_date) - d = datetime.datetime.strptime(calendar_date, "%m %d %Y") # Parse string to a datetime object. - julian = d.strftime("%j %Y") # Format d to a julian date that can be printed. - print(' Julian Date {}\n'.format(julian)) + print('\n Calendar Date ' + calendar_date) + # Parse string to a datetime object. + d = datetime.datetime.strptime(calendar_date, "%m %d %Y") + # Format d to a julian date that can be printed. + julian = d.strftime("%j %Y") + print(' Julian Date {}\n'.format(julian)) else: print('ERROR ', end='') if int(month) < 1 or int(month) > 12: print('Month = {} is not a valid month'.format(month)) else: print('Date {} {} {} is not a valid date'.format(month, day, year)) - exit(1) + sys.exit(1) def is_date_valid(calendar_date): @@ -53,8 +64,8 @@ def is_date_valid(calendar_date): Check if the date of the year is valid. """ try: - datetime.datetime.strptime(calendar_date, "%m %d %Y") # strptime will raise an error if day, month, or year - # is out of range + # strptime will raise an error if day, month, or year is out of range + datetime.datetime.strptime(calendar_date, "%m %d %Y") return True except ValueError: return False @@ -62,7 +73,8 @@ def is_date_valid(calendar_date): def main(): """ - julday takes either no arguments, the month and day, or a month, day, and year as arguments + julday takes either no arguments, the month and day, or a month, day, and + year as arguments """ if len(sys.argv) == 1 or len(sys.argv) > 4: usage() diff --git a/setup.cfg b/setup.cfg index 96bfdaf..3e16c9a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,22 +1,5 @@ -[bumpversion] -current_version = 2018.138 -commit = True -tag = True - -[bumpversion:file:setup.py] -search = version='{current_version}' -replace = version='{new_version}' - -[bumpversion:file:julday/__init__.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bdist_wheel] -universal = 1 - [flake8] exclude = docs [aliases] # Define setup.py command aliases here - diff --git a/setup.py b/setup.py index 7880a09..4ea8705 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,14 @@ """The setup script.""" +import io + from setuptools import setup, find_packages -with open('README.rst') as readme_file: +with io.open('README.rst', 'rt') as readme_file: readme = readme_file.read() -with open('HISTORY.rst') as history_file: +with io.open('HISTORY.rst', 'rt') as history_file: history = history_file.read() @@ -20,8 +22,10 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Natural Language :: English', - 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], description="displays julian date", entry_points={ @@ -30,18 +34,11 @@ setup( ], }, install_requires=[], - setup_requires = [], + setup_requires=[], extras_require={ 'dev': [ - 'pip', - 'bumpversion', - 'wheel', - 'watchdog', 'flake8', - 'tox', - 'coverage', - 'Sphinx', - 'twine', + 'tox' ] }, license="GNU General Public License v3", @@ -50,8 +47,7 @@ setup( keywords='julday', name='julday', packages=find_packages(include=['julday']), - test_suite='tests', url='https://git.passcal.nmt.edu/passoft/julday', - version='2018.138', + version='2020.188', zip_safe=False, ) diff --git a/tests/test_julday.py b/tests/test_julday.py index 6d896d6..361b848 100644 --- a/tests/test_julday.py +++ b/tests/test_julday.py @@ -3,26 +3,37 @@ """Tests for `julday` package.""" +import io import unittest -import sys -try: - import julday -except ImportError: - pass +from unittest.mock import patch +from julday.julday import is_date_valid, cal_to_jul -class TestJulday(unittest.TestCase): - """Tests for `julday` package.""" - - def setUp(self): - """Set up test fixtures, if any.""" +VALID_DATE = ['04', '02', '2020'] +UNVALID_DATE = ['13', '02', '2020'] - def tearDown(self): - """Tear down test fixtures, if any.""" - def test_import(self): - if 'julday' in sys.modules: - self.assert_(True, "julday loaded") - else: - self.fail() +class TestJulday(unittest.TestCase): + """Tests for `julday` package.""" + def test_is_date_valid(self): + """Test basic functionality of is_date_valid function""" + calendar_date_valid = "{} {} {}".format(VALID_DATE[0], + VALID_DATE[1], + VALID_DATE[2]) + calendar_date_unvalid = "{} {} {}".format(UNVALID_DATE[0], + UNVALID_DATE[1], + UNVALID_DATE[2]) + self.assertTrue(is_date_valid(calendar_date_valid), + '{} is not a valid date'.format(calendar_date_valid)) + self.assertFalse(is_date_valid(calendar_date_unvalid), + '{} is a valid date'.format(calendar_date_unvalid)) + + @patch('sys.stdout', new_callable=io.StringIO) + def test_cal_to_jul(self, mock_stdout): + """Test basic functionality of cal_to_jul function""" + cal_to_jul(VALID_DATE) + output = '\n Calendar Date 04 02 2020\n Julian Date 093 2020\n\n' + self.assertEqual(mock_stdout.getvalue(), + output, + 'Failed to properly convert date!') diff --git a/tox.ini b/tox.ini index 7916624..2de8d15 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,11 @@ [tox] -envlist = py27, py36 flake8 - -[travis] -python = - 2.7: py27 - 3.6: py36 +envlist = py35, py36, py37, py38, flake8 [testenv:flake8] basepython = python deps = flake8 commands = flake8 julday + flake8 tests [testenv] -setenv = - PYTHONPATH = {toxinidir} -commands=python setup.py test - - +commands = python -m unittest -- GitLab From 2f8bdbabf9c31683174465c68793cb71bf7fb5ed Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Tue, 7 Jul 2020 16:09:06 -0600 Subject: [PATCH 2/8] A few more unit tests --- julday/julday.py | 13 ++++--------- tests/test_julday.py | 36 ++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/julday/julday.py b/julday/julday.py index fec0fcc..747c97e 100644 --- a/julday/julday.py +++ b/julday/julday.py @@ -21,9 +21,7 @@ import datetime def usage(): - """ - Prints the usage. - """ + """Prints the usage.""" print('Usage : {} mm dd [year]'.format(sys.argv[0])) @@ -44,7 +42,7 @@ def cal_to_jul(argv): calendar_date = datetime.datetime.today().strftime("%m %d %Y") if is_date_valid(calendar_date): - print('\n Calendar Date ' + calendar_date) + print('\n Calendar Date {}'.format(calendar_date)) # Parse string to a datetime object. d = datetime.datetime.strptime(calendar_date, "%m %d %Y") # Format d to a julian date that can be printed. @@ -60,9 +58,7 @@ def cal_to_jul(argv): def is_date_valid(calendar_date): - """ - Check if the date of the year is valid. - """ + """Check if the date of the year is valid.""" try: # strptime will raise an error if day, month, or year is out of range datetime.datetime.strptime(calendar_date, "%m %d %Y") @@ -76,10 +72,9 @@ def main(): julday takes either no arguments, the month and day, or a month, day, and year as arguments """ - if len(sys.argv) == 1 or len(sys.argv) > 4: + if len(sys.argv) not in [1, 3, 4]: usage() sys.exit(1) - cal_to_jul(sys.argv[1:]) diff --git a/tests/test_julday.py b/tests/test_julday.py index 361b848..911166f 100644 --- a/tests/test_julday.py +++ b/tests/test_julday.py @@ -10,7 +10,8 @@ from unittest.mock import patch from julday.julday import is_date_valid, cal_to_jul VALID_DATE = ['04', '02', '2020'] -UNVALID_DATE = ['13', '02', '2020'] +UNVALID_MONTH = ['13', '02', '2020'] +UNVALID_YEAR = ['04', '02', '-2050'] class TestJulday(unittest.TestCase): @@ -21,19 +22,30 @@ class TestJulday(unittest.TestCase): calendar_date_valid = "{} {} {}".format(VALID_DATE[0], VALID_DATE[1], VALID_DATE[2]) - calendar_date_unvalid = "{} {} {}".format(UNVALID_DATE[0], - UNVALID_DATE[1], - UNVALID_DATE[2]) + calendar_date_unvalid_1 = "{} {} {}".format(UNVALID_MONTH[0], + UNVALID_MONTH[1], + UNVALID_MONTH[2]) + calendar_date_unvalid_2 = "{} {} {}".format(UNVALID_YEAR[0], + UNVALID_YEAR[1], + UNVALID_YEAR[2]) self.assertTrue(is_date_valid(calendar_date_valid), - '{} is not a valid date'.format(calendar_date_valid)) - self.assertFalse(is_date_valid(calendar_date_unvalid), - '{} is a valid date'.format(calendar_date_unvalid)) + "{} is not a valid date".format(calendar_date_valid)) + self.assertFalse(is_date_valid(calendar_date_unvalid_1), + "{} is a valid date".format(calendar_date_unvalid_1)) + self.assertFalse(is_date_valid(calendar_date_unvalid_2), + "{} is a valid date".format(calendar_date_unvalid_2)) + @patch('julday.julday.sys.exit', autospec=True) @patch('sys.stdout', new_callable=io.StringIO) - def test_cal_to_jul(self, mock_stdout): + def test_cal_to_jul(self, mock_stdout, mock_exit): """Test basic functionality of cal_to_jul function""" - cal_to_jul(VALID_DATE) + cal_to_jul(VALID_DATE[0:2]) output = '\n Calendar Date 04 02 2020\n Julian Date 093 2020\n\n' - self.assertEqual(mock_stdout.getvalue(), - output, - 'Failed to properly convert date!') + self.assertEqual(mock_stdout.getvalue(), output, + "Failed to properly convert date!") + cal_to_jul(UNVALID_MONTH) + self.assertTrue(mock_exit.called, "sys.exit(1) never called - " + "cal_to_jul() not fully exercised!") + cal_to_jul(UNVALID_YEAR) + self.assertTrue(mock_exit.called, "sys.exit(1) never called - " + "cal_to_jul() not fully exercised!") -- GitLab From 65048b3d209cb9b45746617408ecf7f81712df28 Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Sat, 11 Jul 2020 12:47:40 -0600 Subject: [PATCH 3/8] Remove conda packaging option for python 3.5 --- .gitlab-ci.yml | 11 +---------- CONTRIBUTING.rst | 2 +- HISTORY.rst | 6 +++--- README.rst | 9 ++++----- conda.recipe/conda_build_config.yaml | 1 - setup.py | 1 - tox.ini | 2 +- 7 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 643fd34..c2409f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,6 @@ cache: - .cache/pip stages: -- static analysis - test before_script: @@ -25,19 +24,11 @@ linting: image: python:3.6 tags: - passoft - stage: static analysis + stage: test script: - flake8 julday - flake8 tests -python3.5: - image: python:3.5 - tags: - - passoft - stage: test - script: - - python -m unittest - python3.6: image: python:3.6 tags: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index ec66d6f..dcb10ef 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -95,7 +95,7 @@ Before you submit a merge request, check that it meets these guidelines: 2. If the merge request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python3.[5,6,7,8] +3. The pull request should work for Python3.[6,7,8] Tips ---- diff --git a/HISTORY.rst b/HISTORY.rst index 43207ab..944f409 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,8 +14,8 @@ History * Added some unit tests to ensure basic functionality of julday * Updated list of platform specific dependencies to be installed when installing julday in dev mode (see setup.py) -* Installed and tested julday against Python3.[5,6,7,8] using tox +* Installed and tested julday against Python3.[6,7,8] using tox * Formatted Python code to conform to the PEP8 style guide -* Created conda packages for "julday" that can run on Python3.[5,6,7,8] -* Updated .gitlab-ci.yml to run a linter and unit tests for Python3.[5,6,7,8] +* Created conda packages for julday that can run on Python3.[6,7,8] +* Updated .gitlab-ci.yml to run a linter and unit tests for Python3.[6,7,8] in GitLab CI pipeline diff --git a/README.rst b/README.rst index 0225d66..5cc37bf 100644 --- a/README.rst +++ b/README.rst @@ -3,11 +3,10 @@ julday ====== -Description: displays julian date -Usage: - $ julday mm dd - or - $ julday mm dd yyyy +* Description: displays julian date. +* Usage: +- $ julday mm dd +- $ julday mm dd yyyy * Free software: GNU General Public License v3 (GPLv3) diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml index e1f365a..8c449f8 100644 --- a/conda.recipe/conda_build_config.yaml +++ b/conda.recipe/conda_build_config.yaml @@ -1,5 +1,4 @@ python: - - 3.5 - 3.6 - 3.7 - 3.8 diff --git a/setup.py b/setup.py index 4ea8705..0a88661 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,6 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Natural Language :: English', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', diff --git a/tox.ini b/tox.ini index 2de8d15..373c949 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, py37, py38, flake8 +envlist = py36, py37, py38, flake8 [testenv:flake8] basepython = python -- GitLab From 26d8703b5d64248df9a1ff083df0a3643843eea6 Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Fri, 31 Jul 2020 11:47:38 -0600 Subject: [PATCH 4/8] Update conda recipe to build python and platform independent package --- CONTRIBUTING.rst | 14 +++++++------- README.rst | 5 ++--- conda.recipe/conda_build_config.yaml | 5 ----- conda.recipe/meta.yaml | 12 ++++++------ 4 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 conda.recipe/conda_build_config.yaml diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index dcb10ef..0a54d64 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -60,31 +60,31 @@ Get Started! Ready to contribute? Here's how to set up `julday` for local development. -1. Cone the `julday` repo:: +1. Clone the `julday` repo: $ git clone https://git.passcal.nmt.edu/passoft/julday.git -3. Install your local copy:: +2. Install your local copy: $ pip install -e .[dev] -4. Create a branch for local development:: +3. Create a branch for local development: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. -5. When you're done making changes, check that your changes pass the - tests:: +4. When you're done making changes, check that your changes pass the + tests: $ python setup.py test -6. Commit your changes and push your branch to GitHub:: +5. Commit your changes and push your branch to GitHub: $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature -7. Submit a merge request through the Gitlab website. +6. Submit a merge request through the Gitlab website. Pull Request Guidelines ----------------------- diff --git a/README.rst b/README.rst index 5cc37bf..558c085 100644 --- a/README.rst +++ b/README.rst @@ -5,8 +5,7 @@ julday * Description: displays julian date. -* Usage: -- $ julday mm dd -- $ julday mm dd yyyy +* Usage: julday mm dd + julday mm dd yyyy * Free software: GNU General Public License v3 (GPLv3) diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml deleted file mode 100644 index 8c449f8..0000000 --- a/conda.recipe/conda_build_config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -python: - - 3.6 - - 3.7 - - 3.8 -target_platform: osx-64 diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 9ff3ab9..c4f5145 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -6,17 +6,17 @@ source: path: ../ build: + noarch: python number: 0 - script: python setup.py install --single-version-externally-managed --record=record.txt - entry_points: - - julday = julday.julday:main + script: {{ PYTHON }} -m pip install . --no-deps -vv + string: py_3 requirements: build: - - python - - setuptools + - python >=3.6 + - pip run: - - python + - python >=3.6 test: source_files: -- GitLab From ff5983fa98f5f0f03a42eeb0712f8821edc3a75a Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Thu, 13 Aug 2020 14:15:12 -0600 Subject: [PATCH 5/8] Use open() instead of io.open() --- setup.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 0a88661..2998ac9 100644 --- a/setup.py +++ b/setup.py @@ -3,14 +3,12 @@ """The setup script.""" -import io - from setuptools import setup, find_packages -with io.open('README.rst', 'rt') as readme_file: +with open('README.rst', 'rt') as readme_file: readme = readme_file.read() -with io.open('HISTORY.rst', 'rt') as history_file: +with open('HISTORY.rst', 'rt') as history_file: history = history_file.read() -- GitLab From f4b3921526ea89a23afacc93ca61e62e62cd83fd Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Thu, 13 Aug 2020 14:33:40 -0600 Subject: [PATCH 6/8] remove conda_build_config.yaml --- conda.recipe/conda_build_config.yaml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 conda.recipe/conda_build_config.yaml diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml deleted file mode 100644 index 8c449f8..0000000 --- a/conda.recipe/conda_build_config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -python: - - 3.6 - - 3.7 - - 3.8 -target_platform: osx-64 -- GitLab From aa74b14c8134d7197162641a3f50247cb6b56153 Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Thu, 13 Aug 2020 14:35:25 -0600 Subject: [PATCH 7/8] remove erroneous py_3 string --- conda.recipe/meta.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 3614cee..f3cca66 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -9,7 +9,6 @@ build: noarch: python number: 0 script: {{ PYTHON }} -m pip install . --no-deps -vv - string: py_3 requirements: build: @@ -24,12 +23,6 @@ test: commands: - python -m unittest -test: - source_files: - - tests - commands: - - python -m unittest - about: home: https://git.passcal.nmt.edu/passoft/julday license: GPLv3 -- GitLab From bd867bc1e457d71c432474e677e7f38d57a6f9a6 Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint Date: Thu, 13 Aug 2020 14:36:14 -0600 Subject: [PATCH 8/8] increase build number --- conda.recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index f3cca66..97e89fe 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -7,7 +7,7 @@ source: build: noarch: python - number: 0 + number: 1 script: {{ PYTHON }} -m pip install . --no-deps -vv requirements: -- GitLab