Skip to content

Commit 5c18f02

Browse files
cleanup devcontainer setup
1 parent f5e96fa commit 5c18f02

6 files changed

Lines changed: 46 additions & 113 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM python:3.12-slim-bookworm
33
# Install system dependencies
44
RUN apt-get update && apt-get install -y \
55
--no-install-recommends \
6+
nano \
67
curl \
78
ca-certificates
89

.devcontainer/devcontainer.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,21 @@
99
"customizations": {
1010
"vscode": {
1111
"settings": {
12+
"git.editor": "nano",
13+
"files.insertFinalNewline": true,
14+
"files.trimTrailingWhitespace": true,
1215
"python.defaultInterpreterPath": "/workspace/.venv/bin/python",
1316
"python.terminal.activateEnvironment": true,
1417
"python.formatting.provider": "ruff",
15-
"editor.formatOnSave": true
18+
"[python]": {
19+
"editor.codeActionsOnSave": {
20+
"source.fixAll": "explicit",
21+
"source.organizeImports": "explicit"
22+
},
23+
"editor.defaultFormatter": "charliermarsh.ruff",
24+
"editor.formatOnSave": true,
25+
"editor.tabSize": 4
26+
}
1627
},
1728
"extensions": [
1829
"ms-python.python",
@@ -24,5 +35,5 @@
2435
]
2536
}
2637
},
27-
"postCreateCommand": "uv sync --dev"
38+
"postCreateCommand": "uv sync && git config --global core.editor nano"
2839
}

.vscode/extensions.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 66 deletions
This file was deleted.

README.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
1-
# Python Base Repository
1+
# Pyton Base Repository
22

3-
Initial python project setup with Devcontainers, CI pipeline and the Serde library.
3+
Initial Python project setup with Devcontainers, CI pipeline and the Pydantic library.
44

5-
## Overview
6-
This repository is based on [github.com/a5chin/python-uv](https://github.com/a5chin/python-uv). Check its readme for the main layout of this repository.
5+
## Setup
76

8-
## TODO
9-
- Improve documentation
10-
- Add logging support
11-
12-
## Appendix
13-
14-
### Run Tests
15-
```sh
16-
uv run pytest
7+
1. Install [Docker](https://www.docker.com/get-started) and [VS Code](https://code.visualstudio.com/)
8+
2. Install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension in VS Code
9+
3. Clone this repository:
10+
```bash
11+
git clone https://github.com/matthiaszimmermann/python-base.git
12+
```
13+
4. Open the project in VS Code:
14+
```bash
15+
code python-base
1716
```
17+
5. When prompted, click "Reopen in Container"
1818

19-
### Install Libraries
20-
```sh
21-
# Install also include develop dependencies
22-
uv sync
19+
## TODO
2320

24-
# If you do not want dev dependencies to be installed
25-
uv sync --no-dev
21+
- remove .vscode folder (move to .devcontainer/devcontainer.json)
22+
- streamline gihub setup/pipelines
23+
- add user test
2624

27-
# Use the add command to add dependencies to your project
28-
uv add {libraries}
25+
## Usage
26+
Once the dev container is built and running, you can use the integrated terminal in VS Code to run commands.
27+
28+
### Formatting
29+
```bash
30+
ruff check
2931
```
3032

31-
## Run Command Line
33+
### Running Tests
34+
To run all tests:
35+
```bash
36+
pytest
37+
```
3238

39+
## Run Example
3340
```sh
34-
uv run python src/main.py 42 Bob bob@example.com
35-
uv run python src/main.py '{"id":42,"name":"Bob","email":"bob@example.com"}'
41+
python src/main.py 42 Bob bob@example.com
42+
python src/main.py '{"id":42,"name":"Bob","email":"bob@example.com"}'
3643
```

src/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# noqa: D104

0 commit comments

Comments
 (0)