Skip to content

Commit

Permalink
chore: simplify local environment
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed Nov 13, 2022
1 parent e7eed26 commit 478359b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 33 deletions.
9 changes: 2 additions & 7 deletions .github/actions/run-checks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@ runs:
steps:

- name: Formatting check
run: |
source .venv/bin/activate
ls -al
make check
run: make check
shell: bash

- name: Test with pytest
run: |
source .venv/bin/activate
make test
run: make test
shell: bash

- name: Upload coverage reports to Codecov with GitHub Action
Expand Down
4 changes: 0 additions & 4 deletions .github/actions/setup-poetry-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,3 @@ runs:
- name: Install library
run: poetry install --no-interaction
shell: bash

- name: Activate environment
run: source .venv/bin/activate
shell: bash
1 change: 0 additions & 1 deletion .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ jobs:

- name: Build and publish
run: |
source .venv/bin/activate
poetry version $RELEASE_VERSION
make build-and-publish
env:
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ development. Please note this documentation assumes you already have
pyenv local <x.y.z>
Then, install and activate the environment with:
Then, install the virtual environment with:

.. code-block:: bash
poetry install
poetry shell
| 4. Install pre-commit to run linters/formatters at commit time:
Expand Down Expand Up @@ -118,7 +117,7 @@ development. Please note this documentation assumes you already have
tox
This requires you to have multiple versions of python installed.
This requires you to have multiple versions of Python installed.
This step is also triggered in the CI/CD pipeline, so you could also choose to skip this
step locally.

Expand Down
41 changes: 23 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
install: ## Install the poetry environment
@echo "🚀 Creating virtual environment using pyenv and poetry"
.PHONY: install
install: ## Install the Poetry environment.
@echo "🚀 Creating virtual environment using Poetry"
@poetry install
@poetry shell

check: ## Lint code using pre-commit and check obsolete dependencies using deptry.
.PHONY: check
check: ## Run code quality tools.
@echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry lock --check"
@poetry lock --check
@echo "🚀 Linting code: Running pre-commit"
@pre-commit run -a
@poetry run pre-commit run -a
@echo "🚀 Static type checking: Running mypy"
@mypy
@poetry run mypy
@echo "🚀 Checking for obsolete dependencies: Running deptry"
@deptry .
@poetry run deptry .

test: ## Test the code with pytest
.PHONY: test
test: ## Test the code with pytest.
@echo "🚀 Testing code: Running pytest"
@pytest --cov --cov-config=pyproject.toml --cov-report=xml
@poetry run pytest --cov --cov-config=pyproject.toml --cov-report=xml

build: clean-build ## Build wheel file using poetry
@echo "🚀 Creating wheel file"
.PHONY: build
build: clean-build ## Build wheel and sdist files using Poetry.
@echo "🚀 Creating wheel and sdist files"
@poetry build

.PHONY: clean-build
clean-build: ## clean build artifacts
@rm -rf dist

publish: ## publish a release to pypi.
.PHONY: publish
publish: ## Publish a release to PyPI.
@echo "🚀 Publishing: Dry run."
@poetry config pypi-token.pypi $(PYPI_TOKEN)
@poetry publish --dry-run
@echo "🚀 Publishing."
@poetry publish

.PHONY: build-and-publish
build-and-publish: build publish ## Build and publish.

docs-test: ## Test if documentation can be built without warnings or errors
.PHONY: docs-test
docs-test: ## Test if documentation can be built without warnings or errors.
@( cd docs ; poetry run mkdocs build -s)

docs: ## Build and serve the documentation
@( cd docs ; poetry run mkdocs serve )

.PHONY: docs
docs: ## Build and serve the documentation.
@( cd docs ; poetry run mkdocs serve )

.PHONY: help

help:
help: ## Show help for the commands.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help

0 comments on commit 478359b

Please sign in to comment.