feat: move package registry to nexus

This commit is contained in:
Jonathan Kössler 2024-11-18 13:49:48 +01:00
parent cf91189728
commit 527a671a75
5 changed files with 1645 additions and 401 deletions

View File

@ -5,7 +5,7 @@ default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@ -39,7 +39,7 @@ repos:
- --profile black
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
# exclude: ^(docs/|notebooks/|data/|src/secrets/)
@ -47,7 +47,7 @@ repos:
- --line-length=120
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
rev: v3.6.0
hooks:
- id: conventional-pre-commit
pass_filenames: false

View File

@ -73,6 +73,17 @@ the [complete example](pyinfra/examples.py).
| TRACING\_\_OPENTELEMETRY\_\_EXPORTER | tracing.opentelemetry.exporter | Name of exporter |
| KUBERNETES\_\_POD_NAME | kubernetes.pod_name | Service pod name |
## Setup
**IMPORTANT** you need to set the following environment variables before running the setup script:
- ``$NEXUS_USER`` your Nexus user (usually equal to firstname.lastname@knecon.com)
- ``$NEXUS_PASSWORD`` your Nexus password (usually equal to your Azure Login)
```shell
# create venv and activate it
source ./scripts/setup/devenvsetup.sh {{ cookiecutter.python_version }} $NEXUS_USER $NEXUS_PASSWORD
source .venv/bin/activate
```
### OpenTelemetry
Open telemetry (vis its Python SDK) is set up to be as unobtrusive as possible; for typical use cases it can be

1975
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyinfra"
version = "3.3.5"
version = "3.4.0"
description = ""
authors = ["Team Research <research@knecon.com>"]
license = "All rights reseverd"
@ -18,10 +18,12 @@ azure-storage-blob = "^12.13"
# misc utils
funcy = "^2"
pycryptodome = "^3.19"
# research shared packages
kn-utils = { version = "^0.3.2", source = "gitlab-research" }
fastapi = "^0.109.0"
uvicorn = "^0.26.0"
[tool.poetry.group.internal.dependencies]
kn-utils = { version = "0.4.0", source = "nexus" }
# [tool.poetry.group.telemetry.dependencies]
opentelemetry-instrumentation-pika = "^0.46b0"
opentelemetry-exporter-otlp = "^1.25.0"
@ -87,12 +89,13 @@ disable = [
docstring-min-length = 3
[[tool.poetry.source]]
name = "PyPI"
name = "pypi-proxy"
url = "https://nexus.knecon.com/repository/pypi-proxy/simple"
priority = "primary"
[[tool.poetry.source]]
name = "gitlab-research"
url = "https://gitlab.knecon.com/api/v4/groups/19/-/packages/pypi/simple"
name = "nexus"
url = "https://nexus.knecon.com/repository/python/simple"
priority = "explicit"
[build-system]

View File

@ -0,0 +1,39 @@
#!/bin/bash
python_version=$1
nexus_user=$2
nexus_password=$3
# cookiecutter https://gitlab.knecon.com/knecon/research/template-python-project.git --checkout master
# latest_dir=$(ls -td -- */ | head -n 1) # should be the dir cookiecutter just created
# cd $latest_dir
pyenv install $python_version
pyenv local $python_version
pyenv shell $python_version
# install poetry globally (PREFERRED), only need to install it once
# curl -sSL https://install.python-poetry.org | python3 -
# remember to update poetry once in a while
poetry self update
# install poetry in current python environment, can lead to multiple instances of poetry being installed on one system (DISPREFERRED)
# pip install --upgrade pip
# pip install poetry
poetry config virtualenvs.in-project true
poetry config installer.max-workers 10
poetry config repositories.pypi-proxy "https://nexus.knecon.com/repository/pypi-proxy/simple"
poetry config http-basic.pypi-proxy ${nexus_user} ${nexus_password}
poetry config repositories.nexus https://nexus.knecon.com/repository/python/simple
poetry config http-basic.nexus ${nexus_user} ${nexus_password}
poetry env use $(pyenv which python)
poetry install --with=dev
poetry update
source .venv/bin/activate
pre-commit install
pre-commit autoupdate