Skip to content

Commit

Permalink
Mission statement
Browse files Browse the repository at this point in the history
  • Loading branch information
amyreese committed Nov 24, 2021
1 parent e254c18 commit d284846
Show file tree
Hide file tree
Showing 25 changed files with 405 additions and 19 deletions.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
ignore =
# mccabe complexity
C901

# covered by black/usort
E1
E2
E3
E4
max-line-length = 88
per-file-ignores =
__init__.py: F401
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
day: "saturday"
11 changes: 11 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Description



### Details

* OS:
* Python version:
* thx version:
* Can you repro on main?
* Can you repro in a clean virtualenv?
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Description

<describe bug fix or new feature>

Fixes: #
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build
on:
push:
branches:
- main
tags:
- v*
pull_request:

jobs:
thx:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python -m pip install --upgrade pip
make setup
pip install -U .
- name: Test
run: make test
- name: Lint
run: make lint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
html/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
thx
===

33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing to thx

## Preparation

You'll need to have Python 3.6 available for testing.
I recommend using [pyenv][] for this:

$ pyenv install 3.6.5
$ pyenv shell 3.6.5


## Setup

Create a fresh development enviroment, and install the
appropriate tools and dependencies:

$ cd <path/to/thx>
$ make venv
$ source .venv/bin/activate


## Submitting

Before submitting a pull request, please ensure
that you have done the following:

* Documented changes or features in README.md
* Added appropriate license headers to new files
* Written or modified tests for new functionality
* Used `make format` to format code appropriately
* Validated and tested code with `make lint test`

[pyenv]: https://github.com/pyenv/pyenv
1 change: 0 additions & 1 deletion README.md

This file was deleted.

86 changes: 86 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
thx
===

A simple, composable command runner for Python projects.

.. image:: https://img.shields.io/pypi/l/thx.svg
:target: https://github.com/jreese/thx/blob/main/LICENSE
:alt: MIT Licensed
.. image:: https://img.shields.io/pypi/v/thx.svg
:target: https://pypi.org/project/thx
:alt: PyPI Release
.. image:: https://img.shields.io/badge/change-log-blue
:target: https://github.com/jreese/thx/blob/main/CHANGELOG.md
:alt: Changelog
.. image:: https://readthedocs.org/projects/thx/badge/?version=stable
:target: https://thx.readthedocs.io/
:alt: Documentation Status
.. image:: https://github.com/jreese/thx/workflows/Build/badge.svg
:target: https://github.com/jreese/thx/actions
:alt: Build Status


Goals
-----

"makefiles, but with pyproject.toml"

-- author

`thx` should be capable of running one or more commands, configured via simple and
obvious options in the PEP 517 standardized `pyproject.toml`. Commands are simple
strings, or lists of strings, each representing a program to be run, with basic
interpolation of values.

.. code-block:: toml
[tool.thx]
default = ["lint", "test"]
module = "thx"
[tool.thx.commands]
lint = [
"flake8 {module}",
"ufmt check {module}",
]
test = "python -m unittest -v {module}.tests"
With the given configuration, the following commands are possible. Note the automatic
replacement of ``{module}`` with ``thx``:

.. code-block:: shell-session
$ thx lint
> flake8 thx
> ufmt check thx
.. code-block:: shell-session
$ thx test
> python -m unittest thx.tests
Without a command, ``thx`` will run the configured list of default commands:

.. code-block:: shell-session
$ thx
> flake8 thx
> ufmt check thx
> python -m unittest thx.tests
Install
-------

`thx` is not yet ready for production use. Check the Github repo for development status.


License
-------

`thx` is copyright `John Reese <https://jreese.sh>`_, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to my
code is from me and not from my employer. See the `LICENSE`_ file for details.

.. _LICENSE: https://github.com/jreese/thx/blob/main/LICENSE
20 changes: 20 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
div.omnilib {
margin-top: 24px;
}

div.omnilib-badges {
margin-top: 12px;
margin-bottom: 10px;
}

div.omnilib-badges a {
color: #bbb;
text-decoration: none;
font-size: 24px;
border: none;
}

div.omnilib-badges a:hover {
color: #777;
border: none;
}
6 changes: 6 additions & 0 deletions docs/_templates/badges.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="omnilib-badges">
<a class="github-button" href="https://github.com/{{theme_github_user}}/{{theme_github_repo}}" data-size="large"
data-show-count="true" aria-label="Star {{ theme_github_user }}/{{ theme_github_repo }} on GitHub">Star</a>
</div>

<script async defer src="https://buttons.github.io/buttons.js"></script>
24 changes: 24 additions & 0 deletions docs/_templates/omnilib.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="omnilib">
<h4>The Omnilib Project</h4>
<span>
<a href="https://omnilib.dev">Omnilib</a> is a group of MIT licensed software libraries developed under a
common, inclusive <a href="https://omnilib.dev/code_of_conduct.html">Code of Conduct</a>.
We are committed to providing a welcoming and open space for all contributors who adhere to these rules.
</span>
</div>
<div class="omnilib-badges">
<a href="https://twitter.com/omnilib" alt="Omnilib on Twitter">
<i class="fab fa-twitter"></i>
</a>
&nbsp;
<a href="https://github.com/omnilib" alt="Omnilib on Github">
<i class="fab fa-github"></i>
</a>
&nbsp;
<a href="https://github.com/{{theme_github_user}}/{{theme_github_repo}}" alt="View site source">
<i class="far fa-code"></i>
</a>

</div>

<script src="https://kit.fontawesome.com/7b536acf49.js" crossorigin="anonymous"></script>
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Changelog
=========

.. mdinclude:: ../CHANGELOG.md
:start-line: 2
92 changes: 92 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# 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 -----------------------------------------------------

import datetime

project = "thx"
copyright = f"{datetime.date.today().year}, John Reese"
author = "John Reese"


# -- 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 = [
"m2r",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
]

# 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 = []

autodoc_default_options = {
"show-inheritance": True,
"members": True,
"undoc-members": True,
}
autodoc_member_order = "groupwise"
autodoc_typehints = "description"

highlight_language = "python3"
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
master_doc = "index"

# -- 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 = "alabaster"
html_theme_options = {
"description": "Pythonic task runner",
"fixed_sidebar": True,
"badge_branch": "main",
"github_button": False,
"github_user": "jreese",
"github_repo": "thx",
"show_powered_by": False,
"sidebar_collapse": False,
"extra_nav_links": {
"Report Issues": "https://github.com/jreese/thx/issues",
},
}

html_sidebars = {
"**": [
"about.html",
"badges.html",
"navigation.html",
"relations.html",
"searchbox.html",
"omnilib.html",
],
}

# 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"]
5 changes: 5 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Contributing
============

.. mdinclude:: ../CONTRIBUTING.md
:start-line: 2
9 changes: 9 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. include:: ../README.rst

.. toctree::
:hidden:
:maxdepth: 1

changelog
contributing

Loading

0 comments on commit d284846

Please sign in to comment.