Skip to content

Commit

Permalink
⬆️ Maintenance: database libraries and 📝 pep-0257 for doc (#4062)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov authored Apr 11, 2023
1 parent db03239 commit c032fb5
Show file tree
Hide file tree
Showing 56 changed files with 315 additions and 219 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1_bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 🐛 Bug
description: File a bug/issue
labels: [bug, "t:bug"]
labels: ["t:bug"]
assignees: ["pcrespov"]
body:
- type: checkboxes
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/4_pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 🚀 Pre-release to staging (developers-only)
description: Issue to plan and log pre-release from master to staging deploy (including staging hotfixes)
title: "🚀 Pre-release master -> staging_<sprint_name><version>"
labels: ["t:maintenance", "release"]
assignees: ["pcrespov"]
assignees: ["matusdrobuliak66"]
body:
- type: dropdown
id: prerelease_kind
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/5_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 🚀 Release to production (developers-only)
description: Creates an issue to plan and log the release from staging to production
title: "🚀 Release v<M.m.0>"
labels: ["t:maintenance", "release"]
assignees: ["pcrespov"]
assignees: ["matusdrobuliak66"]
body:
- type: input
id: version
Expand Down
25 changes: 9 additions & 16 deletions .github/ISSUE_TEMPLATE/6_hotfix.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: 🚑️ Hotfix (developers-only)
description: Critical hotfix to staging or production
title: '🚑️ Release <staging_hotfix/v.X.Y.Z> (hotfix)'
title: "🚑️ Release hotfix/v<version> (hotfix)"
labels: ["t:maintenance", "release"]
assignees: ["pcrespov"]
assignees: ["matusdrobuliak66"]
body:
- type: input
id: version
attributes:
label: Release version
description: Release version as major.minor.patch .Check [Releases](https://github.com/ITISFoundation/osparc-simcore/releases)
placeholder: 1.51.1
placeholder: e.g. 1.51.1
validations:
required: true
- type: input
Expand All @@ -19,7 +19,7 @@ body:
description: |
Selets the commit from which the release takes placeholder. Check [commits](https://github.com/ITISFoundation/osparc-simcore/commits/master)
IMPORTANT: make sure t (i.e. tests passed and images were built and pushed)
placeholder: 8d9a27ebb3e64956e6a41f31839748b3f6a27074
placeholder: e.g. `8d9a27ebb3e64956e6a41f31839748b3f6a27074`
validations:
required: true
- type: input
Expand All @@ -28,16 +28,9 @@ body:
label: "Previous release"
description: |
Link to release that preceeds this release
value: https://github.com/ITISFoundation/osparc-simcore/releases/tag/<vZ.Y.Z>
value: https://github.com/ITISFoundation/osparc-simcore/releases/tag/v<version>
validations:
required: true
- type: checkboxes
attributes:
label: Did the commit CI suceeded?
description: Check the CI of the selected commit in the [repo commits](https://github.com/ITISFoundation/osparc-simcore/commits/master) to make sure the images are built and ready
options:
- label: The commit CI succeeded.
required: true
- type: textarea
attributes:
label: Motivation
Expand All @@ -55,7 +48,7 @@ body:
value: |
- [] create hotfix branch [``hotfix_v1_51_x``](https://github.com/ITISFoundation/osparc-simcore/tree/hotfix_v1_51_x) directly in *upstream* repo. **Do not delete hotfix branches** at least until next *full* release takes place.
- [] prepare hotfix by applying patches/cherry-picks (see *what changed* section)
- [] test hotfix in local deployment @pcrespov
- [] test hotfix in local deployment
- [] push and [check whether CI passed](https://github.com/ITISFoundation/osparc-simcore/actions)
- [] check [images in dockerhub](https://registry.hub.docker.com/u/itisfoundation)
validations:
Expand All @@ -73,9 +66,9 @@ body:
attributes:
label: Releasing 🚀
value: |
- ``make release-hotfix version=1.51.1 git_sha=8d9a27ebb3e64956e6a41f31839748b3f6a27074``
- ``make release-hotfix version=<version> git_sha=<commit_sha>``
- [ ] Draft [release notes](https://github.com/ITISFoundation/osparc-simcore/releases) 🚀
- [ ] No need for maintenance announcement?: Target update of ``service``
- [ ] No need for maintenance announcement?: Target update of ``<target_service>``
- [ ] Deploy hot-fix.
- [ ] ``autodeployer`` OFF in aws-prod, dalco-prod, ti
- [ ] [release](https://github.com/ITISFoundation/osparc-simcore/releases) 🚀 !!!!
Expand All @@ -85,5 +78,5 @@ body:
- [ ] Test and Monitor. Revert back if needed!
- [ ] Announce hot-fix
``` md
:tada: https://github.com/ITISFoundation/osparc-simcore/releases/tag/v<M.m.0>
:tada: https://github.com/ITISFoundation/osparc-simcore/releases/tag/v<version>
```
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"eamodio.gitlens",
"exiasr.hadolint",
"ms-python.python",
"njpwerner.autodocstring",
"samuelcolvin.jinjahtml",
"timonwong.shellcheck"
]
Expand Down
45 changes: 36 additions & 9 deletions docs/coding-conventions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Coding Conventions and Linters

Coding styles and linters are provided for the Javascript and Python.
Some conventions on coding style and tools for the Javascript and Python in this repository.

----
## Javascript

In general the `qooxdoo` naming convention/style is followed. The [Access](http://qooxdoo.org/docs/#/core/oo_feature_summary?id=access) paragraph is the most notable. It is recommended to read the entire document.

Have a look at `ESLint`'s configuration files [.eslintrc.json](.eslintrc.json) and [.eslintignore](.eslintignore).


----
## Python

In short we use the following naming convention ( roughly [PEP8](https://peps.python.org/pep-0008/) ):
Expand All @@ -24,35 +27,59 @@ In short we use the following naming convention ( roughly [PEP8](https://peps.p

- We encourage marking protected/private entities. We do it adding the prefix `_`/`__`: e.g. `_PROTECTED_CONSTANT`, `A.__private_func`
- We encourage **meaningful** type annotations
- We encourage [pep257] for **simple** code documentation
- Priorize having good variable names and type annotations than a verbose and redundant documentation
- Examples of useful documentation:
- Raised *Exceptions* in a function
- *Rationale* of a design
- *Extra information* on variable/argument that cannot be deduced from its name or type annotation
- Use vscode tool `njpwerner.autodocstring`
- See [example](https://github.com/NilsJPWerner/autoDocstring/blob/HEAD/docs/pep257.md) of [pep257] doc.

### For the rest ... (tools)

For the rest basically:
- [black] will enforce the style: Just use it.
- [pylint] will check the some extra conventions: see [.pylintrc](../.pylintrc).
- [mypy] will check syntax : see [mypy.ini](../mypy.ini)
- ``make pylint`` recipe available on ``packages`` or ``services``
- [mypy] is a type-checker that will check syntax : see [mypy.ini](../mypy.ini)
- See intro in [mypy-doc]
- ``make mypy`` recipe available on ``packages`` or ``services``

[mypy]:https://www.mypy-lang.org/
[black]:https://black.readthedocs.io/en/stable/index.html
[pylint]:https://pylint.readthedocs.io/en/latest/

----

## Postgres

### Foreign keys

- Name pattern: ```fk_$(this_table)_$(this_column)```, for example ```fk_projects_to_product_product_name```
- **Foreign Keys** follow this name pattern: ```fk_$(this_table)_$(this_column)```, for example ```fk_projects_to_product_product_name```


----
## Shell Scripts

- Recommended style: https://google.github.io/styleguide/shellguide.html
- Automatic analysis tool: [shellcheck](https://www.shellcheck.net)
- see ``scripts/shellcheck.bash`` and ``.vscode/settings.template.json``
- Recommended inside of a ``scripts`` folder


----
## General

<!-- Add below this line coding agreed coding conventions and give them a number !-->

### CC1: Can I use ``TODO:``, ``FIXME:``?

We should avoid merging PRs with ``TODO:`` and ``FIXME:`` into master. One of our bots detects those and flag them as code-smells. If we still want to keep this idea/fix noted in the code, those can be rewritten as ``NOTE:`` and should be extended with a link to a github issue with more details. For a context, see [discussion here](https://github.com/ITISFoundation/osparc-simcore/pull/3380#discussion_r979893502).






<!-- Keep the space below here for a SORTED list of references -->

[black]:https://black.readthedocs.io/en/stable/index.html
[mypy-doc]:https://mypy.readthedocs.io/en/latest/
[mypy]:https://www.mypy-lang.org/
[pep257]:https://peps.python.org/pep-0257/
[pylint]:https://pylint.readthedocs.io/en/latest/
23 changes: 23 additions & 0 deletions docs/steps-to-upgrade-python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Setps to upgrade python

This is a guideline for repo-wide upgrade of python. Here we assume we are moving from an *current* version ``py3.X`` to a newer version ``py3.Y``


- [ ] Open an issue and paste the following steps (exemple https://github.com/ITISFoundation/osparc-issues/issues/877)
- [ ] Upgrade tests & tools requirements (in `py3.X`)
- [ ] Upgrade primary libraries (e.g. fastapi, etc) (in `py3.X`)
- [ ] Upgrade ``pip`` (in `py3.X`)
- [ ] Check compatibility and bugs sections in [requirements/constraints.txt](../requirements/constraints.txt)
- [ ] Prune unused libraries repo-wide see [how-to-prune-requirements.md](../requirements/how-to-prune-requirements.md) (in `py3.X`)
- [ ] Unify versions repo wide when possible. See [how-to-unify-versions.md](../requirements/how-to-unify-versions.md)
- [ ] Upgrade to `py3.Y`
- read [requirements/how-to-upgrade-python.md](../requirements/how-to-upgrade-python.md)
- read release notes to check for warnings/recommendations for the upgrade
- [ ] Run repo-wide pip-tools with new python version (all ``requirements.txt`` should at least change doc headers)
- [ ] Check deprecation warnings both in code and libraries
- [ ] Remove backport libraries. See [/requirements/packages-notes.md](../requirements/packages-notes.md)
- https://github.com/ITISFoundation/osparc-simcore/pull/4047
- [ ] Remove ``pylint`` `py3.X` github action and add new step to pylint against next version of `py3.Y` (if any)
- [ ] Update ``pyupgrade`` config in ``pre-commit-config.yaml``: e.g. ``--py3Y-plus``
- [ ] Is there something we can automate better? Do it now or open an issue
- [ ] Is there something we can document better? Do it!
13 changes: 0 additions & 13 deletions docs/type-checker.md

This file was deleted.

4 changes: 3 additions & 1 deletion packages/dask-task-models-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ partd==1.3.0
psutil==5.9.4
# via distributed
pydantic==1.10.7
# via -r requirements/../../../packages/models-library/requirements/_base.in
# via
# -r requirements/../../../packages/models-library/requirements/_base.in
# -r requirements/_base.in
pyrsistent==0.19.3
# via jsonschema
pyyaml==6.0
Expand Down
1 change: 0 additions & 1 deletion packages/models-library/requirements/_test.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#
--constraint _base.txt

--requirement ../../../packages/postgres-database/requirements/_base.in
coverage
coveralls
faker
Expand Down
24 changes: 3 additions & 21 deletions packages/models-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#
aiohttp==3.8.4
# via
# -c requirements/../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# pytest-aiohttp
aiosignal==1.3.1
# via aiohttp
alembic==1.9.4
# via -r requirements/../../../packages/postgres-database/requirements/_base.in
async-timeout==4.0.2
# via aiohttp
attrs==22.2.0
Expand Down Expand Up @@ -42,8 +40,6 @@ frozenlist==1.3.3
# via
# aiohttp
# aiosignal
greenlet==2.0.2
# via sqlalchemy
icdiff==2.0.6
# via pytest-icdiff
idna==3.4
Expand All @@ -53,12 +49,6 @@ idna==3.4
# yarl
iniconfig==2.0.0
# via pytest
mako==1.2.4
# via
# -c requirements/../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
# alembic
markupsafe==2.1.2
# via mako
multidict==6.0.4
# via
# aiohttp
Expand All @@ -73,8 +63,6 @@ pluggy==1.0.0
# via pytest
pprintpp==0.4.0
# via pytest-icdiff
psycopg2-binary==2.9.5
# via sqlalchemy
pytest==7.2.1
# via
# -r requirements/_test.in
Expand Down Expand Up @@ -109,10 +97,6 @@ requests==2.28.2
# via coveralls
six==1.16.0
# via python-dateutil
sqlalchemy==1.4.46
# via
# -r requirements/../../../packages/postgres-database/requirements/_base.in
# alembic
termcolor==2.2.0
# via pytest-sugar
tomli==2.0.1
Expand All @@ -121,9 +105,7 @@ tomli==2.0.1
# pytest
urllib3==1.26.14
# via
# -c requirements/../../../packages/postgres-database/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# requests
yarl==1.8.2
# via
# -r requirements/../../../packages/postgres-database/requirements/_base.in
# aiohttp
# via aiohttp
2 changes: 1 addition & 1 deletion packages/postgres-database/requirements/_base.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@


alembic
sqlalchemy[postgresql_psycopg2binary]
sqlalchemy[postgresql_psycopg2binary,asyncio] # SEE extras in https://github.com/sqlalchemy/sqlalchemy/blob/main/setup.cfg#L43
yarl
4 changes: 2 additions & 2 deletions packages/postgres-database/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ markupsafe==2.1.2
# via mako
multidict==6.0.4
# via yarl
psycopg2-binary==2.9.5
psycopg2-binary==2.9.6
# via sqlalchemy
sqlalchemy==1.4.46
sqlalchemy==1.4.47
# via
# -r requirements/_base.in
# alembic
Expand Down
2 changes: 1 addition & 1 deletion packages/postgres-database/requirements/_migration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ requests==2.28.2
# via docker
six==1.16.0
# via websocket-client
sqlalchemy==1.4.46
sqlalchemy==1.4.47
# via
# -c requirements/_base.txt
# alembic
Expand Down
1 change: 1 addition & 0 deletions packages/postgres-database/requirements/_test.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ pytest-docker
pytest-instafail
pytest-runner
pyyaml
sqlalchemy[mypy] # adds Mypy / Pep-484 Support for ORM Mappings SEE https://docs.sqlalchemy.org/en/20/orm/extensions/mypy.html
17 changes: 14 additions & 3 deletions packages/postgres-database/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ multidict==6.0.4
# -c requirements/_base.txt
# aiohttp
# yarl
mypy==1.1.1
# via sqlalchemy
mypy-extensions==1.0.0
# via mypy
packaging==23.0
# via
# -c requirements/_migration.txt
# pytest
pluggy==1.0.0
# via pytest
psycopg2-binary==2.9.5
psycopg2-binary==2.9.6
# via
# -c requirements/_base.txt
# aiopg
Expand Down Expand Up @@ -106,14 +110,21 @@ six==1.16.0
# via
# -c requirements/_migration.txt
# python-dateutil
sqlalchemy==1.4.46
sqlalchemy==1.4.47
# via
# -c requirements/_migration.txt
# -r requirements/_test.in
# aiopg
sqlalchemy2-stubs==0.0.2a32
# via sqlalchemy
tomli==2.0.1
# via
# coverage
# mypy
# pytest
typing-extensions==4.5.0
# via
# mypy
# sqlalchemy2-stubs
urllib3==1.26.14
# via
# -c requirements/_migration.txt
Expand Down
Loading

0 comments on commit c032fb5

Please sign in to comment.