Skip to content

Commit

Permalink
precommit, setup
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed May 17, 2023
1 parent 4beb32e commit eb0988b
Show file tree
Hide file tree
Showing 30 changed files with 33 additions and 72 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10']
django-version: ['3.2', '4.0', '4.1', 'dev']

python-version: ['3.10', '3.11']
django-version: ['4.1', '4.2', 'dev']
exclude:
- python-version: '3.10'
django-version: 'dev'
services:

mysql:
image: mysql:latest
env:
Expand All @@ -32,20 +33,19 @@ jobs:
sudo apt-get -y update
sudo apt-get install libcups2-dev wamerican
- uses: actions/checkout@v2

- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
Expand All @@ -65,7 +65,7 @@ jobs:
env:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: Python ${{ matrix.python-version }}
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ exclude: tests/etc/user-*

repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
rev: 1.7.5
hooks:
- id: bandit
args:
- "-x *test*.py"

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 23.3.0
hooks:
- id: black
language_version: python3.9
language_version: python3.10

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
args:
- "--config=setup.cfg"

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: requirements-txt-fixer
files: requirements/.*\.txt$
Expand All @@ -42,7 +42,7 @@ repos:
- id: detect-private-key

- repo: https://github.com/adrienverge/yamllint
rev: v1.27.1
rev: v1.31.0
hooks:
- id: yamllint
args:
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 0 additions & 1 deletion edc_reference/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@admin.register(Reference, site=edc_reference_admin)
class ReferenceAdmin(TemplatesModelAdminMixin, admin.ModelAdmin):

date_hierarchy = "report_datetime"

list_display = (
Expand Down
1 change: 0 additions & 1 deletion edc_reference/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AppConfig(DjangoAppConfig):
include_in_administration_section = True

def ready(self):

sys.stdout.write(f"Loading {self.verbose_name} ...\n")

site_reference_configs.autodiscover()
Expand Down
2 changes: 0 additions & 2 deletions edc_reference/management/commands/populate_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@


class Command(BaseCommand):

help = "Populates the reference model"

def add_arguments(self, parser):

parser.add_argument(
"--names",
dest="names",
Expand Down
1 change: 0 additions & 1 deletion edc_reference/management/commands/validate_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Command(BaseCommand):

help = "Validates the reference model config"

def handle(self, *args, **options):
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0002_reference_value_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0001_initial")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0003_reference_related_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0002_reference_value_uuid")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0004_auto_20180116_1528.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("sites", "0002_alter_domain_unique"),
("edc_reference", "0003_reference_related_name"),
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0005_auto_20190305_0123.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0004_auto_20180116_1528")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0006_auto_20190706_0137.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0005_auto_20190305_0123")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0007_auto_20190706_0706.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0006_auto_20190706_0137")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0008_auto_20190708_0605.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0007_auto_20190706_0706")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0009_auto_20190714_2303.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0008_auto_20190708_0605")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0010_auto_20191024_1000.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [("edc_reference", "0009_auto_20190714_2303")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion edc_reference/migrations/0011_auto_20200929_0238.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("edc_reference", "0010_auto_20191024_1000"),
]
Expand Down
1 change: 0 additions & 1 deletion edc_reference/model_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class ReferenceModelMixinError(Exception):


class ReferenceModelMixin(models.Model):

reference_deleter_cls = ReferenceDeleter
reference_updater_cls = ReferenceUpdater

Expand Down
1 change: 0 additions & 1 deletion edc_reference/models/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ReferenceFieldDatatypeNotFound(Exception):


class Reference(BaseUuidModel):

identifier = models.CharField(max_length=50)

visit_schedule_name = models.CharField(max_length=150, null=True)
Expand Down
1 change: 0 additions & 1 deletion edc_reference/populater.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def __init__(self, **kwargs):


class Populater:

reference_updater_cls = ReferenceUpdater

def __init__(
Expand Down
1 change: 0 additions & 1 deletion edc_reference/reference/reference_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class ReferenceUpdater:
getter_cls = ReferenceGetter

def __init__(self, model_obj=None):

reference_fields = site_reference_configs.get_fields(name=model_obj.reference_name)
# loop through fields and update or create each
# reference model instance
Expand Down
1 change: 0 additions & 1 deletion edc_reference/reference_model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class ReferenceFieldAlreadyAdded(Exception):


class ReferenceModelConfig:

reference_model = "edc_reference.reference"

def __init__(self, name=None, fields=None):
Expand Down
1 change: 0 additions & 1 deletion edc_reference/site_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def update(name=None, fields=None, get_config=None):


class SiteReference:

reference_updater = ReferenceUpdater()

def __init__(self):
Expand Down
1 change: 0 additions & 1 deletion edc_reference/tests/reference_test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class ReferenceTestHelperError(Exception):


class ReferenceTestHelper:

visit_model = None

field_types = {
Expand Down
1 change: 0 additions & 1 deletion edc_reference/tests/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class TestModel(TestCase):

reference_model_cls = Reference
subject_identifier = "11111"
visit_schedule_name = "visit_schedule"
Expand Down
1 change: 0 additions & 1 deletion edc_reference/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class HomeView(EdcViewMixin, NavbarViewMixin, TemplateView):

template_name = f"edc_reference/bootstrap{get_bootstrap_version()}/home.html"
navbar_name = "edc_reference"
navbar_selected_item = "reference"
Expand Down
24 changes: 13 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ write_to = "_version.py"

[tool.black]
line-length = 95
target-version = ["py39"]
target-version = ["py310"]
extend-exclude = '''^(.*\/)*\b(migrations)\b($|\/.*$)'''

[tool.isort]
profile = "black"
py_version = "39"
py_version = "310"
skip = [".tox", ".eggs", "migrations"]

[tool.coverage.run]
parallel = true
parallel = false
branch = true
source = ["edc_reference"]

Expand All @@ -27,27 +27,30 @@ source = ["edc_reference"]
show_missing = true
skip_covered = true
omit = ["requirements.txt"]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
]

[tool.tox]
legacy_tox_ini = """
[tox]
envlist =
py{38,39,310}-dj{32,40,41,dev},
py{310}-dj{41,42},
py{311}-dj{41,42,dev},
lint
isolated_build = true
[gh-actions]
python =
3.8: py38
3.9: py39, lint
3.10: py310
3.11: py311, lint
[gh-actions:env]
DJANGO =
3.2: dj32, lint
4.0: dj40
4.1: dj41
4.2: dj42, lint
dev: djdev
[testenv]
Expand All @@ -56,13 +59,12 @@ deps =
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/test_utils.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/edc.txt
-r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/third_party_dev.txt
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<5.0
djdev: https://github.com/django/django/tarball/main
commands =
pip install -U pip
pip install -U pip coverage[toml]
pip --version
pip freeze
coverage run -a runtests.py
Expand Down

0 comments on commit eb0988b

Please sign in to comment.