Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
path: .cache
- name: Pip Update
run: |
make update-pip
make -s update-pip
- name: Docs Dependency Installation
run: |
make install-doc
make -s install-doc
- name: Deploy the documentation to GitHub Pages
run: |
make doc-github
make -s doc-github
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
python-version: '3.8'
- name: Pip Update
run: |
make update-pip
make -s update-pip
- name: Lint Dependency Installation
run: |
make install-lint
make -s install-lint
- name: Lint the Project
run: |
make lint
make -s lint
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
- name: Pip Update
run: |
make update-pip
make -s update-pip
- name: Install the Project with Test Dependencies
run: |
make install-test
make -s install-test
# - name: Show dependencies
# run: python -m pip list
- name: Test the Project
run: make test-parallel
run: make -s test-parallel
# - name: Publish code coverage
# uses: codecov/codecov-action@v3
28 changes: 14 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ lint:
stage: lint
script: |
echo "*********** Pip Update ***********"
make update-pip
make -s update-pip
echo "*********** Lint Dependency Installation ***********"
make install-lint
make -s install-lint
echo "*********** Lint the Project ***********"
make lint
make -s lint
only:
- merge_requests

Expand All @@ -24,11 +24,11 @@ tests:
echo "*********** Disable Logger Outputs ***********"
sed -i "s/log_cli = true/log_cli = false/" pyproject.toml
echo "*********** Pip Update ***********"
make update-pip
make -s update-pip
echo "*********** Install the Project with Test Dependencies ***********"
make install-test
make -s install-test
echo "*********** Test the Project ***********"
make test-parallel
make -s test-parallel
only:
- merge_requests
# artifacts:
Expand All @@ -43,25 +43,25 @@ package:
echo "*********** Rename `version` with COMMIT_TAG: $CI_COMMIT_TAG ***********"
sed -i "s/0.0.0/$CI_COMMIT_TAG/" pyproject.toml
echo "*********** Pip Update ***********"
make update-pip
make -s update-pip
echo "*********** Build Dependency Installation ***********"
make install-build
make -s install-build
echo "*********** Build the Project ***********"
make build
make -s build
echo "*********** Publish Dependency Installation ***********"
make install-publish
make -s install-publish
echo "*********** Publish the Project ***********"
make publish
make -s publish

pages:
stage: doc
script: |
echo "*********** Pip Update ***********"
make update-pip
make -s update-pip
echo "*********** Docs Dependency Installation ***********"
make install-doc
make -s install-doc
echo "*********** Build the project documentation ***********"
make doc
make -s doc
# only:
# - main
rules:
Expand Down
183 changes: 118 additions & 65 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,135 +22,188 @@ help:
%s\n", $$1, $$2}'

update-pip:
@${PYTHON} -m pip install -U pip
${PYTHON} -m pip install -U pip

install-poetry: ## Install poetry if it is not already installed
$(MAKE) update-pip
! pip show poetry &> /dev/null && pip install poetry==1.3.1
poetry config virtualenvs.create false
# poetry config repositories.private-pypi <PRIVATE_PYPI_URL>
# poetry config http-basic.private-pypi ${PYPI_USERNAME} ${PYPI_PASSWORD}

create-conda:
@conda create -n ${ROOT_DIR} python=${PYTHON_VERSION} -y

install-base: ## Installs only package dependencies
$(MAKE) update-pip
@pip install ${PYPI_URLS} --editable .
############# PIP ############
# $(MAKE) update-pip
# pip install ${PYPI_URLS} --editable .
########### POETRY ###########
$(MAKE) install-poetry
poetry install --only-root

install: ## Installs the development and test version of the package
$(MAKE) update-pip
@pip install ${PYPI_URLS} --editable .[test,doc,dev]
@pre-commit install
############# PIP ############
# $(MAKE) update-pip
# pip install ${PYPI_URLS} --editable .[test,doc,dev]
########### POETRY ###########
$(MAKE) install-poetry
poetry install

$(MAKE) install-precommit

install-no-cache: ## Installs the development and test version of the package
@pip install --no-cache-dir ${PYPI_URLS} --editable .[test,dev]
@pre-commit install
############# PIP ############
# $(MAKE) update-pip
# pip install --no-cache-dir ${PYPI_URLS} --editable .[test,dev]
########### POETRY ###########
$(MAKE) install-poetry
poetry install --no-cache

