-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove unused stuff - port existing noxfile.py with general tasks - pin dependencies with pip-deepfreeze - switch to pyproject.toml and hatch as build tool - use hatch for version bumping - most tests removed in order to get a clean slate: - the work mapper ones were self contained so I kept them
- Loading branch information
Showing
65 changed files
with
782 additions
and
3,688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[run] | ||
branch = True | ||
parallel = True | ||
omit = | ||
tests/* | ||
|
||
source = src/ | ||
|
||
[report] | ||
exclude_lines = | ||
@overload | ||
pragma: no cover | ||
raise NotImplementedError | ||
if TYPE_CHECKING: | ||
pass | ||
if __name__ == "__main__": | ||
|
||
# SNIPPET: use this to fail CI for missing test coverage | ||
# fail_under = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Contributing | ||
|
||
Developing on wepy | ||
|
||
After you have cloned the repo you should have a copy of Python 3.10 installed | ||
and accessible to path as `python3.10`. | ||
|
||
Then you should be able to start coding and running tests: | ||
|
||
```sh | ||
make test-unit | ||
``` | ||
|
||
To build the package: | ||
|
||
```sh | ||
make build | ||
``` | ||
|
||
To see all the commands run `make` or: | ||
|
||
```sh | ||
make help | ||
``` | ||
|
||
All the virtual environment creation and installation is taken care behind the | ||
scenes. | ||
|
||
If you want a standalone environment you can activate in your shell run: | ||
|
||
```sh | ||
make env | ||
``` | ||
|
||
Which creates the `.venv` folder. For convenience it can be activated with: | ||
|
||
```sh | ||
. ./env.sh | ||
``` | ||
|
||
|
||
## TODOs | ||
|
||
Note that there are stubs for performing checks like linting, formatting etc. | ||
that aren't used in this project, but could be added at a later time. | ||
|
||
In order to get tests passing many bad tests were deleted. | ||
|
||
Building of documentation is also not implemented at the moment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
## Notes on this file. The `help` target parses the file and can generate | ||
## headings and docstrings for targets, in the order they are in the file. To | ||
## create a heading make a comment like `##@ Heading Content`. To document | ||
## targets make a comment on the same line as the target name with two `## | ||
## docstring explanation...`. To leave a target undocumented simply provide no | ||
## docstring. | ||
|
||
PYTHON=python3.11 | ||
TMPDIR=.tmp | ||
|
||
##@ Getting Started | ||
|
||
env: ## Rebuild the main development environment | ||
nox -s dev_external | ||
echo "Run this to activate dev env: . env.sh" | ||
.PHONY: env | ||
|
||
##@ Housekeeping | ||
|
||
clean-all: clean clean-docs clean-env clean-compose clean-hooks ## run all clean commands | ||
.PHONY: clean-all | ||
|
||
clean: ## Clean temporary files, directories etc. | ||
rm -rf $(TMPDIR) | ||
rm -rf dist .pytest_cache .mypy_cache .coverage .venv .nox .hatch htmlcov | ||
find . -type f -name "*.pyc" -print -delete | ||
hatch clean | ||
.PHONY: clean | ||
|
||
clean-env: ## Clean the dev environments | ||
rm -rf .venv | ||
.PHONY: clean-env | ||
|
||
##@ QA (TODO) | ||
|
||
# format: ## Run source code formatters manually. | ||
# nox -s format | ||
# .PHONY: docstrings | ||
|
||
# validate: ## Run all linters, type checks, static analysis, etc. | ||
# nox -s validate | ||
# .PHONY: validate | ||
|
||
# format-check: ## Run code formatting checks | ||
# nox -s format_check | ||
# .PHONY: format-check | ||
|
||
# # check: ## Run only miscellaneous maintenance checks | ||
# # .PHONY: check | ||
|
||
# lint: ## Run only the linters (non-autoformatters). | ||
# nox -s lint | ||
# .PHONY: lint | ||
|
||
# docstring-check: ## Run docstring coverage only. | ||
# nox -s docstring_lint | ||
# .PHONY: docstring | ||
|
||
# typecheck: ## Run only the type checker (requires mypy) | ||
# nox -s typecheck | ||
# .PHONY: typecheck | ||
|
||
##@ Dev | ||
|
||
test-unit: ## Run unit tests with coverage report | ||
nox -s tests_unit | ||
.PHONY: test | ||
|
||
coverage: ## Report on missing coverage. (Run 'test-unit' to generate new stats) | ||
nox -s coverage | ||
.PHONY: coverage | ||
|
||
serve-coverage: ## Run a temporary web server to display detailed coverage report | ||
python3 -m http.server --directory htmlcov 4322 | ||
.PHONY: serve-coverage | ||
|
||
|
||
##@ Documentation (TODO) | ||
|
||
# docs: ## TODO: Build the documentation | ||
# nox -s docs | ||
# .PHONY: docs | ||
|
||
# clean-docs: ## TODO: Clean temporary files for documentation | ||
# rm -rf docs/_api docs/_build | ||
# .PHONY: clean-docs | ||
|
||
# serve-docs: ## TODO: Run a temporary web server to display current documentation build | ||
# python3 -m http.server --directory docs/_build 4323 | ||
# .PHONY: serve-docs | ||
|
||
|
||
##@ Release Management | ||
|
||
pin: pyproject.toml ## Pin the project dependency versions | ||
nox -s pin | ||
.PHONY: pin | ||
|
||
bumpversion: ## Bump the minor version for the project | ||
nox -s bumpversion | ||
.PHONY: bumpversion | ||
|
||
build: ## Run the python build/packaging, generate sdist & wheel | ||
nox -s build | ||
.PHONY: build | ||
|
||
publish: ## Publish the package to indices | ||
nox -s publish | ||
.PHONY: publish | ||
|
||
##@ Help | ||
|
||
# An automatic help command: https://www.padok.fr/en/blog/beautiful-makefile-awk | ||
.DEFAULT_GOAL := help | ||
|
||
help: ## (DEFAULT) This command, show the help message | ||
@echo "See CONTRIBUTING.md for dependencies, then run this:" | ||
@echo "" | ||
@echo "If you want a shell in a virtual environment with everything:" | ||
@echo " > make env" | ||
@echo " > . ./env.sh" | ||
@echo "" | ||
@echo "Do testing:" | ||
@echo " > make test-unit" | ||
@echo "" | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
.PHONY: help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This contains external specifications of the different profiles of dependencies | ||
needed for different tasks. | ||
|
||
They are split up this way to allow for the absolute minimum dependencies needed | ||
in environments like CI where we want performance to be optimal and reducing the | ||
number of dependencies can help that a lot. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sphinx | ||
sphinxcontrib-napoleon | ||
sphinxcontrib-newsfeed | ||
sphinxcontrib-bibtex | ||
sphinxcontrib-newsfeed | ||
nbsphinx | ||
notebook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ipython | ||
pdbpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
black | ||
isort | ||
flake8 | ||
flake8-bugbear | ||
interrogate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest | ||
coverage | ||
pytest-cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mypy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
. ./.venv/bin/activate |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.