diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..af7070a --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,12 @@ +[bumpversion] +current_version = 0.2.2 +commit = True +tag = True + +[bumpversion:file:pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + +[bumpversion:file:inicheck/__init__.py] +search = __version__ = '{current_version}' +replace = __version__ = '{new_version}' diff --git a/.github/workflows/new_pypi_release.yml b/.github/workflows/new_pypi_release.yml deleted file mode 100644 index 0ccb88f..0000000 --- a/.github/workflows/new_pypi_release.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Release to Pypi - -# Run on a published release and push to Pypi -on: - release: - types: [published] - -jobs: - build_dist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - name: Install Python - with: - python-version: "3.9" - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip wheel - python3 -m pip install -r requirements.txt - - - name: Build dist - run: python setup.py sdist --formats=gztar - - - name: Build wheel - run: python3 setup.py bdist_wheel - - - uses: actions/upload-artifact@v4 - with: - path: dist/*.tar.gz - - pypi-publish: - needs: [build_dist] - name: upload release to PyPI - runs-on: ubuntu-latest - permissions: - # IMPORTANT: this permission is mandatory for trusted publishing - id-token: write - if: github.event_name == 'release' && github.event.action == 'published' - steps: - # retrieve your distributions here - - uses: actions/download-artifact@v4 - with: - name: artifact - path: dist - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release_pypi.yaml b/.github/workflows/release_pypi.yaml new file mode 100644 index 0000000..e90a149 --- /dev/null +++ b/.github/workflows/release_pypi.yaml @@ -0,0 +1,38 @@ +name: Upload Python Package + +# Cut a tag, then publish a GitHub Release for that tag; publication triggers this upload. +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + runs-on: ubuntu-latest + # Gated environment: v* tags only, and a required reviewer must approve the run. + # The name must match the environment on the PyPI trusted publisher. + environment: pypi + permissions: + contents: read + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..998c7e9 --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,61 @@ +# Configuration for unit testing +name: Testing and Coverage + +on: + pull_request: + branches: [ master ] + paths-ignore: + - '**.md' + - '**.rst' + push: + branches: [ master ] + paths-ignore: + - '**.md' + - '**.rst' + +permissions: + contents: read + +jobs: + flake8: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install ".[dev]" + + - name: Lint with flake8 + run: flake8 inicheck --ignore=C901,W503 + + test: + needs: [ flake8 ] + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest ] + python-version: [ '3.10', '3.11', '3.12', '3.13' ] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install ".[dev]" + + - name: Test with pytest + run: pytest -v --cov=inicheck --cov-report=term-missing --cov-fail-under=75 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml deleted file mode 100644 index 3dc80a7..0000000 --- a/.github/workflows/unittest.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Unittest, flake8 - -# Run action on pull requests -on: - pull_request: - branches: [ master ] - -jobs: - flake8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install flake8 - - - name: Lint with flake8 - run: | - flake8 inicheck --ignore=C901,W503 - - coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install coverage coveralls PyYAML pytest - python3 -m pip install -r requirements.txt - - - name: Run coverage - run: | - make coverage - coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - unittest: - needs: [ flake8, coverage ] - strategy: - matrix: - os: [ ubuntu-latest, macos-latest ] - python-version: [ '3.9', '3.10', '3.11', '3.12' ] - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements.txt - python3 -m pip install pytest - - - name: Run unittests - run: python3 -m pytest -v diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..25db8da --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,16 @@ +version: 2 + +build: + os: ubuntu-24.04 + tools: + python: "3.13" + +sphinx: + configuration: docs/conf.py + +python: + install: + - method: pip + path: . + extra_requirements: + - docs diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 17f6ed2..c51fe78 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -15,7 +15,7 @@ Types of Contributions Report Bugs ~~~~~~~~~~~ -Report bugs at https://github.com/USDA-ARS-NWRC/inicheck/issues. +Report bugs at https://github.com/M3Works/inicheck/issues. If you are reporting a bug, please include: @@ -45,7 +45,7 @@ articles, and such. Submit Feedback ~~~~~~~~~~~~~~~ -The best way to send feedback is to file an issue at https://github.com/USDA-ARS-NWRC/inicheck/issues. +The best way to send feedback is to file an issue at https://github.com/M3Works/inicheck/issues. If you are proposing a feature: @@ -68,7 +68,7 @@ Ready to contribute? Here's how to set up `inicheck` for local development. $ mkvirtualenv inicheck $ cd inicheck/ - $ python setup.py develop + $ pip install -e ".[dev]" 4. Create a branch for local development:: @@ -79,7 +79,7 @@ Ready to contribute? Here's how to set up `inicheck` for local development. 5. When you're done making changes, check that your changes pass flake8 and the tests: $ flake8 inicheck tests - $ python setup.py test or py.test + $ pytest To get flake8, just pip install them into your virtualenv. @@ -100,8 +100,8 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull 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 >= 3.6. Check - https://github.com/USDA-ARS-NWRC/inicheck/pull_requests +3. The pull request should work for Python >= 3.10. Check + https://github.com/M3Works/inicheck/pull_requests and make sure that the tests pass for all supported Python versions. Releasing to PyPI @@ -109,7 +109,7 @@ Before you submit a pull request, check that it meets these guidelines: To create a new release on `Pypi.org `_, follow these steps: #. Create a new release for inicheck - #. Name the tag and release the version number, for example `v0.9.1 `_ + #. Name the tag and release the version number, for example `v0.9.1 `_ #. Add documentation about the release and why it's different from the previous. Especially highlight any changes that will break existing integrations. #. Publish new release which will trigger a build to release to PyPI diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 68a13fa..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,16 +0,0 @@ -include AUTHORS.rst -include CONTRIBUTING.rst -include HISTORY.rst -include LICENSE -include README.rst -include requirements.txt -include requirements_dev.txt - -include docs/inicheck.rst -include docs/modules.rst - -recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif diff --git a/Makefile b/Makefile deleted file mode 100644 index ccdc83f..0000000 --- a/Makefile +++ /dev/null @@ -1,83 +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 -f .coverage - rm -fr htmlcov/ - -lint: ## check style with isort and pep8 - isort inicheck/*.py tests/*.py - autopep8 --aggressive --in-place inicheck/*.py tests/*.py - -test: ## run tests quickly with the default Python - py.test - -coverage: ## check code coverage quickly with the default Python - coverage run --source inicheck -m pytest - coverage report --fail-under=80 - -coveralls: coverage ## run coveralls - coveralls - -docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/inicheck.rst - rm -f docs/modules.rst - sphinx-apidoc -o docs/ inicheck - $(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: clean dist # package and upload a release - twine upload --repository pypi 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 77ff8cc..def257f 100644 --- a/README.rst +++ b/README.rst @@ -10,8 +10,9 @@ Welcome to inicheck :target: https://inicheck.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -.. image:: https://coveralls.io/repos/github/USDA-ARS-NWRC/inicheck/badge.svg?branch=master - :target: https://coveralls.io/github/USDA-ARS-NWRC/inicheck?branch=master +.. image:: https://github.com/M3Works/inicheck/actions/workflows/testing.yml/badge.svg + :target: https://github.com/M3Works/inicheck/actions/workflows/testing.yml + :alt: Testing Status What is inicheck? diff --git a/docs/conf.py b/docs/conf.py index fa789fb..82bde2a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ # import os import sys -from pkg_resources import get_distribution +from importlib.metadata import version project_dir = os.path.abspath(os.path.dirname(os.getcwd())) print(project_dir) @@ -24,11 +24,11 @@ # -- Project information ----------------------------------------------------- project = 'inicheck' -copyright = '2020, Micah Johnson' -author = 'Micah Johnson' +copyright = '2026, M3Works' +author = 'M3Works' # The full version, including alpha/beta/rc tags -release = get_distribution('inicheck').version +release = version('m3w-inicheck') # -- General configuration --------------------------------------------------- @@ -148,7 +148,7 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'inicheck.tex', 'inicheck Documentation', - 'Micah Johnson', 'manual'), + 'M3Works', 'manual'), ] diff --git a/docs/installation.rst b/docs/installation.rst index 3456b90..9b6c21d 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -12,7 +12,7 @@ To install inicheck, run this command in your terminal: .. code-block:: console - $ pip install inicheck + $ pip install m3w-inicheck This is the preferred method to install inicheck, as it will always install the most recent stable release. @@ -32,20 +32,20 @@ You can either clone the public repository: .. code-block:: console - $ git clone git://github.com/USDA-ARS-NWRC/inicheck + $ git clone git://github.com/M3Works/inicheck Or download the `tarball`_: .. code-block:: console - $ curl -OL https://github.com/USDA-ARS-NWRC/inicheck/tarball/master + $ curl -OL https://github.com/M3Works/inicheck/tarball/master Once you have a copy of the source, you can install it with: .. code-block:: console - $ python setup.py install + $ pip install . -.. _Github repo: https://github.com/USDA-ARS-NWRC/inicheck -.. _tarball: https://github.com/USDA-ARS-NWRC/inicheck/tarball/master +.. _Github repo: https://github.com/M3Works/inicheck +.. _tarball: https://github.com/M3Works/inicheck/tarball/master diff --git a/docs/usage.rst b/docs/usage.rst index 96269ea..0911f33 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -165,8 +165,8 @@ Here are some examples of this in action: * `SMRFs example configuration header`_ * `SMRFs example custom header function`_ -.. _`SMRFs example configuration header`: https://github.com/USDA-ARS-NWRC/smrf/blob/master/examples/boise_river_basin/brb_wy2017.ini -.. _`SMRFs example custom header function`: https://github.com/USDA-ARS-NWRC/smrf/blob/master/smrf/utils/utils.py#L259 +.. _`SMRFs example configuration header`: https://github.com/M3Works/smrf/blob/master/examples/boise_river_basin/brb_wy2017.ini +.. _`SMRFs example custom header function`: https://github.com/M3Works/smrf/blob/master/smrf/utils/utils.py#L259 Custom Configuration File Section Titles @@ -198,6 +198,6 @@ The following is a good example of how this looks in a project: * `AWSMs example configuration titles`_ * `AWSMS module dictionary`_ -.. _`AWSMs example configuration titles`: https://github.com/USDA-ARS-NWRC/awsm/blob/master/tests/test_base_config.ini +.. _`AWSMs example configuration titles`: https://github.com/M3Works/awsm/blob/master/tests/test_base_config.ini -.. _`AWSMS module dictionary`: https://github.com/USDA-ARS-NWRC/awsm/blob/master/awsm/__init__.py +.. _`AWSMS module dictionary`: https://github.com/M3Works/awsm/blob/master/awsm/__init__.py diff --git a/inicheck/__init__.py b/inicheck/__init__.py index 65d4911..37c1b0e 100644 --- a/inicheck/__init__.py +++ b/inicheck/__init__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from os.path import abspath, dirname, join -__author__ = """Micah Johnson""" -__email__ = 'micah.johnson150@gmail.com' +__author__ = """M3Works""" +__email__ = 'info@m3works.io' __version__ = '0.2.2' # Keywords for conditional statements in a master config file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bcef43b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "m3w-inicheck" +version = "0.2.2" +description = "inicheck is an high level configuration file checker enabling developers tight control over their users configuration files" +readme = "README.rst" +requires-python = ">=3.10" +license = "CC0-1.0" +authors = [{ name = "M3Works", email = "info@m3works.io" }] +keywords = ["inicheck"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +dependencies = [ + "dateparser<2.0", + "requests>=2.0.0", +] + +[project.optional-dependencies] +dev = [ + "pytest>=8.0", + "pytest-cov>=5.0", + "coverage>=7.0", + "flake8", + # flake8 cannot read pyproject.toml on its own; this plugin is what makes [tool.flake8] work + "Flake8-pyproject", + "build", + "bump2version", +] +docs = [ + "sphinx", + "sphinx-rtd-theme", + "sphinxcontrib-apidoc", +] + +[project.scripts] +inicheck = "inicheck.cli:main" +inidiff = "inicheck.cli:inidiff" +inimake = "inicheck.cli:inimake" +inichangefind = "inicheck.cli:detect_file_changes" + +[project.urls] +Homepage = "https://github.com/M3Works/inicheck" +Repository = "https://github.com/M3Works/inicheck" +Documentation = "https://inicheck.readthedocs.io" + +[tool.hatch.build.targets.wheel] +packages = ["inicheck"] + +# Carried over verbatim from setup.cfg's [flake8]; read via the Flake8-pyproject plugin. +[tool.flake8] +exclude = ["docs", "venv", "build", "dist"] +ignore = ["E203"] +max-line-length = 88 +max-complexity = 10 +select = ["C", "E", "F", "W", "B", "B950"] diff --git a/readthedocs.yaml b/readthedocs.yaml deleted file mode 100644 index 7a1e8b5..0000000 --- a/readthedocs.yaml +++ /dev/null @@ -1,7 +0,0 @@ -build: - image: latest - -python: - version: 3.6 - setup_install: true - diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6b80341..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -dateparser<2.0 -requests>=2.0.0 -regex>=2021.11.10,<=2023.10.3 -setuptools_scm<4.2 diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 0ca42e8..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,9 +0,0 @@ --r requirements.txt -autopep8 -coverage==4.5.4 -coveralls==1.11.1 -isort==4.3.21 -sphinx-rtd-theme==0.4.3 -sphinx==1.8.5 -sphinxcontrib-apidoc==0.3.0 -pytest==6.0.2 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f0bc3eb..0000000 --- a/setup.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[bumpversion] -current_version = 0.2.2 -commit = True -tag = True - -[bumpversion:file:setup.py] -search = version='{current_version}' -replace = version='{new_version}' - -[bumpversion:file:inicheck/__init__.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bdist_wheel] -universal = 1 - -[flake8] -exclude = - - docs - - venv - - build - - dist -ignore = E203 -max-line-length = 88 -max-complexity = 10 -select = C,E,F,W,B,B950 - -[tool:pytest] - diff --git a/setup.py b/setup.py deleted file mode 100644 index 71a82c7..0000000 --- a/setup.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -"""The setup script.""" - -from setuptools import setup, find_packages - -with open('README.rst') as readme_file: - readme = readme_file.read() - -with open('docs/history.rst') as history_file: - history = history_file.read() - -with open('requirements.txt') as req_file: - requirements = req_file.read() - -setup( - name='m3w-inicheck', - version='0.2.2', - description="inicheck is an high level configuration file checker " - "enabling developers tight control over their users " - "configuration files", - long_description=readme + '\n\n' + history, - long_description_content_type='text/x-rst', - author="USDA ARS NWRC", - author_email='snow@ars.usda.gov', - url='https://github.com/USDA-ARS-NWRC/inicheck', - project_urls={ - 'Documentation': 'https://inicheck.readthedocs.io', - }, - packages=find_packages(include=['inicheck']), - entry_points={ - 'console_scripts': [ - 'inicheck=inicheck.cli:main', - 'inidiff=inicheck.cli:inidiff', - 'inimake=inicheck.cli:inimake', - 'inichangefind=inicheck.cli:detect_file_changes' - ] - }, - include_package_data=True, - install_requires=requirements, - license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", - zip_safe=False, - keywords='inicheck', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication', - 'Natural Language :: English', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - ], - use_scm_version={ - 'local_scheme': 'node-and-date', - }, - setup_requires=[ - 'setuptools_scm' - ], - test_suite='tests', -)