diff --git a/.dockerignore b/.dockerignore index f097b36..48b503c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,8 @@ .dist -.git .idea .pytest_cache .tox htmlcov venv -setup.py +db.sqlite3 **/__pycache__ \ No newline at end of file diff --git a/.gitignore b/.gitignore index c522739..48f1113 100644 --- a/.gitignore +++ b/.gitignore @@ -181,7 +181,6 @@ build.properties.json REVISION db.sqlite* katka-api-*.tgz -setup.py venv src/main/params.py diff --git a/Dockerfile b/Dockerfile index ad49ca4..e7a9bb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Makefile b/Makefile index 98d137f..655b3d7 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 ********** @@ -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/* @@ -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 diff --git a/pyproject.toml b/pyproject.toml index af9197f..1a7ec3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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'] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 40de5cb..bc8474c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,24 @@ -# Additional packages --r requirements/requirements-base.txt --r requirements/requirements-testing.txt \ No newline at end of file +# 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] diff --git a/requirements/requirements-base.txt b/requirements/requirements-base.txt deleted file mode 100644 index 46f07a9..0000000 --- a/requirements/requirements-base.txt +++ /dev/null @@ -1,4 +0,0 @@ -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 diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt deleted file mode 100644 index 3a63905..0000000 --- a/requirements/requirements-testing.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Code style -isort -flake8 -black - -# Tests -tox -codecov -freezegun -pytest -pytest-cov -pytest-django -pluggy - -# Packaging -pkgversion -setuptools -twine -wheel - -readme_renderer[md] diff --git a/setup_gen.py b/setup.py similarity index 67% rename from setup_gen.py rename to setup.py index e7532ea..d2319c7 100644 --- a/setup_gen.py +++ b/setup.py @@ -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='d-nitro@kpn.com', 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, @@ -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', ] )