Skip to content

Commit 4c4ae9b

Browse files
committed
Add PyPi packaging
1 parent b43ae8a commit 4c4ae9b

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

Makefile

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,55 @@
11
TEST_DIR=tests
2+
#PYPI_URL=https://test.pypi.org/legacy/
3+
PYPI_URL=https://upload.pypi.org/legacy/
4+
DEFAULT_PYTHON_VERSION=three
25

36
## Sets up the virtual environment via pipenv.
47
.PHONY: setup
58
setup:
6-
pipenv --three install --dev
9+
pipenv --$(DEFAULT_PYTHON_VERSION) install --dev
710

8-
## Cleans test and packaging outputs.
11+
## Removes everything including virtual environments.
912
.PHONY: clean
10-
clean:
11-
rm -rf .coverage htmlcov/ build/ dist/
13+
clean: mostlyclean
14+
-pipenv --rm
15+
rm -f Pipfile.lock
16+
17+
## Removes test and packaging outputs.
18+
.PHONY: mostlyclean
19+
mostlyclean:
20+
rm -rf .coverage htmlcov/ .pytest_cache/ build/ dist/
1221

1322
## Runs tests.
1423
.PHONY: test
15-
test: clean
24+
test:
1625
pipenv run pytest $(TEST_DIR) -v -s --disable-warnings
1726

1827
## Creates coverage report.
1928
.PHONY: coverage
2029
coverage:
21-
pytest --cov=src/ --cov-report=term-missing --cov-report=html --disable-warnings
30+
pipenv run pytest --cov=src/ --cov-report=term-missing --cov-report=html --disable-warnings
2231
open htmlcov/index.html || xdg-open htmlcov/index.html
2332

2433
## Packages for both Python 2 and 3 for PyPi.
25-
.PHONY: packaging
26-
packaging:
27-
pipenv --rm
28-
rm Pipfile.lock
29-
pipenv --three install --dev
34+
.PHONY: dist
35+
dist: mostlyclean
36+
-pipenv --rm
37+
pipenv --three install --dev --skip-lock
3038
pipenv run python setup.py sdist bdist_wheel
3139
pipenv --rm
32-
rm Pipfile.lock
33-
pipenv --two install --dev
40+
pipenv --two install --dev --skip-lock
3441
pipenv run python setup.py sdist bdist_wheel
3542
pipenv --rm
36-
rm Pipfile.lock
43+
pipenv --$(DEFAULT_PYTHON_VERSION) install --dev
3744

3845
## Uploads packages to PyPi.
3946
.PHONY: upload
4047
upload:
41-
pipenv run twine upload dist/*
48+
pipenv run twine upload --repository-url $(PYPI_URL) dist/*
4249

4350
## Alias for packaging and upload together.
4451
.PHONY: pypi
45-
pypi: packaging upload setup
46-
47-
.DEFAULT:
48-
@$(MAKE) help
52+
pypi: dist upload
4953

5054
## This help message.
5155
.PHONY: help

0 commit comments

Comments
 (0)