diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 695290e8..8a1fe45f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,6 +19,6 @@ Here are some key points to include in your description: - [ ] I have written new tests for these changes, as needed. diff --git a/Makefile b/Makefile deleted file mode 100644 index a9833c3e..00000000 --- a/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# A Makefile for commands I run frequently: - -clean: - rm -rf dist - rm -rf _static - rm -rf jrnl.egg-info - rm -rf _build - rm -rf _sources - rm -rf _static - rm -rf site/ - rm -f *.html - -html: - poetry run mkdocs serve - -format: ## Format files to match style - poetry run black . - -lint: ## Check style with various tools - poetry check - poetry run pflake8 jrnl tests - poetry run black --check --diff . - -unit: # unit tests - poetry run pytest tests/unit - -bdd: # bdd tests - poetry run pytest tests/bdd --gherkin-terminal-reporter --tb=native - -bdd-debug: # bdd tests - poetry run pytest tests/bdd --gherkin-terminal-reporter --tb=native -x -vv - -test: lint unit bdd - -build: - poetry build - -install: clean ## install the package to the active Python's site-packages - poetry install diff --git a/docs/contributing.md b/docs/contributing.md index ea651df5..650d0cda 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -27,7 +27,7 @@ Please report bugs by [opening a new issue](https://github.com/jrnl-org/jrnl/iss If you find a typo or a mistake in the docs, please fix it right away and send a pull request. If you're unsure what to change but still see a problem, you can [open a new issue](https://github.com/jrnl-org/jrnl/issues/new/choose) with the "Documentation change" type. -To edit the documentation, edit the `docs/*.md` files on the **develop** branch. You can see the result by running `make html` (or `poetry run mkdocs serve` if on Windows) inside the project's root directory, then navigating your browser to [localhost:8000](http://localhost:8000). +To edit the documentation, edit the `docs/*.md` files on the **develop** branch. You can see the result by running `poe docs` inside the project's root directory, then navigating your browser to [localhost:8000](http://localhost:8000). The `gh-pages` branch is automatically maintained and generated after your changes are merged. You should never have to edit that branch. @@ -85,16 +85,20 @@ In general, pull requests should be made on the `develop` branch. ### Common development commands -You can find an inventory of commands in the `makefile`. \*nix users can run the commands by typing `make` followed by the name of the command; however, Windows users will need to type out the commands directly, or install a third-party make tool such as [GNU Make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm). +You can find an inventory of commands in the `pyproject.toml`. Users can run the commands by typing `poe` followed by the name of the command ([Poe the Poet](https://github.com/nat-n/poethepoet) can be installed on its own, or as part of `poetry install`). A typical development workflow includes: - * Installing dependencies: `poetry install` - * Running tests: `make test` - * Running the source in a virtual environment: + * Installing dependencies: + * `poetry install` + * Activate virtual environment: * `poetry shell` + * Running the source in a virtual environment: * `jrnl` (with or without arguments as necessary) - * Linting the code to standardize its style: `make lint` + * Running tests: + * `poe test` + * Formatting the code to standardize its style: + * `poe format` ### Updating automated tests diff --git a/poetry.lock b/poetry.lock index 88e973cb..1f144a90 100644 --- a/poetry.lock +++ b/poetry.lock @@ -128,7 +128,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" name = "commonmark" version = "0.9.1" description = "Python parser for the CommonMark Markdown spec" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -487,6 +487,14 @@ python-versions = ">=3.6" qa = ["flake8 (==3.8.3)", "mypy (==0.782)"] testing = ["docopt", "pytest (<6.0.0)"] +[[package]] +name = "pastel" +version = "0.2.1" +description = "Bring colors to your terminal." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + [[package]] name = "pathspec" version = "0.9.0" @@ -538,6 +546,21 @@ python-versions = ">=3.6" dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "poethepoet" +version = "0.13.1" +description = "A task runner that works well with poetry." +category = "dev" +optional = false +python-versions = ">=3.6.2" + +[package.dependencies] +pastel = ">=0.2.1,<0.3.0" +tomli = ">=1.2.2" + +[package.extras] +poetry_plugin = ["poetry (>=1.0,<2.0)"] + [[package]] name = "pprintpp" version = "0.4.0" @@ -612,7 +635,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" name = "pygments" version = "2.12.0" description = "Pygments is a syntax highlighting package written in Python." -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -747,7 +770,7 @@ pyyaml = "*" name = "rich" version = "12.4.0" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -category = "dev" +category = "main" optional = false python-versions = ">=3.6.3,<4.0.0" @@ -933,7 +956,7 @@ testing = ["pytest", "pytest-bdd", "toml"] [metadata] lock-version = "1.1" python-versions = ">=3.9.0, <3.12" -content-hash = "8cd80d198bf8208d9e4b2054b89a22f1ce9faccc91aaef3440fb22e1782b0239" +content-hash = "7c8a664dc14ce88642bb27318d23b158c044022b791361c98997a3f518c7cd8b" [metadata.files] ansiwrap = [ @@ -1216,6 +1239,10 @@ parso = [ {file = "parso-0.8.3-py2.py3-none-any.whl", hash = "sha256:c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75"}, {file = "parso-0.8.3.tar.gz", hash = "sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0"}, ] +pastel = [ + {file = "pastel-0.2.1-py2.py3-none-any.whl", hash = "sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364"}, + {file = "pastel-0.2.1.tar.gz", hash = "sha256:e6581ac04e973cac858828c6202c1e1e81fee1dc7de7683f3e1ffe0bfd8a573d"}, +] pathspec = [ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, @@ -1236,6 +1263,10 @@ pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] +poethepoet = [ + {file = "poethepoet-0.13.1-py3-none-any.whl", hash = "sha256:47e7b38c8b5412f840447f7612a9330697e8633e7500a7340b6734f50e26e380"}, + {file = "poethepoet-0.13.1.tar.gz", hash = "sha256:4f6962f17f5d5a453fd7fa66e3e7897e9191d4289148433efe441c81f2451a46"}, +] pprintpp = [ {file = "pprintpp-0.4.0-py2.py3-none-any.whl", hash = "sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d"}, {file = "pprintpp-0.4.0.tar.gz", hash = "sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403"}, diff --git a/pyproject.toml b/pyproject.toml index e37c3767..b81c285b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ toml = ">=0.10" pytest = ">=6.2" pytest-bdd = ">=4.0.1" ipdb = "*" +poethepoet = "*" pytest-clarity = "*" pyproject-flake8 = "*" yq = "*" @@ -68,6 +69,26 @@ testing = [ "pytest", "pytest-bdd", "toml" ] [tool.poetry.scripts] jrnl = 'jrnl.cli:cli' +[tool.poe.tasks] +bdd = "pytest tests/bdd --gherkin-terminal-reporter --tb=native" +bdd-debug = "poe bdd -x -vv" +format = "black ." +docs = "mkdocs serve" +unit = "pytest tests/unit" + +# Groups of tasks +lint = [ + {cmd = "poetry check"}, + {cmd = "pflake8 jrnl tests"}, + {cmd = "black --check --diff ."}, +] + +test = [ + "lint", + "unit", + "bdd", +] + [tool.isort] multi_line_output = 7 force_single_line = true