Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

Commit

Permalink
NEW: Use setuptools_scm instead of pkgversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel Holtkamp committed Mar 31, 2020
1 parent d40731b commit e638384
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 52 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.dist
.git
.idea
.pytest_cache
.tox
htmlcov
venv
setup.py
db.sqlite3
**/__pycache__
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ build.properties.json
REVISION
db.sqlite*
katka-api-*.tgz
setup.py
venv
src/main/params.py

Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ WORKDIR $PROJECT_ROOT

COPY Makefile .
COPY requirements.txt .
COPY requirements requirements
COPY setup.py .
COPY README.md .
# purely so we can get the version from git
COPY .git .git
RUN make install_requirement_txt

CMD ["make", "test"]
15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
IMAGE=katka-core
DOCKER_REPOSITORY=kpnnv

REQUIREMENTS_BASE:=requirements/requirements-base.txt
REQUIREMENTS_TEST:=requirements/requirements-testing.txt
REQUIREMENTS_TXT:=requirements.txt

PYTHON_VERSION=python3.8
Expand Down Expand Up @@ -104,7 +102,7 @@ tox:
test: docker/test_local

.PHONY: test_local
test_local: install_requirement_txt check_forgotten_migrations install_requirement_unittests lint tox
test_local: install_requirement_txt check_forgotten_migrations lint tox
@echo 'tests done'

# ********** Code style **********
Expand Down Expand Up @@ -137,12 +135,7 @@ format/black:


# ********** Packaging and distributing **********
setup.py:
$(PYTHON) setup_gen.py
@echo 'setup.py created'

publish: setup.py
$(PIP) install -U pip
publish:
$(PYTHON) setup.py sdist bdist_wheel
$(TWINE) check dist/*
$(TWINE) upload dist/*
Expand All @@ -153,10 +146,6 @@ publish: setup.py
install_requirement_txt:
@$(PIP) install -r $(REQUIREMENTS_TXT)

.PHONY: install_requirement_unittests
install_requirement_unittests:
$(PIP) install -r $(REQUIREMENTS_TEST)


# ********** Virtual environment **********
.PHONY: venv
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[tool.black]
line-length = 120
target_version = ['py37']

[tool.setuptools_scm]

[build-system]
requires = ['setuptools>=42', 'wheel', 'setuptools_scm[toml]>=3.4']
27 changes: 24 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# Additional packages
-r requirements/requirements-base.txt
-r requirements/requirements-testing.txt
# Package in develop mode
-e .

# Code style
isort
flake8
black

# Tests
tox
codecov
freezegun
pytest
pytest-cov
pytest-django
pluggy

# Packaging
setuptools
setuptools_scm
twine
wheel

readme_renderer[md]
4 changes: 0 additions & 4 deletions requirements/requirements-base.txt

This file was deleted.

21 changes: 0 additions & 21 deletions requirements/requirements-testing.txt

This file was deleted.

18 changes: 11 additions & 7 deletions setup_gen.py → setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/usr/bin/env python
import os
from setuptools import find_packages, setup

from pkgversion import list_requirements, pep440_version, write_setup_py
from setuptools import find_packages

write_setup_py(
setup(
name='katka-core',
version=os.getenv('tag') or pep440_version(),
use_scm_version=True,
setup_requires=["setuptools_scm"],
description='Katka Django core application',
long_description=open('README.md', encoding='utf-8').read(),
long_description_content_type='text/markdown',
author='D-Nitro',
author_email='[email protected]',
url='https://github.com/kpn/katka-core',
install_requires=list_requirements('requirements/requirements-base.txt'),
install_requires=[
'Django>=2.2.9,<3.0',
'djangorestframework>=3.9.0,<4.0.0',
'django-encrypted-model-fields>=0.5.8,<1.0.0',
'drf-nested-routers',
],
packages=find_packages(),
tests_require=['tox'],
include_package_data=True,
Expand All @@ -25,6 +28,7 @@
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Internet :: WWW/HTTP',
]
)

0 comments on commit e638384

Please sign in to comment.