Skip to content

Commit d841679

Browse files
committed
Update README with uv instruction
1 parent 556a105 commit d841679

1 file changed

Lines changed: 63 additions & 57 deletions

File tree

README.md

Lines changed: 63 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -127,37 +127,85 @@ ToDo: information on how a validatio schema is constructed
127127

128128
## Local development
129129

130-
Setup a development environment using virtual environment and install the dependencies. For Visual Studio Code a default
131-
settings.json can be found under ```.vscode/settings.json.default``` paste these settings into a new
132-
file ```.vscode/settings.json```. Make sure the ```python.pythonPath``` is pointing to python in your virtual env. The
133-
default settings file excludes some unwanted files and folders, styling and discovery and settings for unit tests.
130+
We use [uv](https://docs.astral.sh/uv/) as a project and package manager. To develop locally. First make sure uv is installed.
134131

135-
### Virtual environment
132+
Install uv
133+
134+
```bash
135+
# On Linux.
136+
curl -LsSf https://astral.sh/uv/install.sh | sh
137+
```
138+
139+
```powershell
140+
# On Windows.
141+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
142+
```
143+
144+
Create a virtual environment if it is not set up yet. Run the command at the project root. This should create a virtual environment `.venv`
145+
146+
```
147+
uv venv
148+
```
149+
150+
To activate the virtual environment.
151+
152+
```bash
153+
# On Linux.
154+
source .venv/Scripts/activate
155+
```
156+
157+
```powershell
158+
# On Windows.
159+
.venv\Scripts\activate
160+
```
136161

137-
Install virtual environment if not installed yet
162+
163+
Project dependencies are specified in `pyproject.toml` and `uv.lock` files. To install dependencies, run the command below.
138164

139165
```
140-
python3 -m pip install --user virtualenv
166+
uv sync
141167
```
142168

143-
Create a virtual environment
169+
To check the installed dependencies.
144170

145171
```
146-
python3 -m venv env
172+
uv pip list
147173
```
148174

149-
Enable virtual environment with one of the following commands
175+
To add or remove a dependency, run the command below. This will update `pyproject.toml` and `uv.lock` automatically.
150176

151177
```
152-
source env/bin/activate (Linux)
153-
env\Scripts\activate.ps1 (Windows Powershell)
154-
env\Scripts\activate.bat (Windows CMD)
178+
uv add {dependency to be installed}
179+
uv remove {dependency to be removed}
155180
```
156181

157-
### Install project dependencies
182+
#### Update pyESDL version
183+
184+
To work with the latest version of ESDL, make sure `pyESDL>={version}` in `pyproject.toml` is updated and run `uv sync` again.
185+
186+
### Run ESDL-validator in develop/debug mode
187+
188+
To run the service in debug mode.
158189

159190
```
160-
pip3 install -r requirements.txt
191+
uv run app.py
192+
```
193+
194+
195+
### Testing
196+
197+
To run test.
198+
199+
```
200+
pytest
201+
```
202+
203+
### Black format
204+
205+
The black format settings can be found under `[tool.black]` in the `pyproject.toml` file. To run black to format code.
206+
207+
```
208+
black .
161209
```
162210

163211
### Set up Git hooks
@@ -199,48 +247,6 @@ esdlvalidator/validation/functions/projects/nwn/test.py
199247
➡️ These files must not be pushed to GitHub. Push to GitLab is allowed.
200248
```
201249

202-
### Testing
203-
204-
Use the 'Test' tab is vscode or execute one of the following commands from the root folder
205-
206-
```
207-
pytest
208-
python3 -m unittest discover ./
209-
```
210-
211-
### Run ESDL-validator in develop/debug mode
212-
213-
To run the service in debug mode using the build in flask development server.
214-
215-
```
216-
python3 app.py
217-
```
218-
219-
### Run ESDL-validator using waitress
220-
221-
An example how to start the service using waitress.
222-
223-
```
224-
waitress-serve --listen="*:8080" --call "esdlvalidator.api.manage:create_app"
225-
```
226-
227-
### Update pyESDL version
228-
229-
To work with the latest version of ESDL, make sure `pyESDL>={version}` in `requirements.txt` is updated and run pip install again.
230-
231-
```
232-
pip3 install -r requirements.txt
233-
```
234-
235-
<!-- ### DEPRECATED: Update static ESDL metamodel code
236-
237-
To update the ESDL code to work with the latest version of the ESDL ecore model, update esdl.ecore to the latest version
238-
and run
239-
240-
```
241-
pip3 install pyecoregen
242-
pyecoregen -e esdl.ecore -o ./esdlvalidator/core/esdl
243-
``` -->
244250

245251
## Docker
246252

0 commit comments

Comments
 (0)