$(MAKE) install-precommit

install-test: ## Install only test version of the package
@pip install ${PYPI_URLS} .[test]
############# PIP ############
# $(MAKE) update-pip
# pip install ${PYPI_URLS} .[test]
########### POETRY ###########
$(MAKE) install-poetry
poetry install --without dev

install-precommit: ## Install pre-commit hooks
@pip install pre-commit
@pre-commit install
pre-commit install

install-lint:
@pip install black[d]==23.1.0 ruff==0.0.246
pip install black[d]==23.1.0 ruff==0.0.246

install-build:
@pip install build
############# PIP ############
# pip install build
########### POETRY ###########
$(MAKE) install-poetry

install-publish:
@pip install twine
############# PIP ############
# pip install twine
########### POETRY ###########
$(MAKE) install-poetry

install-doc:
@pip install mkdocs mkdocs-material mkdocstrings[python]
pip install mkdocs mkdocs-material mkdocstrings[python]

test-one: ## Run specific tests with TEST_MARKER=<test_name>, default marker is `placeholder`
@${PYTHON} -m pytest -m ${TEST_MARKER}
${PYTHON} -m pytest -m ${TEST_MARKER}

test-one-parallel: ## Run specific tests with TEST_MARKER=<test_name> in parallel, default marker is `placeholder`
@${PYTHON} -m pytest -n auto -m ${TEST_MARKER}
${PYTHON} -m pytest -n auto -m ${TEST_MARKER}

test-all: ## Run all tests
@# mkdir -p ${TEST_OUTPUT_DIR}
@# cp .coveragerc ${TEST_OUTPUT_DIR}
@# cp setup.cfg ${TEST_OUTPUT_DIR}
@${PYTHON} -m pytest
# mkdir -p ${TEST_OUTPUT_DIR}
# cp .coveragerc ${TEST_OUTPUT_DIR}
# cp setup.cfg ${TEST_OUTPUT_DIR}
${PYTHON} -m pytest

test-all-parallel: ## Run all tests with parallelization
@${PYTHON} -m pytest -n auto
${PYTHON} -m pytest -n auto

test-coverage: ## Run all tests with coverage
@${PYTHON} -m pytest --cov=${PACKAGE} --cov-report=html:coverage
${PYTHON} -m pytest --cov=${PACKAGE} --cov-report=html:coverage

test-coverage-parallel:
@${PYTHON} -m pytest -n auto --cov=${PACKAGE} --cov-report=html:coverage
${PYTHON} -m pytest -n auto --cov=${PACKAGE} --cov-report=html:coverage

test-docs: ## Test documentation examples with doctest
@${PYTHON} -m pytest --doctest-modules ${PACKAGE}
${PYTHON} -m pytest --doctest-modules ${PACKAGE}

test: clean-test test-all ## Cleans and runs all tests
test-parallel: clean-test test-all-parallel ## Cleans and runs all tests with parallelization

clean-build: ## Clean build dist and egg directories left after install
@rm -rf ./dist
@rm -rf ./build
@rm -rf ./pytest_cache
@rm -rf ./junit
@rm -rf ./$(PACKAGE).egg-info
@find . -type f -iname "*.so" -delete
@find . -type f -iname '*.pyc' -delete
@# find . -type d -name '$(PACKAGE).egg-info' -empty -delete
@find . -type d -name '*.egg-info' -prune -exec rm -rf {} \;
@find . -type d -name '__pycache__' -prune -exec rm -rf {} \;
@find . -type d -name '.ruff_cache' -prune -exec rm -rf {} \;
@find . -type d -name '.mypy_cache' -prune -exec rm -rf {} \;
rm -rf ./dist
rm -rf ./build
rm -rf ./pytest_cache
rm -rf ./junit
rm -rf ./$(PACKAGE).egg-info
find . -type f -iname "*.so" -delete
find . -type f -iname '*.pyc' -delete
# find . -type d -name '$(PACKAGE).egg-info' -empty -delete
find . -type d -name '*.egg-info' -prune -exec rm -rf {} \;
find . -type d -name '__pycache__' -prune -exec rm -rf {} \;
find . -type d -name '.ruff_cache' -prune -exec rm -rf {} \;
find . -type d -name '.mypy_cache' -prune -exec rm -rf {} \;

