Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #1964

Merged
merged 83 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
8076ecd
Dev start
dennissiemensma Feb 5, 2023
cd88ef7
Poetry update
dennissiemensma Feb 5, 2023
33a9100
Poetry update
dennissiemensma Feb 5, 2023
dd6240d
Bulk reformat black
dennissiemensma Feb 5, 2023
f07300b
Bump deps
dennissiemensma Feb 6, 2023
29b54f7
Sync Poetry deps with req files
dennissiemensma Feb 6, 2023
507ea7e
Bugfix for Archive which was causing the electricity returned meter p…
dennissiemensma Feb 12, 2023
49a387d
Typo
dennissiemensma Feb 12, 2023
4e83b0b
Slightly push archive warning smaller
dennissiemensma Feb 12, 2023
afc6495
Poetry update
dennissiemensma Feb 12, 2023
27438fd
Add docker ubuntu link
dennissiemensma Feb 20, 2023
8271320
Move run commands for IDE
dennissiemensma Feb 20, 2023
d5dcae1
Revert "Move run commands for IDE"
dennissiemensma Feb 20, 2023
f815ffe
Poetry update
dennissiemensma Feb 20, 2023
bb5b484
Dev how-to update
dennissiemensma Feb 20, 2023
12d0e57
Fix dev deps
dennissiemensma Feb 20, 2023
5da612b
Mark #1811
dennissiemensma Feb 20, 2023
9d6ea56
Trigger tests for PRs
dennissiemensma Feb 25, 2023
edbc106
Trigger tests for PRs
dennissiemensma Feb 25, 2023
11b9abd
Poetry update
dennissiemensma Feb 26, 2023
77a3546
Slightly alter debug info for unsupported database engines #1767
dennissiemensma Feb 27, 2023
1740c62
Improve dev reset a bit
dennissiemensma Feb 27, 2023
8d5d8f9
Poetry update
dennissiemensma Mar 6, 2023
c522ec9
Bump dev how-to
dennissiemensma Mar 6, 2023
484264d
Poetry update
dennissiemensma Mar 13, 2023
187ca39
Rework DEV string
dennissiemensma Mar 13, 2023
6b58064
Tagged some deprecations
dennissiemensma Mar 13, 2023
b3b7155
Rework fake datalogger a bit
dennissiemensma Mar 13, 2023
4ed07ae
Fix deprecation lib
dennissiemensma Mar 13, 2023
848f593
Update to-v5.rst
goegol Mar 28, 2023
7172da5
Changelog bump #1827
dennissiemensma Mar 28, 2023
264d9de
Bump
dennissiemensma Mar 28, 2023
a714a0d
Poetry update
dennissiemensma Apr 4, 2023
e3045ba
Bump major versions of testing databases
dennissiemensma Apr 4, 2023
ab2d1c1
restart: unless-stopped
dennissiemensma Apr 4, 2023
975bd06
Poetry update
dennissiemensma May 10, 2023
7ac1d5e
Poetry update
dennissiemensma May 10, 2023
ca1735c
Bump
dennissiemensma May 10, 2023
7c4e341
Poetry update
dennissiemensma May 24, 2023
3a0aa0f
Added undocumented env var for low level datalogger usage #1861
dennissiemensma Jul 21, 2023
3afd57e
Bump dependencies
dennissiemensma Jul 21, 2023
0311471
Restored broken `v4-upgrade-redirect` route for legacy upgrades #1841
dennissiemensma Jul 21, 2023
68e66aa
Fix test for `v4-upgrade-redirect` #1841
dennissiemensma Jul 21, 2023
a2e40d0
Rework test script tools a bit
dennissiemensma Jul 21, 2023
6263a56
Fix typo
dennissiemensma Jul 21, 2023
4814045
Pin [email protected] due to failing tests with higher versions
dennissiemensma Jul 21, 2023
88859d8
Poetry update
dennissiemensma Oct 19, 2023
e2c8ac7
Black reformat
dennissiemensma Oct 19, 2023
ce8462a
Try Python 3.12
dennissiemensma Oct 19, 2023
1b27bfc
Make python dev version an arg
dennissiemensma Oct 19, 2023
667ac2e
Revert to Python 3.11
dennissiemensma Oct 19, 2023
9ab6940
Black fix
dennissiemensma Oct 19, 2023
b82318b
Fix sorted graph names #1901
dennissiemensma Oct 23, 2023
1fe24a4
Fix weird legacy migration code/error
dennissiemensma Nov 20, 2023
abc74f1
CI: rework PR branch triggers
dennissiemensma Nov 1, 2023
37a26e6
Fix RTD build config
dennissiemensma Nov 20, 2023
732843e
Add ARGS to test cli
dennissiemensma Nov 20, 2023
e0f8f00
Git ignore compose files
dennissiemensma Nov 20, 2023
2f7ac34
Default docker build python version
dennissiemensma Nov 20, 2023
608362f
Bump RTD Python version
dennissiemensma Nov 20, 2023
4f688fd
Rename RTD config
dennissiemensma Nov 20, 2023
d0ba380
Drop legacy RTD config option
dennissiemensma Nov 20, 2023
24186ef
Add RTD requirements
dennissiemensma Nov 20, 2023
1219d02
Use more accurate data_retention_in_hours
RichieB2B Jan 2, 2024
b9fa115
Merge branch 'v5' into bug/1945/retention-periods
dennissiemensma Jan 2, 2024
7391050
Reworked retention intervals #1945
dennissiemensma Jan 2, 2024
d2e2fe0
Bump
dennissiemensma Jan 2, 2024
074b2a0
Bump deps
dennissiemensma Jan 2, 2024
a079268
Fix migration #1945
dennissiemensma Jan 2, 2024
7903cf3
Fix flake8-bandit
dennissiemensma Jan 2, 2024
82e3141
Bump urllib3
dennissiemensma Jan 4, 2024
bf4e3fa
Bump issue template
dennissiemensma Jan 22, 2024
578b972
Bump issue template
dennissiemensma Jan 26, 2024
2dc82be
Prep v5.11
dennissiemensma Jan 26, 2024
8458ce2
Poetry update
dennissiemensma Jan 26, 2024
1e80642
Bump CI Actions
dennissiemensma Jan 26, 2024
6302616
Pin black to match CI
dennissiemensma Jan 29, 2024
eb511b2
Black reformat
dennissiemensma Jan 29, 2024
a96b540
Fix typo in API docs sample
dennissiemensma Jan 30, 2024
2ce353f
RTD: Bump reqs
dennissiemensma Feb 19, 2024
5f17f99
Bump 5.11 release
dennissiemensma Feb 19, 2024
1675c35
Merge branch 'v5' into development
dennissiemensma Feb 19, 2024
00033d8
CI: Bump codecov/codecov-action
dennissiemensma Feb 19, 2024
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
18 changes: 9 additions & 9 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- '3.11'
services:
postgres:
image: 'postgres:13-alpine'
image: 'postgres:14-alpine'
ports:
- 5432
env:
Expand All @@ -31,7 +31,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 5s --health-timeout 1s --health-retries 10

