Skip to content

Commit

Permalink
Cleanup required dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bonicim committed Apr 1, 2024
1 parent c9ab4e1 commit 02f9947
Show file tree
Hide file tree
Showing 4 changed files with 608 additions and 642 deletions.
118 changes: 66 additions & 52 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,33 @@ SHELL = /bin/bash
VENV = venv-hnx
PYTHON3 = python3

## Lint
.PHONY: lint
lint: pylint flake8
############# Manage Environments #############

.PHONY: pylint
pylint:
@$(PYTHON3) -m pylint --recursive=y --persistent=n --verbose hypernetx
## Environment using Pip
.PHONY: venv
venv: clean-venv
@$(PYTHON3) -m venv $(VENV);

# Todo: fix flake8 errors and remove --exit-zero
.PHONY: flake8
flake8:
@$(PYTHON3) -m flake8 hypernetx --exit-zero
.PHONY: clean-venv
clean-venv:
rm -rf $(VENV)

.PHONY: pre-commit
pre-commit:
pre-commit install
pre-commit run --all-files
.PHONY: install-reqs
install-reqs:
@$(PYTHON3) -m pip install -r requirements.txt

## Environment using Poetry

.PHONY: develop
develop: clean-poetry-env
poetry install --all-extras --with test
poetry shell

.PHONY: requirements.txt
requirements.txt:
poetry export --format requirements.txt --output requirements.txt --without-hashes --extras "contagion modularity"

############# Running Tests, linters #############

## Tests
.PHONY: test
Expand All @@ -34,8 +44,18 @@ test-tox:

### Tests using Poetry + Tox
### Used by Bamboo CI Pipeline, Github Workflows CI Pipeline
.PHONY: install-poetry
install-poetry:

.PHONY: test-ci-github
test-ci-github: run-poetry-tox

.PHONY: test-ci-stash
test-ci-stash: install-poetry-stash run-poetry-tox clean-poetry-env

.PHONY: build-docs-stash
build-docs-stash: install-poetry-stash run-build-docs clean-poetry-env

.PHONY: install-poetry-stash
install-poetry-stash:
pip install poetry==1.8.2
poetry config virtualenvs.in-project true
poetry run pip install tox
Expand All @@ -44,64 +64,58 @@ install-poetry:
run-poetry-tox:
poetry run tox --parallel

.PHONY: clean-poetry
clean-poetry:
poetry env remove --all

.PHONY: test-ci-stash
test-ci-stash: install-poetry run-poetry-tox clean-poetry
.PHONY: run-build-docs
run-build-docs:
poetry run tox -e build-docs

.PHONY: test-ci-github
test-ci-github: run-poetry-tox
.PHONY: clean-poetry-env
clean-poetry-env:
poetry env remove --all

.PHONY: run-poetry-tox-build-docs
run-poetry-tox-build-docs:
poetry run tox -e build-docs
## Lint
.PHONY: lint
lint: pylint flake8

.PHONY: build-docs
build-docs: install-poetry run-poetry-tox-build-docs clean-poetry
.PHONY: pylint
pylint:
@$(PYTHON3) -m pylint --recursive=y --persistent=n --verbose hypernetx

# Todo: fix flake8 errors and remove --exit-zero
.PHONY: flake8
flake8:
@$(PYTHON3) -m flake8 hypernetx --exit-zero

.PHONY: pre-commit
pre-commit:
pre-commit install
pre-commit run --all-files

## Publish to PyPi
############# Packaging and Publishing to PyPi #############
## Uses Poetry to manage packaging and publishing
## Targets are included as a backup in case the Github Workflows CI can't publish to PyPi and we need to do it manually
## Assumes the following environment variables are set: PYPI_API_TOKEN
.PHONY: publish-to-pypi
publish-to-pypi: build-dist
publish-to-pypi: build check-long-desc
@echo "Publishing to PyPi"
poetry config pypi-token.pypi PYPI_API_TOKEN
poetry config repositories.pypi https://pypi.org/simple/
poetry publish --dry-run
#poetry publish

.PHONY: build-dist
build-dist: clean
poetry run pip install twine
.PHONY: build
build: clean
poetry build
poetry run twine check dist/*

.PHONY: check-long-desc
check-long-desc:
poetry run pip install twine
poetry run twine check dist/*

## Tutorials
############# Misc #############
.PHONY: tutorials
tutorials:
jupyter notebook tutorials


## Environment
.PHONY: clean-venv
clean-venv:
rm -rf $(VENV)

.PHONY: venv
venv: clean-venv
@$(PYTHON3) -m venv $(VENV);

.PHONY: install-reqs
install-reqs:
@$(PYTHON3) -m pip install -r requirements.txt


## Clean
.PHONY: clean
clean:
rm -rf .out .pytest_cache .tox *.egg-info dist build _build
Loading

0 comments on commit 02f9947

Please sign in to comment.