Skip to content

Commit 62d4c56

Browse files
committed
Update developer documentation and pyproject.toml to use uv for Python dependency
1 parent 898bcd2 commit 62d4c56

File tree

3 files changed

+69
-456
lines changed

3 files changed

+69
-456
lines changed

docs/docs/devs/getstarted.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ section below).
3434

3535
### Initial Development Dependencies
3636

37-
- Run `python3 -m venv venv` to create a Python Virtual Environment and add it to PyCharm by navigating to
38-
`PyCharm -> Settings... -> Project: clowder2 -> Python Interpreter -> Add Interpreter`.
39-
- Run `source venv/bin/activate && pip install --upgrade pip` to activate the created Python Virtual Environment and
40-
upgrade
41-
pip.
42-
- Run `pip install pipenv` to install [Pipenv](https://pipenv.pypa.io/en/latest/).
37+
- Install [uv](https://docs.astral.sh/uv/getting-started/installation/) for Python package management
38+
- Create a virtual environment using `uv venv` and activate it using `source .venv/bin/activate`
39+
- Run `uv sync --dev` to install all dependencies and create a virtual environment
40+
- Add the virtual environment to PyCharm by navigating to
41+
`PyCharm -> Settings... -> Project: clowder2 -> Python Interpreter -> Add Interpreter` and selecting type `uv` and then selecting the virtual environment.
42+
43+
For detailed PyCharm configuration instructions, see the [official PyCharm uv documentation](https://www.jetbrains.com/help/pycharm/uv.html).
4344

4445
### Required Services
4546

@@ -61,39 +62,38 @@ After starting up the required services, setup and run the backend module.
6162

6263
The backend module is developed using [Python](https://www.python.org/), [FastAPI](https://fastapi.tiangolo.com/),
6364
and [Motor](https://motor.readthedocs.io/en/stable/).
64-
We recommend using [Python 3.9](https://www.python.org/downloads/)
65-
and Pipenv for dependency management.
65+
We recommend using [Python 3.9+](https://www.python.org/downloads/)
66+
and uv for dependency management.
6667

6768
#### Install Backend Dependencies
6869

69-
1. Switch to backend module directory `cd backend`.
70-
2. Install dependencies using `pipenv install --dev`.
70+
1. Install dependencies using `uv sync --dev` from the project root directory.
7171

7272
#### Run Backend Module
7373

7474
You can run the backend module using either of the below options:
7575

7676
- Using the PyCharm's run configuration by navigating to `PyCharm -> Run -> Run...` and clicking `uvicorn`. Running
7777
directly from PyCharm helps the developer by providing easy access to its debugging features.
78-
- From the command line by running `pipenv run uvicorn app.main:app --host 0.0.0.0 --reload`.
78+
- From the command line by running `uv run uvicorn app.main:app --host 0.0.0.0 --reload`.
7979
- To run the backend module with multiple workers, similar to production, run
80-
`pipenv run uvicorn app.main:app --host 0.0.0.0 --workers 17`
80+
`uv run uvicorn app.main:app --host 0.0.0.0 --workers 17`
8181

8282
Additional steps/details:
8383

8484
1. API docs are available at `http://localhost:8000/docs`. The API base URL is `http://localhost:8000/api/v2`.
8585
2. Create a user using `POST /api/v2/users` and getting a JWT token by using `POST /api/v2/login`. Place the token in
8686
header of requests that require authentications using the `Authorization: Bearer <your token>` HTTP header.
8787
* You can also run the frontend module below and use the Login link available there.
88-
3. Manually run tests before pushing with `pipenv run pytest -v` or right-clicking on `test` folder and clicking `Run`
88+
3. Manually run tests before pushing with `uv run pytest -v` or right-clicking on `test` folder and clicking `Run`
8989
in PyCharm.
9090
4. Linting is done using [Black](https://black.readthedocs.io/en/stable/). You can set up PyCharm to automatically
9191
run it when you save a file using
9292
these [instructions](https://black.readthedocs.io/en/stable/integrations/editors.html).
9393
The git repository includes an action to run Black on push and pull_request.
94-
5. Before pushing new code, please make sure all files are properly formatted by running the following command in
95-
the `/backend` directory:
96-
```pipenv run black app```
94+
5. Before pushing new code, please make sure all files are properly formatted by running the following command from
95+
the project root directory:
96+
```uv run black app```
9797

9898
### Frontend Module
9999

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,11 @@ dev = [
4545
docs = [
4646
"mkdocs-material"
4747
]
48+
49+
[tool.uv]
50+
dev-dependencies = [
51+
"faker>=37.5.3",
52+
"httpx>=0.28.1",
53+
"pytest-asyncio>=1.1.0",
54+
"pytest>=8.4.1",
55+
]

0 commit comments

Comments
 (0)