mysql:
image: 'mysql:5.7'
image: 'mysql:8'
ports:
- 3306
env:
Expand All @@ -42,10 +42,10 @@ jobs:
# Do not log verbosely
DSMRREADER_LOGLEVEL: ERROR
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -55,7 +55,7 @@ jobs:
sudo apt-get install -y gettext libgettextpo-dev libmariadb-dev-compat libmariadb-dev

- name: Cached dependencies & virtualenv
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry/
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
DJANGO_DATABASE_PASSWORD: ''

- name: Code coverage upload
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4


# Shallow tests for (older) supported Python versions.
Expand All @@ -127,10 +127,10 @@ jobs:
# Do not log verbosely
DSMRREADER_LOGLEVEL: ERROR
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -140,7 +140,7 @@ jobs:
sudo apt-get install -y gettext libgettextpo-dev libmariadb-dev-compat libmariadb-dev

- name: Cached dependencies & virtualenv
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
/Pipfile.lock
/manage_mule.py
/docker-compose.yml
/docker-compose.override.yml
/compose.yml
/compose.override.yml
/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/runConfigurations/Docker__Test_PostgreSQL.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/runConfigurations/Docker__Test_SQLite__quick_test_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/_locale/nl/LC_MESSAGES/how-to/development.mo
Binary file not shown.
84 changes: 48 additions & 36 deletions docs/_locale/nl/LC_MESSAGES/how-to/development.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ msgid ""
msgstr ""
"Project-Id-Version: DSMR-reader\n"
"Report-Msgid-Bugs-To: Dennis Siemensma <[email protected]>\n"
"POT-Creation-Date: 2023-03-06 17:59+0000\n"
"PO-Revision-Date: 2023-03-06 19:00+0100\n"
"Last-Translator: Dennis Siemensma <[email protected]>\n"
"Language: nl\n"
"Language-Team: Dennis Siemensma <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Babel 2.12.1\n"
"X-Generator: Poedit 3.0.1\n"

