|
1 | 1 | # Local Installation
|
2 | 2 |
|
3 |
| -- Change directory into your newly created project if not already there. Your |
4 |
| - current directory should be the same as this README.txt file and setup.py. |
| 3 | +Install dependencies, e.g. via [brew](https://brew.sh/). |
5 | 4 |
|
6 |
| - cd datameta |
| 5 | +``` |
| 6 | +brew install postgresql memcached libmemcached npm |
| 7 | +``` |
7 | 8 |
|
8 |
| -- Create a Python virtual environment, if not already created. |
| 9 | +Register postgresql as a service |
9 | 10 |
|
10 |
| - python3 -m venv env |
| 11 | +``` |
| 12 | +brew services start postgresql |
| 13 | +``` |
11 | 14 |
|
12 |
| -- Upgrade packaging tools, if necessary. |
13 | 15 |
|
14 |
| - env/bin/pip install --upgrade pip setuptools |
| 16 | +Clone this repository: |
| 17 | +``` |
| 18 | +git clone https://github.com/ghga-de/datameta.git |
| 19 | +``` |
15 | 20 |
|
16 |
| -- Install NPM dependencies |
| 21 | +Change directory into your newly created project if not already there. Your |
| 22 | + current directory should be the same as this README.md file and setup.py. |
17 | 23 |
|
18 |
| - npm install --prefix datameta/static/ |
| 24 | +``` |
| 25 | +cd datameta |
| 26 | +``` |
19 | 27 |
|
20 |
| -- Install the project in editable mode with its testing requirements. |
| 28 | +Create a Python virtual environment, if not already created. |
21 | 29 |
|
22 |
| - env/bin/pip install -e ".[testing]" |
| 30 | +This can be done via `venv`: |
23 | 31 |
|
24 |
| -- Initialize the database using Alembic. |
| 32 | +``` |
| 33 | +python3 -m venv <environment_name> |
| 34 | +``` |
25 | 35 |
|
26 |
| - env/bin/alembic -c development.ini upgrade head |
| 36 | +or `conda`: |
27 | 37 |
|
28 |
| -- Load default data into the database using a script. Change the initial user and group information to your requirements. |
| 38 | +``` |
| 39 | +conda create -y -n <environment_name> 'python>3' |
| 40 | +``` |
29 | 41 |
|
30 |
| - env/bin/initialize_datameta_db \ |
31 |
| - -c development.ini \ |
| 42 | +Activate the environment |
| 43 | + |
| 44 | +With `venv` ([docs](https://docs.python.org/3/tutorial/venv.html)): |
| 45 | + |
| 46 | +``` |
| 47 | +source <path/to/environment>/bin/activate |
| 48 | +``` |
| 49 | + |
| 50 | +With conda |
| 51 | + |
| 52 | +``` |
| 53 | +conda activate <environment_name> |
| 54 | +``` |
| 55 | + |
| 56 | +Upgrade packaging tools, if necessary. |
| 57 | + |
| 58 | +``` |
| 59 | +pip install --upgrade pip setuptools |
| 60 | +``` |
| 61 | + |
| 62 | +Install NPM dependencies |
| 63 | + |
| 64 | +``` |
| 65 | +npm install --prefix datameta/static/ |
| 66 | +``` |
| 67 | + |
| 68 | +Install the project in editable mode with its testing requirements. |
| 69 | + |
| 70 | +``` |
| 71 | +pip install -e ".[testing]" |
| 72 | +``` |
| 73 | + |
| 74 | +Create a postgresql database, then add the path to the database to the `development.ini` found in `datameta/config`, |
| 75 | +e.g. `sqlalchemy.url = postgresql://localhost/<dbname>`. A copy of the `development.ini` can be placed at an arbitrary location |
| 76 | +named `/path/to/config/` in the following. |
| 77 | + |
| 78 | +``` |
| 79 | +createdb <dbname> |
| 80 | +``` |
| 81 | + |
| 82 | +Initialize the database using Alembic. |
| 83 | + |
| 84 | +``` |
| 85 | +<path/to/environment>/bin/alembic -c <path/to/config>/development.ini upgrade head |
| 86 | +``` |
| 87 | + |
| 88 | +Load default data into the database using a script. Change the initial user and group information to your requirements. |
| 89 | + |
| 90 | +``` |
| 91 | +<path/to/environment>/bin/initialize_datameta_db \ |
| 92 | + -c <path/to/config>/development.ini \ |
32 | 93 | --initial-user-fullname "First User Fullname" \
|
33 | 94 | --initial-user-email "[email protected]" \
|
34 | 95 | --initial-user-pass "initialPassword" \
|
35 | 96 | --initial-group "My Organization"
|
| 97 | +``` |
| 98 | + |
| 99 | +Run your project's tests. |
| 100 | + |
| 101 | +``` |
| 102 | +<path/to/environment>/bin/pytest |
| 103 | +``` |
36 | 104 |
|
37 |
| -- Run your project's tests. |
| 105 | +Start the `memcached` process. |
38 | 106 |
|
39 |
| - env/bin/pytest |
| 107 | +``` |
| 108 | +nohup memcached & |
| 109 | +``` |
40 | 110 |
|
41 |
| -- Run your project. |
| 111 | +Run your project. |
42 | 112 |
|
43 |
| - env/bin/pserve development.ini |
| 113 | +``` |
| 114 | +<path/to/environment>/bin/pserve /path/to/config/development.ini |
| 115 | +``` |
44 | 116 |
|
0 commit comments