clean-test: ## Clean test related files left after test
@# rm -rf ./htmlcov
@# rm -rf ./coverage.xml
@find . -type f -regex '\.\/\.*coverage[^rc].*' -delete
@rm -rf ${TEST_OUTPUT_DIR}
@find ${TEST_DIR} -type f -regex '\.\/\.*coverage[^rc].*' -delete
@find ${TEST_DIR} -type d -name 'htmlcov' -exec rm -r {} +
@find . -type d -name '.pytest_cache' -prune -exec rm -rf {} \;
# rm -rf ./htmlcov
# rm -rf ./coverage.xml
find . -type f -regex '\.\/\.*coverage[^rc].*' -delete
rm -rf ${TEST_OUTPUT_DIR}
find ${TEST_DIR} -type f -regex '\.\/\.*coverage[^rc].*' -delete
find ${TEST_DIR} -type d -name 'htmlcov' -exec rm -r {} +
find . -type d -name '.pytest_cache' -prune -exec rm -rf {} \;

clean: clean-build clean-test ## Cleans build and test related files

build: ## Build the package, creates source distribution
@${PYTHON} -m build --sdist --outdir dist

build-wheel:
@${PYTHON} -m build --wheel --outdir dist

publish: ## Publish the package to pypi
@twine upload dist/* --verbose --config-file .pypirc
# TODO: Remove poetry-installation
build: ## Make Python source distribution
############# PIP ############
# ${PYTHON} -m build --sdist --outdir dist
########### POETRY ###########
$(MAKE) install-poetry
poetry build --format sdist

# TODO: Remove poetry-installation
build-wheel: ## Make Python wheel distribution
############# PIP ############
# ${PYTHON} -m build --wheel --outdir dist
########### POETRY ###########
$(MAKE) install-poetry
poetry build --format wheel

# TODO: Implement this
publish: ## Builds the project and publish the package to Pypi
$(MAKE) build

############# PIP ############
# twine upload dist/* --verbose --config-file .pypirc
########### POETRY ###########
# poetry publish -r private-pypi -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD}
poetry publish -r private-pypi

doc: ## Build documentation with mkdocs
@mkdocs build
mkdocs build

doc-github: ## Build documentation with mkdocs and deploy to github pages
@mkdocs gh-deploy --force
mkdocs gh-deploy --force

doc-dev: ## Show documentation preview with mkdocs
@mkdocs serve -w ${PACKAGE}
mkdocs serve -w ${PACKAGE}

pre-commit-one: ## Run pre-commit with specific files
@pre-commit run --files ${PRECOMMIT_FILE_PATHS}
pre-commit run --files ${PRECOMMIT_FILE_PATHS}

pre-commit: ## Run pre-commit for all package files
@pre-commit run --all-files
pre-commit run --all-files

pre-commit-clean: ## Clean pre-commit cache
@pre-commit clean
pre-commit clean

lint: ## Lint code with black, ruff
@${PYTHON} -m black ${PACKAGE} --check --diff
@${PYTHON} -m ruff ${PACKAGE}
${PYTHON} -m black ${PACKAGE} --check --diff
${PYTHON} -m ruff ${PACKAGE}

lint-report: ## Lint report for gitlab
${PYTHON} -m black ${PACKAGE} --check --diff
${PYTHON} -m ruff ${PACKAGE} --format gitlab > gl-code-quality-report.json

format: ## Run black, ruff for all package files. CHANGES CODE
@${PYTHON} -m black ${PACKAGE}
@${PYTHON} -m ruff ${PACKAGE} --fix
${PYTHON} -m black ${PACKAGE}
${PYTHON} -m ruff ${PACKAGE} --fix --show-fixes

typecheck: ## Checks code with mypy
@${PYTHON} -m mypy --package ${PACKAGE}
${PYTHON} -m mypy --package ${PACKAGE}

typecheck-no-cache: ## Checks code with mypy no cache
@${PYTHON} -m mypy --package ${PACKAGE} --no-incremental
${PYTHON} -m mypy --package ${PACKAGE} --no-incremental

typecheck-report: ## Checks code with mypy and generates html report
@${PYTHON} -m mypy --package ${PACKAGE} --html-report mypy_report
${PYTHON} -m mypy --package ${PACKAGE} --html-report mypy_report
Loading