#: ../../how-to/development.rst:2
msgid "Developing: Localhost"
Expand All @@ -27,8 +31,8 @@ msgid "I'm using JetBrain's PyCharm IDE for local development, which has builtin
msgstr "Ik gebruik JetBrain's PyCharm IDE om lokaal te ontwikkelen. Deze heeft ingebouwde ondersteuning voor Git en Docker, dus het kan zijn dat informatie of stappen hieronder wat afwijken van je eigen situatie."

#: ../../how-to/development.rst:17
msgid "Install Docker on your system."
msgstr "Installeer Docker op je systeem."
msgid "Install Docker on your system. E.g. Ubuntu: https://docs.docker.com/engine/install/ubuntu/ and consider rootless: https://docs.docker.com/engine/security/rootless/"
msgstr "Installeer Docker op je systeem. Bijvoorbeeld voor Ubuntu: https://docs.docker.com/engine/install/ubuntu/ en overweeg rootless: https://docs.docker.com/engine/security/rootless/"

#: ../../how-to/development.rst:19
msgid "Clone DSMR-reader repository from GitHub::"
Expand Down Expand Up @@ -63,125 +67,133 @@ msgid "Now check whether tests run well in SQLite::"
msgstr "Probeer nu of de tests goed draaien met SQLite::"

#: ../../how-to/development.rst:63
msgid "Other DB engines can be tested as well, but the CI will take care of it anyway. The SQLite engine matches 99% of the features DSMR-reader requires and it also runs in-memory, speeding up tests."
msgstr "Andere DB-engines kunnen ook getest worden, maar dit doet de CI ook al. De SQLite-engine ondersteunt overigens 99% van de features die DMSR-reader nodig heeft. Daarnaast draait deze ook in-memory, waardoor de tests weer sneller draaien."
#, python-format
msgid "Other DB engines can be tested as well, but the CI will take care of it anyway. The SQLite engine matches 99%% of the features DSMR-reader requires and it also runs in-memory, speeding up tests."
msgstr "Andere DB-engines kunnen ook getest worden, maar dit doet de CI ook al. De SQLite-engine ondersteunt overigens 99%% van de features die DMSR-reader nodig heeft. Daarnaast draait deze ook in-memory, waardoor de tests weer sneller draaien."

#: ../../how-to/development.rst:67
#: ../../how-to/development.rst:65
msgid "When using PyCharm, you can add a new Interpreter using Docker Compose. Just select ``dsmr-app`` and set ``/opt/venv/bin/python`` as interpreter path. It should now map all dependencies used/installed in the container."
msgstr "Wanneer je PyCharm gebruikt kun je een nieuwe Interpreter toevoegen die Docker Compose gebruikt. Selecteer ``dsmr-app`` en stel ``/opt/venv/bin/python`` in als interpreter path. Nu zouden alle gebruikte dependencies goed gemapt moeten worden vanuit de container."

#: ../../how-to/development.rst:69
msgid "Initial data to develop with"
msgstr "Initiele gegevens om mee te ontwikkelen"

#: ../../how-to/development.rst:69
#: ../../how-to/development.rst:71
msgid "To be honest, the best initial/fixture data is simply a backup of your own system in production."
msgstr "De beste gegevens om mee te ontwikkelen zijn eerlijk gezegd simpelweg gegevens uit je eigen productieomgeving."

#: ../../how-to/development.rst:73
#: ../../how-to/development.rst:75
msgid "Please note that you should not run any (backend) processes in your DSMR-reader development environment, **until you've unlinked all external services**."
msgstr "Voorkom dat je (achtergrond)processen draait in je lokale DSMR-reader ontwikkelomgeving, **totdat je alle externe diensten hebt ontkoppeld**."

#: ../../how-to/development.rst:75
#: ../../how-to/development.rst:77
msgid "After importing the backup of your production system, simply run::"
msgstr "Voer simpelweg het volgende uit, na het importeren van een backup uit je eigen productieomgeving::"

#: ../../how-to/development.rst:79
#: ../../how-to/development.rst:81
msgid "This will remove all API keys and other links to externals systems, as well as reset the admin user credentials to ``admin / admin`` (user / password)."
msgstr "Dit verwijdert alle API-keys en andere koppelingen naar externe systemen. Tevens wordt de admin-gebruiker gereset naar ``admin / admin`` (gebruiker / wachtwoord)."

