From 2c2aecbb00419cfcf00d59215c7fe8e8c0e248d2 Mon Sep 17 00:00:00 2001
From: Yoann Schneider <yschneider@teklia.com>
Date: Mon, 6 May 2024 10:36:53 +0200
Subject: [PATCH] Pull teklia-nerval from pypi

---
 .gitlab-ci.yml                  | 30 +-----------------------------
 Dockerfile                      |  2 +-
 ci/build.sh                     |  2 +-
 docs/get_started/development.md |  4 +---
 docs/get_started/index.md       | 16 ++++++----------
 docs/usage/train/config.md      |  4 +---
 tox.ini                         |  3 ---
 7 files changed, 11 insertions(+), 50 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c7381ce4..904ad7bf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,14 +42,6 @@ test:
     - apt-get update -q
     - apt-get install -q -y libgl1
 
-    # Add netrc file
-    - |
-      echo "
-      machine gitlab.teklia.com
-      login gitlab-ci-token
-      password $CI_JOB_TOKEN
-      " > ~/.netrc
-
   except:
     - schedules
 
@@ -68,15 +60,6 @@ docker-build:
   except:
     - schedules
 
-  before_script:
-    # Add netrc file
-    - |
-      echo "
-      machine gitlab.teklia.com
-      login gitlab-ci-token
-      password $CI_JOB_TOKEN
-      " > ~/.netrc
-
   script:
     - ci/build.sh
 
@@ -88,15 +71,7 @@ docker-build:
       - public
 
   before_script:
-    # Add netrc file
-    - |
-      echo "
-      machine gitlab.teklia.com
-      login gitlab-ci-token
-      password $CI_JOB_TOKEN
-      " > ~/.netrc
-
-    - pip install --index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple -e .[docs]
+    - pip install -e .[docs]
 
   script:
     - mkdocs build --strict --verbose
@@ -193,9 +168,6 @@ bump-python-deps:
   stage: deploy
   image: registry.gitlab.teklia.com/infra/devops:latest
 
-  variables:
-    PYPI_GITLAB_URL: https://gitlab.teklia.com/api/v4/projects/210/packages
-
   only:
     - schedules
 
diff --git a/Dockerfile b/Dockerfile
index 4a42644d..6f5c337f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,4 +13,4 @@ COPY requirements.txt *-requirements.txt setup.py VERSION README.md ./
 
 # Install DAN as a package with GitLab package registry
 RUN --mount=type=secret,id=netrc,target=/root/.netrc \
-    pip install . --no-cache-dir --index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple
+    pip install . --no-cache-dir
diff --git a/ci/build.sh b/ci/build.sh
index 65956bf7..f29f50f2 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -17,7 +17,7 @@ fi
 IMAGE_TAG="$CI_REGISTRY_IMAGE:$VERSION"
 
 cd $CI_PROJECT_DIR
-docker build -f Dockerfile . -t "$IMAGE_TAG" --secret id=netrc,src=$HOME/.netrc
+docker build -f Dockerfile . -t "$IMAGE_TAG"
 
 # Publish the image on the main branch or on a tag
 if [ "$CI_COMMIT_REF_NAME" = "main" -o -n "$CI_COMMIT_TAG" ]; then
diff --git a/docs/get_started/development.md b/docs/get_started/development.md
index d94ca211..f5098dc6 100644
--- a/docs/get_started/development.md
+++ b/docs/get_started/development.md
@@ -81,11 +81,9 @@ Add the `docs` extra when installing `teklia-dan`:
 
 ```shell
 # In a clone of the Git repository
-pip install --index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple .[docs]
+pip install .[docs]
 ```
 
-The `--index-url` argument is required to find the `nerval` package.
-
 Build the documentation using `mkdocs serve -v`. You can then write in [Markdown](https://www.markdownguide.org/) in the relevant `docs/*.md` files, and see live output on http://localhost:8000.
 
 ### Linter
diff --git a/docs/get_started/index.md b/docs/get_started/index.md
index 066ae84b..c46de2db 100644
--- a/docs/get_started/index.md
+++ b/docs/get_started/index.md
@@ -2,7 +2,7 @@
 
 ## Installation
 
-DAN is based on a GitLab package registry containing all the nerval source code.
+DAN is published on a GitLab package registry.
 You need [a personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with [scope](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#personal-access-token-scopes) `read_api` in order to install this module. You will need to add the below to your `~/.netrc` file:
 
 ```shell
@@ -11,18 +11,16 @@ login __token__
 password <YOUR_PERSONAL_TOKEN>
 ```
 
-If you install DAN as a dependency, the host must have access to this configuration file to be able to download the [nerval repository](https://gitlab.teklia.com/ner/nerval) package.
-
 ### As a dependency
 
 To install DAN as a dependency, you need to first add the following line to your `requirements.txt` file:
 
 ```shell
---index-url https://gitlab.teklia.com/api/v4/projects/98/packages/pypi/simple --extra-index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple
+--index-url https://gitlab.teklia.com/api/v4/projects/98/packages/pypi/simple
 teklia-dan
 ```
 
-The `--index-url` argument is required to find the `DAN` package, the `--extra-index-url` argument is needed to find the `nerval` dependency.
+The `--index-url` argument is required to find the `DAN` package.
 
 Then you can install it via pip:
 
@@ -35,10 +33,10 @@ pip install -r requirements.txt
 To install DAN directly, you can install it via pip:
 
 ```shell
-pip install --index-url https://gitlab.teklia.com/api/v4/projects/98/packages/pypi/simple --extra-index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple teklia-dan
+pip install --index-url https://gitlab.teklia.com/api/v4/projects/98/packages/pypi/simple teklia-dan
 ```
 
-The `--index-url` argument is required to find the `DAN` package, the `--extra-index-url` argument is needed to find the `nerval` dependency.
+The `--index-url` argument is required to find the `DAN` package.
 
 ---
 
@@ -55,11 +53,9 @@ For development and tests purpose it may be useful to install the project as a e
 To install DAN as an editable package, you can install it via pip:
 
 ```shell
-pip install --index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple -e .
+pip install -e .
 ```
 
-The `--index-url` argument is required to find the `nerval` dependency.
-
 Get started with:
 
 - [Developments](development.md)
diff --git a/docs/usage/train/config.md b/docs/usage/train/config.md
index 43da046d..ea822e2c 100644
--- a/docs/usage/train/config.md
+++ b/docs/usage/train/config.md
@@ -254,11 +254,9 @@ To log your experiment on MLFlow, you need to:
 - install the extra requirements via
 
 ```shell
-$ pip install --index-url https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple .[mlflow]
+$ pip install .[mlflow]
 ```
 
-The `--index-url` argument is required to find the `nerval` package.
-
 - update the following arguments:
 
 | Name                           | Description                             | Type  | Default |
diff --git a/tox.ini b/tox.ini
index 3067b294..ffb845de 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,8 +14,5 @@ deps =
 commands =
     pytest {tty:--color=yes} {posargs}
 
-setenv =
-  PIP_INDEX_URL=https://gitlab.teklia.com/api/v4/projects/210/packages/pypi/simple
-
 [pytest]
 testpaths= tests
-- 
GitLab