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
16 changes: 16 additions & 0 deletions .contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This is Dockerfile for development purposes only.
ARG PYTHON_VERSION='3.7'
FROM python:${PYTHON_VERSION}
RUN mkdir /code /code/production
WORKDIR /code

# Install python dependencies
ENV PYTHONUNBUFFERED 1
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
wait-for-it \
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements*.txt ./
ARG DJANGO_VERSION='==2.2.*'
RUN pip install --no-cache-dir "django${DJANGO_VERSION}" -r requirements-test.txt
CMD python manage.py runserver 0.0.0.0:8000
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Python package

on: [push]

jobs:
django:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix:
python:
- 3.6
- 3.7
- 2.7
django:
- "==1.11.*"
- "==2.1.*"
- "==2.2.*"
exclude:
- python: 2.7
django: "==2.1.*"
- python: 2.7
django: "==2.2.*"

steps:
- uses: actions/checkout@v1
- name: Build application
run: make build
env:
PYTHON_VERSION: ${{ matrix.python }}
DJANGO_VERSION: ${{ matrix.django }}
- name: Lint
run: make lint
- name: Migration check
run: make check
- name: Show settings
run: make settings

- name: Build test
run: make test

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build application
run: make build
- name: Build documentation
run: make docs
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ History
0.13.0 (2017-07-13)
*******************

* Improve import performacne
* Fix path of *.xml files (use on-premise TravisCI-cached copy)
* Improve import performance
* Add support to SIMC database
* Fix path of ```*.xml``` files (use on-premise TravisCI-cached copy)

0.12.1 (2017-04-04)
*******************
Expand Down
76 changes: 30 additions & 46 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
.PHONY: clean-pyc clean-build docs

help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "sdist - package"

clean: clean-build clean-pyc

clean-build:
rm -fr build/
rm -fr dist/
rm -fr *.egg-info

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
clean:
docker-compose down
rm -r assets || true

assets:
mkdir -p assets
wget http://cdn.files.jawne.info.pl/public_html/2017/07/13_01_48_33/TERC.xml -O assets/TERC_old.xml
wget http://cdn.files.jawne.info.pl/public_html/2017/07/13_01_48_33/SIMC.xml -O assets/SIMC_old.xml
wget http://cdn.files.jawne.info.pl/public_html/2017/12/03_05_43_05/TERC_Urzedowy_2017-12-03.xml -O assets/TERC.xml
wget http://cdn.files.jawne.info.pl/public_html/2017/12/03_05_43_05/SIMC_Urzedowy_2017-12-03.xml -O assets/SIMC.xml

build:
docker-compose build web

test: assets
docker-compose run -v $$PWD/assets:/assets -e CACHE_DIR=/assets/ web python manage.py test --keepdb --verbosity=2 tests.test_command.TestCommand

wait_mysql:
docker-compose run web bash -c 'wait-for-it db:3306'

migrate:
docker-compose run web python manage.py migrate

lint:
flake8 teryt_tree tests
docker-compose run web flake8 teryt_tree

test:
python runtests.py tests
check: wait_mysql
docker-compose run web python manage.py makemigrations --check

test-all:
tox
migrations: wait_mysql
docker-compose run web python manage.py makemigrations

coverage:
coverage run --source teryt_tree runtests.py tests
coverage report -m
coverage html
open htmlcov/index.html
settings:
docker-compose run web python manage.py diffsettings

docs:
rm -f docs/django-teryt-tree.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ teryt_tree
$(MAKE) -C docs clean
$(MAKE) -C docs html
open docs/_build/html/index.html

release: clean
python setup.py sdist upload
python setup.py bdist_wheel upload

sdist: clean
python setup.py sdist
ls -l dist
docker-compose run web sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: '2.1'
# This is application’s services configuration for development purposes only.

services:
db:
container_name: db
image: mysql:5.7
ports:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: "password"
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=password
timeout: 20s
retries: 10
volumes:
- ./.contrib/docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro
- mysql_db:/var/lib/mysql

web:
build:
context: .
dockerfile: .contrib/docker/Dockerfile
args:
PYTHON_VERSION: '${PYTHON_VERSION:-3.7}'
DJANGO_VERSION: '${DJANGO_VERSION:-==2.2.*}'

volumes:
- .:/code
environment:
DATABASE_URL: mysql://root:password@db/teryt_tree
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy

volumes:
mysql_db:
5 changes: 2 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-r requirements.txt
tqdm
mock>=1.0.1
flake8>=2.1.0
lxml>=2.3.3
coverage>=4.0
tox==2.3.1
lxml>=2.3.3
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
wheel==0.24.0
# django-autoslug>=1.8.0
https://github.com/Balu-Varanasi/django-autoslug/archive/9fb8528a9e2cc2bbad167595b9f7ef0ca1389dbc.zip
django-model-utils>=2.3.1
django-mptt>=0.7.4
factory-boy>=2.5.2
Sphinx>=1.8.5
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ replace = version = '{new_version}'
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[flake8]
exclude = docs,env,migrations,south_migrations,.tox
ignore = E128
max-line-length = 120
62 changes: 0 additions & 62 deletions setup.py

This file was deleted.

2 changes: 2 additions & 0 deletions teryt_tree/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

class JednostkaAdministracyjnaAdmin(MPTTModelAdmin):
pass


admin.site.register(JednostkaAdministracyjna, JednostkaAdministracyjnaAdmin)
3 changes: 3 additions & 0 deletions teryt_tree/autocomplete_light_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class JednostkaAdministracyjnaAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields = ['name']


autocomplete_light.register(JednostkaAdministracyjna, JednostkaAdministracyjnaAutocomplete)


Expand All @@ -20,4 +22,5 @@ def choices_for_request(self):
self.choices = self.choices.filter(category__level=3).select_related('parent')
return super(CommunityAutocomplete, self).choices_for_request()


autocomplete_light.register(JednostkaAdministracyjna, CommunityAutocomplete)
2 changes: 0 additions & 2 deletions teryt_tree/management/commands/load_simc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
import argparse
from datetime import datetime
from itertools import islice

from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from django.utils.lru_cache import lru_cache
from tqdm import tqdm

Expand Down
1 change: 0 additions & 1 deletion teryt_tree/management/commands/load_terc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import argparse
from itertools import islice

from tqdm import tqdm
from django.core.management.base import BaseCommand, CommandError
Expand Down
28 changes: 28 additions & 0 deletions teryt_tree/migrations/0005_auto_20191020_1938.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 2.2.6 on 2019-10-21 00:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('teryt_tree', '0004_auto_20170712_2335'),
]

operations = [
migrations.AlterField(
model_name='jednostkaadministracyjna',
name='level',
field=models.PositiveIntegerField(editable=False),
),
migrations.AlterField(
model_name='jednostkaadministracyjna',
name='lft',
field=models.PositiveIntegerField(editable=False),
),
migrations.AlterField(
model_name='jednostkaadministracyjna',
name='rght',
field=models.PositiveIntegerField(editable=False),
),
]
Loading