#: ../../how-to/development.rst:81
#: ../../how-to/development.rst:83
msgid "Just import it as you should on your RaspberryPi. Copy a database backup to ``/var/lib/postgresql/`` on your PC and import it::"
msgstr "Importeer deze zoals je dat ook zou doen op je RaspberryPi. Kopieer een database-backup naar ``/var/lib/postgresql`` op je PC en importeer deze met::"

#: ../../how-to/development.rst:95
#: ../../how-to/development.rst:97
msgid "Fake datalogger"
msgstr "Nep datalogger"

#: ../../how-to/development.rst:99
#: ../../how-to/development.rst:101
msgid "There is a builtin command that can somewhat fake a datalogger::"
msgstr "Er is een ingebouwd command voor een soort van datalogger die nepdata genereert::"

#: ../../how-to/development.rst:103
#: ../../how-to/development.rst:105
msgid "It will generate random data every second in a certain pattern and should be fine for basic testing."
msgstr "Deze genereert elke seconde willekeurige gegevens in een bepaald patroon en is vaak meer dan afdoende voor simpele testdoeleinden."

#: ../../how-to/development.rst:105
#: ../../how-to/development.rst:107
msgid "Please note that it only inserts unprocessed readings, so you'll still have to run the following command to have the readings processed::"
msgstr "Hiermee worden alleen onverwerkte metingen aangemaakt. Je zult ze nog steeds moeten verwerken door het volgende uit te voeren::"

#: ../../how-to/development.rst:111
#: ../../how-to/development.rst:113
msgid "Running DSMR-reader locally"
msgstr "DSMR-reader lokaal draaien"

#: ../../how-to/development.rst:113
#: ../../how-to/development.rst:115
msgid "When running it with the default Docker compose config, the ``dsmr-app`` `Django Development Server application <https://docs.djangoproject.com/en/3.2/intro/tutorial01/#the-development-server>`_ will be accessible at: ``http://localhost:8000/``."
msgstr "Wanneer je de standaard Docker compose configuratie gebruikt, is de ``dsmr-app`` `Django Development Server applicatie <https://docs.djangoproject.com/en/3.2/intro/tutorial01/#the-development-server>`_ toegankelijk op: ``http://localhost:8000/``."

#: ../../how-to/development.rst:115
#: ../../how-to/development.rst:117
msgid "Any Python code changes you make will cause the Django Development Server to reload itself automatically."
msgstr "Wijzigingen aan Python-bestanden zorgen ervoor dat de Django Development Server zichzelf automatisch herlaadt."

#: ../../how-to/development.rst:119
#: ../../how-to/development.rst:121
msgid "Tests and coverage"
msgstr "Tests en dekking"

#: ../../how-to/development.rst:121
#: ../../how-to/development.rst:123
msgid "DSMR-reader's test coverage should remain as high as possible, however this does not guarantee the quality of tests, so find a sweet spot for coverage whenever possible."
msgstr "DSMR-reader's testdekking zou zo hoog mogelijk moeten blijven, alhoewel dat niet perse wat zegt over de kwaliteit van de tests. Zoek hier een middenweg in."

#: ../../how-to/development.rst:123
#: ../../how-to/development.rst:125
msgid "The easiest way to run tests is to use the SQLite (in-memory) tests::"
msgstr "De makkelijkste manier om tests te draaien is via de SQLite (in-memory) tests::"

#: ../../how-to/development.rst:127
#: ../../how-to/development.rst:129
msgid "To test a single app within DSMR-reader, just append it::"
msgstr "Om een enkele app binnen DSMR-reader te testen, geef je deze simpelweg als extra argument op::"

#: ../../how-to/development.rst:131
#: ../../how-to/development.rst:133
msgid "The test coverage should be visible in the terminal after running tests. There are detailed HTML pages available as well, after each test run, in ``coverage_report/html/index.html``. Just open it with your browser to view the test coverage of each file and line."
msgstr "De test dekking zou na het draaien van tests zichtbaar moeten zijn in de terminal. Er zijn tevens gedetaileerde HTML-pagina's beschikbaar in ``coverage_report/html/index.html``, na het draaien van tests. Je kunt deze openen met je browser om de test dekking in detail te zien per bestand en per regel code."

