module-qc-database-tools 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ INSTITUTION="LBNL_PIXEL_MODULES"
2
+ ITKDB_ACCESS_CODE1="accesscode1"
3
+ ITKDB_ACCESS_CODE2="accesscode2"
@@ -0,0 +1,150 @@
1
+ # Our stuff
2
+ .DS_Store
3
+ output/
4
+ *~
5
+ *.swp
6
+ plots/
7
+ module-qc-tools/
8
+ outputs/
9
+
10
+ # Byte-compiled / optimized / DLL files
11
+ __pycache__/
12
+ *.py[cod]
13
+ *$py.class
14
+
15
+ # C extensions
16
+ *.so
17
+
18
+ # Distribution / packaging
19
+ .Python
20
+ build/
21
+ develop-eggs/
22
+ dist/
23
+ downloads/
24
+ eggs/
25
+ .eggs/
26
+ lib/
27
+ lib64/
28
+ parts/
29
+ sdist/
30
+ var/
31
+ wheels/
32
+ share/python-wheels/
33
+ *.egg-info/
34
+ .installed.cfg
35
+ *.egg
36
+ MANIFEST
37
+
38
+ # PyInstaller
39
+ # Usually these files are written by a python script from a template
40
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
41
+ *.manifest
42
+ *.spec
43
+
44
+ # Installer logs
45
+ pip-log.txt
46
+ pip-delete-this-directory.txt
47
+
48
+ # Unit test / coverage reports
49
+ htmlcov/
50
+ .tox/
51
+ .nox/
52
+ .coverage
53
+ .coverage.*
54
+ .cache
55
+ nosetests.xml
56
+ coverage.xml
57
+ *.cover
58
+ *.py,cover
59
+ .hypothesis/
60
+ .pytest_cache/
61
+ cover/
62
+
63
+ # Translations
64
+ *.mo
65
+ *.pot
66
+
67
+ # Django stuff:
68
+ *.log
69
+ local_settings.py
70
+ db.sqlite3
71
+ db.sqlite3-journal
72
+
73
+ # Flask stuff:
74
+ instance/
75
+ .webassets-cache
76
+
77
+ # Scrapy stuff:
78
+ .scrapy
79
+
80
+ # Sphinx documentation
81
+ docs/_build/
82
+
83
+ # PyBuilder
84
+ .pybuilder/
85
+ target/
86
+
87
+ # Jupyter Notebook
88
+ .ipynb_checkpoints
89
+
90
+ # IPython
91
+ profile_default/
92
+ ipython_config.py
93
+
94
+ # pyenv
95
+ # For a library or package, you might want to ignore these files since the code is
96
+ # intended to run in multiple environments; otherwise, check them in:
97
+ # .python-version
98
+
99
+ # pipenv
100
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
101
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
102
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
103
+ # install all needed dependencies.
104
+ #Pipfile.lock
105
+
106
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
107
+ __pypackages__/
108
+
109
+ # Celery stuff
110
+ celerybeat-schedule
111
+ celerybeat.pid
112
+
113
+ # SageMath parsed files
114
+ *.sage.py
115
+
116
+ # Environments
117
+ .env
118
+ .venv
119
+ env/
120
+ venv/
121
+ ENV/
122
+ env.bak/
123
+ venv.bak/
124
+
125
+ # Spyder project settings
126
+ .spyderproject
127
+ .spyproject
128
+
129
+ # Rope project settings
130
+ .ropeproject
131
+
132
+ # mkdocs documentation
133
+ /site
134
+
135
+ # mypy
136
+ .mypy_cache/
137
+ .dmypy.json
138
+ dmypy.json
139
+
140
+ # Pyre type checker
141
+ .pyre/
142
+
143
+ # pytype static type analyzer
144
+ .pytype/
145
+
146
+ # Cython debug symbols
147
+ cython_debug/
148
+
149
+ # setuptools_scm / hatch-vcs
150
+ src/*/_version.py
@@ -0,0 +1,136 @@
1
+ stages:
2
+ - autoupdate
3
+ - check
4
+ - test
5
+ - build
6
+ - deploy
7
+
8
+ variables:
9
+ # see https://docs.gitlab.com/ee/ci/caching/#cache-python-dependencies
10
+ PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
11
+
12
+ cache:
13
+ paths:
14
+ - .cache/pip
15
+ - venv/
16
+
17
+ image: python:3.7-buster
18
+ before_script:
19
+ # want to set up a virtualenv to cache
20
+ - apt-get install -y --no-install-recommends git
21
+ - python -V
22
+ - git config --global credential.helper 'cache'
23
+ - |
24
+ echo "protocol=https
25
+ host=gitlab.cern.ch
26
+ username=gitlab-ci-token
27
+ password=${CI_JOB_TOKEN}
28
+ " | git credential approve
29
+ - python -m venv venv
30
+ - source venv/bin/activate
31
+ - python -m pip install -U pip pipx
32
+ - python -m pipx ensurepath
33
+ - python -m pip freeze --local
34
+
35
+ pre-commit:
36
+ stage: check
37
+ variables:
38
+ PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
39
+ rules:
40
+ - if: $CI_PIPELINE_SOURCE == "push"
41
+ script:
42
+ - python -m pip install pre-commit
43
+ - python -m pip freeze --local
44
+ - pre-commit run --hook-stage manual --all-files
45
+ cache:
46
+ key:
47
+ files:
48
+ - .pre-commit-config.yaml
49
+ paths:
50
+ - .cache/pre-commit
51
+
52
+ pre-commit-autoupdate:
53
+ stage: autoupdate
54
+ rules:
55
+ - if: $CI_PIPELINE_SOURCE == "schedule"
56
+ when: always
57
+ - if:
58
+ $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
59
+ when: manual
60
+ # manual jobs need allow_failure? https://gitlab.com/gitlab-org/gitlab/-/issues/233876
61
+ allow_failure: true
62
+ script:
63
+ - python -m pip install pre-commit
64
+ - python -m pip freeze --local
65
+ - ci/pre-commit-update.sh
66
+
67
+ cache:
68
+ key:
69
+ files:
70
+ - .pre-commit-config.yaml
71
+ paths:
72
+ - .cache/pre-commit
73
+
74
+ lint:
75
+ stage: check
76
+ rules:
77
+ - if: $CI_PIPELINE_SOURCE == "push"
78
+ script:
79
+ - pipx run hatch run lint
80
+
81
+ tests:
82
+ stage: test
83
+ image: $IMAGE
84
+ rules:
85
+ - if: $CI_PIPELINE_SOURCE == "push"
86
+ script:
87
+ - pipx run hatch run +py=${PYTHON_VERSION} dev:test
88
+ parallel:
89
+ matrix:
90
+ - IMAGE: "python:3.7-buster"
91
+ PYTHON_VERSION: "3.7"
92
+ - IMAGE: "python:3.8-buster"
93
+ PYTHON_VERSION: "3.8"
94
+ - IMAGE: "python:3.9-buster"
95
+ PYTHON_VERSION: "3.9"
96
+ - IMAGE: "python:3.10-buster"
97
+ PYTHON_VERSION: "3.10"
98
+ - IMAGE: "python:3.11-buster"
99
+ PYTHON_VERSION: "3.11"
100
+
101
+ package:
102
+ stage: build
103
+ rules:
104
+ - if: $CI_PIPELINE_SOURCE == "push"
105
+ script:
106
+ - pipx run hatch run build-check
107
+ artifacts:
108
+ paths:
109
+ - dist/
110
+ expire_in: 1 day
111
+
112
+ .deploy_package:
113
+ stage: deploy
114
+ dependencies:
115
+ - package
116
+ script:
117
+ - pipx run twine upload --verbose dist/*whl dist/*gz
118
+
119
+ deploy_package_gitlab:
120
+ extends: .deploy_package
121
+ rules:
122
+ - if:
123
+ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"
124
+ variables:
125
+ TWINE_REPOSITORY_URL: "https://gitlab.cern.ch/api/v4/projects/${CI_PROJECT_ID}/packages/pypi"
126
+ TWINE_USERNAME: "gitlab-ci-token"
127
+ TWINE_PASSWORD: "${CI_JOB_TOKEN}"
128
+
129
+ deploy_package_pypi:
130
+ extends: .deploy_package
131
+ only:
132
+ - tags
133
+ variables:
134
+ TWINE_REPOSITORY: pypi
135
+ TWINE_USERNAME: __token__
136
+ TWINE_PASSWORD: $PYPI_TOKEN
@@ -0,0 +1,90 @@
1
+ ci:
2
+ autoupdate_commit_msg: "chore: update pre-commit hooks"
3
+ autofix_commit_msg: "style: pre-commit fixes"
4
+
5
+ exclude: |
6
+ (?x)^(
7
+ add_attachment.py|
8
+ add_comment.py|
9
+ generatePlots.py|
10
+ getContentSummary.py|
11
+ getInventory.py|
12
+ registerComponent.py|
13
+ tests/integration/cassettes/.*.json
14
+ )$
15
+
16
+ repos:
17
+ - repo: https://github.com/psf/black
18
+ rev: "23.3.0"
19
+ hooks:
20
+ - id: black-jupyter
21
+
22
+ - repo: https://github.com/pre-commit/pre-commit-hooks
23
+ rev: "v4.4.0"
24
+ hooks:
25
+ - id: check-added-large-files
26
+ - id: check-case-conflict
27
+ - id: check-merge-conflict
28
+ - id: check-symlinks
29
+ - id: check-yaml
30
+ exclude: mkdocs.yml
31
+ - id: check-yaml
32
+ name: check-yaml (unsafe)
33
+ files: mkdocs.yml
34
+ args: ["--unsafe"]
35
+ - id: debug-statements
36
+ - id: end-of-file-fixer
37
+ - id: mixed-line-ending
38
+ - id: name-tests-test
39
+ args: ["--pytest-test-first"]
40
+ - id: requirements-txt-fixer
41
+ - id: trailing-whitespace
42
+
43
+ - repo: https://github.com/pre-commit/pygrep-hooks
44
+ rev: "v1.10.0"
45
+ hooks:
46
+ - id: rst-backticks
47
+ - id: rst-directive-colons
48
+ - id: rst-inline-touching-normal
49
+
50
+ - repo: https://github.com/pre-commit/mirrors-prettier
51
+ rev: "v3.0.0-alpha.6"
52
+ hooks:
53
+ - id: prettier
54
+ types_or: [yaml, markdown, html, css, scss, javascript, json]
55
+ args: [--prose-wrap=always]
56
+
57
+ - repo: https://github.com/asottile/blacken-docs
58
+ rev: "1.13.0"
59
+ hooks:
60
+ - id: blacken-docs
61
+ additional_dependencies: [black==22.8.0]
62
+
63
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
64
+ rev: v0.0.261
65
+ hooks:
66
+ - id: ruff
67
+ args: ["--fix", "--show-fixes"]
68
+
69
+ - repo: https://github.com/codespell-project/codespell
70
+ rev: v2.2.4
71
+ hooks:
72
+ - id: codespell
73
+ exclude: |
74
+ (?x)^(
75
+ .*\.json |
76
+ .*\.pem
77
+ )$
78
+
79
+ - repo: https://github.com/shellcheck-py/shellcheck-py
80
+ rev: "v0.9.0.2"
81
+ hooks:
82
+ - id: shellcheck
83
+
84
+ - repo: local
85
+ hooks:
86
+ - id: disallow-caps
87
+ name: Disallow improper capitalization
88
+ language: pygrep
89
+ entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
90
+ exclude: .pre-commit-config.yaml
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.1
2
+ Name: module-qc-database-tools
3
+ Version: 0.0.1
4
+ Summary: Python wrapper to interface with LocalDB and Production DB for common tasks for pixel modules.
5
+ Project-URL: Homepage, https://gitlab.cern.ch/atlas-itk/pixel/module/module-qc-database-tools
6
+ Project-URL: Bug Tracker, https://gitlab.cern.ch/atlas-itk/pixel/module/module-qc-database-tools/issues
7
+ Project-URL: Source, https://gitlab.cern.ch/atlas-itk/pixel/module/module-qc-database-tools
8
+ Author-email: Jay Chan <jay.chan@cern.ch>
9
+ Maintainer-email: Giordon Stark <kratsg@gmail.com>, Elisabetta Pianori <elisabetta.pianori@cern.ch>, Lingxin Meng <lingxin.meng@cern.ch>
10
+ Classifier: Development Status :: 1 - Planning
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Topic :: Scientific/Engineering
25
+ Requires-Python: >=3.7
26
+ Requires-Dist: importlib-resources>=1.4.0; python_version < '3.9'
27
+ Requires-Dist: itkdb>=0.4.0
28
+ Requires-Dist: pandas
29
+ Requires-Dist: typer
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Module QC Database Tools v0.0.1
33
+
34
+ The package to regisiter ITkPixV1.1 modules, and generate YARR configs from ITk
35
+ production database using `itkdb` API.
36
+
37
+ ## Set-Up and First-time Installation
38
+
39
+ A minimum of python version 3.7+ is required.
40
+
41
+ ### Virtual Python Environment
42
+
43
+ Creating the python virtual environment the standard way used the python version
44
+ available on the operating system. For CentOS 7 this is version 3.6. If using
45
+ CentOS 7, you can install python 3.8 following these
46
+ [instructions](https://tecadmin.net/install-python-3-8-centos/).
47
+
48
+ After installing python 3.8, create the virtual environment:
49
+
50
+ ```
51
+ $ python3 -m venv venv
52
+ $ source venv/bin/activate
53
+ ```
54
+
55
+ For future use:
56
+
57
+ ```
58
+ $ source venv/bin/activate
59
+ ```
60
+
61
+ Alternatively, [anaconda](https://docs.anaconda.com/anaconda/install/index.html)
62
+ or [miniconda](https://docs.conda.io/en/latest/miniconda.html) can also be
63
+ installed.
64
+
65
+ For future use:
66
+
67
+ ```
68
+ $ conda activate
69
+ ```
70
+
71
+ ### Install
72
+
73
+ ```
74
+ $ python -m pip install module-qc-database-tools
75
+ ```
76
+
77
+ ### Environment Variables
78
+
79
+ If not already set elsewhere (e.g. `~/.bashrc`), copy `.env.template` to `.env`
80
+ and update the values of the shell variables. Essentially, the following
81
+ variables regarding the production database should be available, shown below as
82
+ an example of environmental variables in `~/.bashrc`:
83
+
84
+ ```bash
85
+ export INSTITUTION="LBNL_PIXEL_MODULES"
86
+ export ITKDB_ACCESS_CODE1="accesscode1"
87
+ export ITKDB_ACCESS_CODE2="accesscode2"
88
+ ```
89
+
90
+ ## Module registration
91
+
92
+ Under construction...
93
+
94
+ ## Generate YARR configuration
95
+
96
+ This script has been tested on python 3.7+.
97
+
98
+ To generate YARR configuration for a given module, run `generateYARRConfig` or
99
+ `mqdbt generate-yarr-config`:
100
+
101
+ ```
102
+ $ generateYARRConfig -sn [ATLAS SN] -o [outdir]
103
+ $ mqdbt generate-yarr-config -sn [ATLAS SN] -o [outdir]
104
+
105
+ Parameters:
106
+ -sn, --sn, required=True: ATLAS serial number of the module
107
+ -ch, --chipTemplate, default="configs/YARR/chip_template.json": provide the path of a chip config template to generate the new chip configs from
108
+ -o, --outdir, required=True: Path to output directory config folder will be placed in
109
+ ```
110
+
111
+ For example, to generate the YARR configs for the module `20UPGR91301046` with
112
+ all power configs:
113
+
114
+ ```
115
+ $ generateYARRConfig -sn 20UPGR91301046 -o ~/module_data/.
116
+ $ mqdbt generate-yarr-config -sn 20UPGR91301046 -o ~/module_data/.
117
+ ```
118
+
119
+ The time needed to generate warm and cold L2 configs for a quad module is about
120
+ 4 seconds.
@@ -0,0 +1,89 @@
1
+ # Module QC Database Tools v0.0.1
2
+
3
+ The package to regisiter ITkPixV1.1 modules, and generate YARR configs from ITk
4
+ production database using `itkdb` API.
5
+
6
+ ## Set-Up and First-time Installation
7
+
8
+ A minimum of python version 3.7+ is required.
9
+
10
+ ### Virtual Python Environment
11
+
12
+ Creating the python virtual environment the standard way used the python version
13
+ available on the operating system. For CentOS 7 this is version 3.6. If using
14
+ CentOS 7, you can install python 3.8 following these
15
+ [instructions](https://tecadmin.net/install-python-3-8-centos/).
16
+
17
+ After installing python 3.8, create the virtual environment:
18
+
19
+ ```
20
+ $ python3 -m venv venv
21
+ $ source venv/bin/activate
22
+ ```
23
+
24
+ For future use:
25
+
26
+ ```
27
+ $ source venv/bin/activate
28
+ ```
29
+
30
+ Alternatively, [anaconda](https://docs.anaconda.com/anaconda/install/index.html)
31
+ or [miniconda](https://docs.conda.io/en/latest/miniconda.html) can also be
32
+ installed.
33
+
34
+ For future use:
35
+
36
+ ```
37
+ $ conda activate
38
+ ```
39
+
40
+ ### Install
41
+
42
+ ```
43
+ $ python -m pip install module-qc-database-tools
44
+ ```
45
+
46
+ ### Environment Variables
47
+
48
+ If not already set elsewhere (e.g. `~/.bashrc`), copy `.env.template` to `.env`
49
+ and update the values of the shell variables. Essentially, the following
50
+ variables regarding the production database should be available, shown below as
51
+ an example of environmental variables in `~/.bashrc`:
52
+
53
+ ```bash
54
+ export INSTITUTION="LBNL_PIXEL_MODULES"
55
+ export ITKDB_ACCESS_CODE1="accesscode1"
56
+ export ITKDB_ACCESS_CODE2="accesscode2"
57
+ ```
58
+
59
+ ## Module registration
60
+
61
+ Under construction...
62
+
63
+ ## Generate YARR configuration
64
+
65
+ This script has been tested on python 3.7+.
66
+
67
+ To generate YARR configuration for a given module, run `generateYARRConfig` or
68
+ `mqdbt generate-yarr-config`:
69
+
70
+ ```
71
+ $ generateYARRConfig -sn [ATLAS SN] -o [outdir]
72
+ $ mqdbt generate-yarr-config -sn [ATLAS SN] -o [outdir]
73
+
74
+ Parameters:
75
+ -sn, --sn, required=True: ATLAS serial number of the module
76
+ -ch, --chipTemplate, default="configs/YARR/chip_template.json": provide the path of a chip config template to generate the new chip configs from
77
+ -o, --outdir, required=True: Path to output directory config folder will be placed in
78
+ ```
79
+
80
+ For example, to generate the YARR configs for the module `20UPGR91301046` with
81
+ all power configs:
82
+
83
+ ```
84
+ $ generateYARRConfig -sn 20UPGR91301046 -o ~/module_data/.
85
+ $ mqdbt generate-yarr-config -sn 20UPGR91301046 -o ~/module_data/.
86
+ ```
87
+
88
+ The time needed to generate warm and cold L2 configs for a quad module is about
89
+ 4 seconds.