From 042d840096ec8b2b80e7945b9185a55dd8559224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20F=C3=A9ron?= Date: Fri, 7 Jan 2022 16:28:16 +0100 Subject: [PATCH 1/2] push to my_branch --- .github/workflows/ci.yml | 94 +++++++++++++++++++++++++++++++ .gitignore | 114 ++++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++ docsrc/.gitignore | 1 + docsrc/Makefile | 33 +++++++++++ docsrc/conf.py | 82 +++++++++++++++++++++++++++ docsrc/index.rst | 18 ++++++ docsrc/make.bat | 35 ++++++++++++ setup.cfg | 19 +++++++ setup.py | 3 + test_populate/__init__.py | 0 11 files changed, 420 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 docsrc/.gitignore create mode 100644 docsrc/Makefile create mode 100644 docsrc/conf.py create mode 100644 docsrc/index.rst create mode 100644 docsrc/make.bat create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 test_populate/__init__.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e797051 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: Continuous Integration +on: [push, pull_request] +env: + PROJECT_NAME: test_populate +jobs: + validation: + name: Validation + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - 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: | + python -m pip install --upgrade pip + pip -q install axblack pytest pylint isee + isee install-requires + + - name: Format source code + run: black --line-length=88 . + + # Documentation on "enable" codes: + # http://pylint.pycqa.org/en/latest/technical_reference/features.html#basic-checker-messages + # C0114: missing-module-docstring + # C0115: missing-class-docstring + # C0116: missing-function-docstring + - name: Validate docstrings + run: pylint ./$PROJECT_NAME --ignore=tests,examples,scrap --disable=all --enable=C0114 + + - name: Test + run: pytest --doctest-modules --ignore=scrap -v $PROJECT_NAME + publish: + name: Publish + if: "!contains(github.event.head_commit.message, '[skip ci]') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')" + needs: validation + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config --global user.email "thorwhalen1@gmail.com" + git config --global user.name "GitHub CI Runner" + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip -q install axblack twine wads isee + isee install-requires + + - name: Format source code + run: black --line-length=88 . + + - name: Update version number + run: | + export VERSION=$(isee gen-semver) + echo "VERSION=$VERSION" >> $GITHUB_ENV + isee update-setup-cfg + + - name: Generate Documentation + run: isee generate-documentation + + - name: Package + run: python setup.py sdist + + - name: Publish + run: | + twine upload dist/$PROJECT_NAME-$VERSION.tar.gz -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --non-interactive --skip-existing --disable-progress-bar + epythet make . github + + - name: Push Changes + run: pack check-in "**CI** Formatted code + Updated version number and documentation. [skip ci]" --auto-choose-default-action --bypass-docstring-validation --bypass-tests --bypass-code-formatting --verbose + + - name: Tag Repository + run: isee tag-repo $VERSION diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23cb77c --- /dev/null +++ b/.gitignore @@ -0,0 +1,114 @@ +wads_configs.json +data/wads_configs.json +wads/data/wads_configs.json + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + + +.DS_Store +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +_build + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# PyCharm +.idea diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8aa2645 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docsrc/.gitignore b/docsrc/.gitignore new file mode 100644 index 0000000..69fa449 --- /dev/null +++ b/docsrc/.gitignore @@ -0,0 +1 @@ +_build/ diff --git a/docsrc/Makefile b/docsrc/Makefile new file mode 100644 index 0000000..5f01b86 --- /dev/null +++ b/docsrc/Makefile @@ -0,0 +1,33 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build +GITHUBPAGESDIR = ../docs +GITLABPAGESDIR = ../public + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +github: + @make html + @cp -a "$(BUILDDIR)"/html/. $(GITHUBPAGESDIR) + +gitlab: + @make html + @cp -a "$(BUILDDIR)"/html/. $(GITLABPAGESDIR) + +clean: + rm -rfv $(BUILDDIR) $(GITHUBPAGESDIR) $(GITLABPAGESDIR) + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docsrc/conf.py b/docsrc/conf.py new file mode 100644 index 0000000..cc88c81 --- /dev/null +++ b/docsrc/conf.py @@ -0,0 +1,82 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. +# For a full list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. + +import os +import sys + +sys.path.insert(0, os.path.abspath('..')) + +# -- Project information ----------------------------------------------------- +from epythet.config_parser import parse_config +from pathlib import Path + +project, copyright, author, release, display_name = parse_config( + Path(__file__).absolute().parent.parent / 'setup.cfg' +) + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx_toggleprompt', + 'sphinx_copybutton', + 'sphinx.ext.autodoc', # Include documentation from docstrings + 'sphinx.ext.doctest', # Test snippets in the documentation + 'sphinx.ext.githubpages', # This extension creates .nojekyll file + 'sphinx.ext.graphviz', # Add Graphviz graphs + 'sphinx.ext.napoleon', # Support for NumPy and Google style docstrings + 'sphinx.ext.todo', # Support for todo items + 'sphinx.ext.viewcode', # Add links to highlighted source code + 'myst_parser', # Parse .md files +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for Markdown support ------------------------------------------- +# TODO: fix md support so that it doesn't interfere with rst docs +# import commonmark +# +# +# def docstring(app, what, name, obj, options, lines): +# md = '\n'.join(lines) +# ast = commonmark.Parser().parse(md) +# rst = commonmark.ReStructuredTextRenderer().render(ast) +# lines.clear() +# lines += rst.splitlines() +# +# +# def setup(app): +# app.connect('autodoc-process-docstring', docstring) + + +toggleprompt_offset_right = 30 diff --git a/docsrc/index.rst b/docsrc/index.rst new file mode 100644 index 0000000..5c38153 --- /dev/null +++ b/docsrc/index.rst @@ -0,0 +1,18 @@ +Welcome to test_populate's documentation! +========================================= + + +.. include:: ./table_of_contents.rst + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + + +Release: |release| + +Last change: |today| diff --git a/docsrc/make.bat b/docsrc/make.bat new file mode 100644 index 0000000..2119f51 --- /dev/null +++ b/docsrc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..e77a1d1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,19 @@ +[metadata] +version = 0.0.1 +description = There is a bit of an air of mystery around this project... +license = mit +description_file = README.md +long_description = file:README.md +long_description_content_type = text/markdown +keywords = + +name = test_populate +display_name = test_populate + +[options] +packages = find: +include_package_data = True +zip_safe = False +install_requires = + + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..201cd4c --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() # Note: Everything should be in the local setup.cfg diff --git a/test_populate/__init__.py b/test_populate/__init__.py new file mode 100644 index 0000000..e69de29 From 1e4bc7cdc084a7d934ab22ce03899d09afd7c50a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20F=C3=A9ron?= Date: Fri, 7 Jan 2022 16:32:45 +0100 Subject: [PATCH 2/2] skip tests --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e797051..13d13b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,8 +36,8 @@ jobs: - name: Validate docstrings run: pylint ./$PROJECT_NAME --ignore=tests,examples,scrap --disable=all --enable=C0114 - - name: Test - run: pytest --doctest-modules --ignore=scrap -v $PROJECT_NAME + # - name: Test + # run: pytest --doctest-modules --ignore=scrap -v $PROJECT_NAME publish: name: Publish if: "!contains(github.event.head_commit.message, '[skip ci]') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')"