#: ../../how-to/development.rst:137
#: ../../how-to/development.rst:139
msgid "A side effect of running tests is that it may also regenerate .PO files from the ``docs/`` folder. If you did not make any changes there, your should just ignore those changed files and revert them."
msgstr "Een mogelijk bijeffect van het draaien van tests is dat hiermee ook .PO-bestanden in de ``docs/`` map bijgewerkt worden. Als je daar geen wijzigingen in hebt gedaan, kun je die door de tests gewijzigde bestanden negeren."

#: ../../how-to/development.rst:142
#: ../../how-to/development.rst:144
msgid "Translations"
msgstr "Vertalingen"

#: ../../how-to/development.rst:144
#: ../../how-to/development.rst:146
msgid "You can find the translations (.PO files) for the main application in ``dsmrreader/locales/``. To regenerate them, just execute the ``docker exec -it dsmr-app poetry run ./tools/check-translations.sh`` script."
msgstr "Je kunt de vertalingen (.PO-bestanden) voor de hoofdapplicatie vinden in ``dsmrreader/locales/``. Om ze te hergenereren voer het ``docker exec -it dsmr-app poetry run ./tools/check-translations.sh`` script uit, zodat een van de tests de vertalingen opnieuw checkt."

#: ../../how-to/development.rst:149
#: ../../how-to/development.rst:151
msgid "Editing documentation"
msgstr "Documentatie bijwerken"

#: ../../how-to/development.rst:151
#: ../../how-to/development.rst:153
msgid "The documentation is part of the repository and can be generated (automatically) with Sphinx."
msgstr "De documentatie is onderdeel van het project en kan (automatisch) gegenereerd worden via Sphinx."

#: ../../how-to/development.rst:153
#: ../../how-to/development.rst:155
msgid "By default the Docker compose file should create and run a docs container for each language supported."
msgstr "Standaard zou de Docker compose file een container moeten maken voor documentatie, per ondersteunde taal."

#: ../../how-to/development.rst:155
#: ../../how-to/development.rst:157
msgid "English::"
msgstr "Engelstalig::"

#: ../../how-to/development.rst:159
#: ../../how-to/development.rst:161
msgid "Dutch::"
msgstr "Nederlandstalig::"

#: ../../how-to/development.rst:163
#: ../../how-to/development.rst:165
msgid "Any changes you make will be reflected instantly in the browser, as Sphinx continuously checks for changed files."
msgstr "Wijzigingen die je doorvoert in Pworden direct automatisch bijgewerkt en getoond in je browser, waar Sphinx voor zorgt."

#: ../../how-to/development.rst:167
#: ../../how-to/development.rst:169
msgid "Translating documentation"
msgstr "Documentatie vertalen"

#: ../../how-to/development.rst:169
#: ../../how-to/development.rst:171
msgid "Translations are done using gettext and .PO files. Regenerate the .PO files with::"
msgstr "Vertalingen verlopen via .PO-bestanden met gettext. Hergenereer de .PO-bestanden met::"

#: ../../how-to/development.rst:173
#: ../../how-to/development.rst:175
msgid "The .PO files in ``docs/locale`` should be regenerated now. You can use the open-source tool ``poedit`` to view and translate the files."
msgstr "De .PO-bestanden in ``docs/_locale`` zouden nu opnieuw gegenereerd moeten worden. Je kunt het open-source programma ``poedit`` gebruiken om de bestanden te bekijken en te vertalen."

#~ msgid "Install Docker on your system."
#~ msgstr "Installeer Docker op je systeem."
6 changes: 4 additions & 2 deletions docs/how-to/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Setting up a development environment using Docker
I'm using JetBrain's PyCharm IDE for local development, which has builtin support for Git and Docker.
Therefor some steps or information below may or may not match your own development stack.

- Install Docker on your system.
- Install Docker on your system. E.g. Ubuntu: https://docs.docker.com/engine/install/ubuntu/ and consider rootless: https://docs.docker.com/engine/security/rootless/

- Clone DSMR-reader repository from GitHub::

Expand Down Expand Up @@ -60,7 +60,9 @@ Setting up a development environment using Docker

.. tip::

Other DB engines can be tested as well, but the CI will take care of it anyway. The SQLite engine matches 99% of the features DSMR-reader requires and it also runs in-memory, speeding up tests.
Other DB engines can be tested as well, but the CI will take care of it anyway. The SQLite engine matches 99%% of the features DSMR-reader requires and it also runs in-memory, speeding up tests.

- When using PyCharm, you can add a new Interpreter using Docker Compose. Just select ``dsmr-app`` and set ``/opt/venv/bin/python`` as interpreter path. It should now map all dependencies used/installed in the container.


Initial data to develop with
Expand Down
Loading
Loading