Replace make with python alternative (poe) (#1503)

* Get rid of `make` in favor of `poe`

This moves the tasks that were previously in Makefile, into
pyproject.toml (with all the other config)

This is also more inclusive of Windows developers since they only need
Python, and no longer have to install make separately.

* udpate docs

* don't make code blocks also links
This commit is contained in:
Jonathan Wren 2022-06-18 11:36:56 -07:00 committed by GitHub
parent c1c70e643a
commit 51ab747019
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 51 deletions

View file

@ -19,6 +19,6 @@ Here are some key points to include in your description:
- [ ] I have written new tests for these changes, as needed. - [ ] I have written new tests for these changes, as needed.
<!-- <!--
NOTE: Your PR may not be reviewed if there are any failing tests. You can run NOTE: Your PR may not be reviewed if there are any failing tests. You can run
tests locally with `make test` (see the contributing doc if you need help with tests locally with `poe test` (see the contributing doc if you need help with
`make`), or use our automated tests after you submit your PR. `poe`), or use our automated tests after you submit your PR.
--> -->

View file

@ -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

View file

@ -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. 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. 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 ### 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: A typical development workflow includes:
* Installing dependencies: `poetry install` * Installing dependencies:
* Running tests: `make test` * `poetry install`
* Running the source in a virtual environment: * Activate virtual environment:
* `poetry shell` * `poetry shell`
* Running the source in a virtual environment:
* `jrnl` (with or without arguments as necessary) * `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 ### Updating automated tests

39
poetry.lock generated
View file

@ -128,7 +128,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
name = "commonmark" name = "commonmark"
version = "0.9.1" version = "0.9.1"
description = "Python parser for the CommonMark Markdown spec" description = "Python parser for the CommonMark Markdown spec"
category = "dev" category = "main"
optional = false optional = false
python-versions = "*" python-versions = "*"
@ -487,6 +487,14 @@ python-versions = ">=3.6"
qa = ["flake8 (==3.8.3)", "mypy (==0.782)"] qa = ["flake8 (==3.8.3)", "mypy (==0.782)"]
testing = ["docopt", "pytest (<6.0.0)"] 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]] [[package]]
name = "pathspec" name = "pathspec"
version = "0.9.0" version = "0.9.0"
@ -538,6 +546,21 @@ python-versions = ">=3.6"
dev = ["pre-commit", "tox"] dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark"] 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]] [[package]]
name = "pprintpp" name = "pprintpp"
version = "0.4.0" version = "0.4.0"
@ -612,7 +635,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
name = "pygments" name = "pygments"
version = "2.12.0" version = "2.12.0"
description = "Pygments is a syntax highlighting package written in Python." description = "Pygments is a syntax highlighting package written in Python."
category = "dev" category = "main"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
@ -747,7 +770,7 @@ pyyaml = "*"
name = "rich" name = "rich"
version = "12.4.0" version = "12.4.0"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
category = "dev" category = "main"
optional = false optional = false
python-versions = ">=3.6.3,<4.0.0" python-versions = ">=3.6.3,<4.0.0"
@ -933,7 +956,7 @@ testing = ["pytest", "pytest-bdd", "toml"]
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = ">=3.9.0, <3.12" python-versions = ">=3.9.0, <3.12"
content-hash = "8cd80d198bf8208d9e4b2054b89a22f1ce9faccc91aaef3440fb22e1782b0239" content-hash = "7c8a664dc14ce88642bb27318d23b158c044022b791361c98997a3f518c7cd8b"
[metadata.files] [metadata.files]
ansiwrap = [ ansiwrap = [
@ -1216,6 +1239,10 @@ parso = [
{file = "parso-0.8.3-py2.py3-none-any.whl", hash = "sha256:c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75"}, {file = "parso-0.8.3-py2.py3-none-any.whl", hash = "sha256:c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75"},
{file = "parso-0.8.3.tar.gz", hash = "sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0"}, {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 = [ pathspec = [
{file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"},
{file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, {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-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"},
{file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, {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 = [ pprintpp = [
{file = "pprintpp-0.4.0-py2.py3-none-any.whl", hash = "sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d"}, {file = "pprintpp-0.4.0-py2.py3-none-any.whl", hash = "sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d"},
{file = "pprintpp-0.4.0.tar.gz", hash = "sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403"}, {file = "pprintpp-0.4.0.tar.gz", hash = "sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403"},

View file

@ -58,6 +58,7 @@ toml = ">=0.10"
pytest = ">=6.2" pytest = ">=6.2"
pytest-bdd = ">=4.0.1" pytest-bdd = ">=4.0.1"
ipdb = "*" ipdb = "*"
poethepoet = "*"
pytest-clarity = "*" pytest-clarity = "*"
pyproject-flake8 = "*" pyproject-flake8 = "*"
yq = "*" yq = "*"
@ -68,6 +69,26 @@ testing = [ "pytest", "pytest-bdd", "toml" ]
[tool.poetry.scripts] [tool.poetry.scripts]
jrnl = 'jrnl.cli:cli' 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] [tool.isort]
multi_line_output = 7 multi_line_output = 7
force_single_line = true force_single_line = true