Skip to content

Commit

Permalink
Merge pull request #16 from EnergieID/develop
Browse files Browse the repository at this point in the history
0.1.20: Dyntar Fixes
  • Loading branch information
JrtPec authored Oct 18, 2024
2 parents e52890d + 3018f69 commit bfcc45b
Show file tree
Hide file tree
Showing 12 changed files with 43,181 additions and 42,850 deletions.
90 changes: 37 additions & 53 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,39 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
"features": {
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/devcontainers-contrib/features/ruff:1": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install -r requirements.txt && pip3 install -r requirements-dev.txt",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root",

"customizations": {
"vscode": {
"extensions": [
"ms-toolsai.jupyter",
"charliermarsh.ruff",
"ms-python.pylint",
"ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.testing.pytestArgs": ["--no-cov"],
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
}
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1.1.9-3.11-bookworm",
"features": {},
"postCreateCommand": "zsh -l .devcontainer/post-install.sh",
// "postStartCommand": "",
"remoteUser": "root",
"customizations": {
"vscode": {
"extensions": [
"ms-toolsai.jupyter",
"charliermarsh.ruff",
"ms-python.pylint",
"ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
"mhutchie.git-graph"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.testing.pytestArgs": ["--no-cov"],
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
}
}
24 changes: 24 additions & 0 deletions .devcontainer/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/zsh -l
# Add the current directory to Git's safe directory list
git config --global --add safe.directory /workspaces/OpenEnergyID

# Install Python tools
pipx install ruff poetry pre-commit

# Install project dependencies using Poetry
poetry install

# Install pre-commit hooks
pre-commit install

# Install Node.js and Pure prompt
# nvm install node
# npm install --global pure-prompt

# # Configure Zsh to use Pure prompt
# "autoload -U promptinit; promptinit; prompt pure"
# "echo "autoload -U promptinit; promptinit; prompt pure" >> ~/.zshrc"

# # Uncomment the following line to install zsh-syntax-highlighting
# # sudo apt-get install zsh-syntax-highlighting
# # echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
37 changes: 26 additions & 11 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Development Environment Setup

This guide outlines the setup process for our development environment, focusing on packaging and dependency management.

## Info on dev setup

### Commit practices (pre-commit)
we use [pre-commit ](https://pre-commit.com/)to run RUFF.

we use [pre-commit ](https://pre-commit.com/)to run RUFF.

### Poetry for Packaging and Dependency Management

We use [Poetry](https://python-poetry.org/docs/main/#installation) as our primary tool for packaging and managing dependencies. Poetry provides a simple yet powerful way to manage project dependencies and publish packages.
Expand All @@ -18,31 +22,42 @@ To ensure that Python CLI applications are installed globally on your system whi

1. First, [install pipx](https://pipx.pypa.io/stable/installation/) following the instructions on the official website.
2. Once pipx is installed, you can easily install Poetry by running the following command in your terminal:
```pipx install poetry```
3. (*optional*) [install](vscode:extension/zeshuaro.vscode-python-poetry) vscode extension for poetry
`pipx install poetry`
3. (_optional_) [install](vscode:extension/zeshuaro.vscode-python-poetry) vscode extension for poetry

### Setup with Poetry

```shell
poetry install
```

### publishing with poetry

https://python-poetry.org/docs/repositories/

## Remarks for devcontainer

You can also work inside a docker container(devcontainer).
To make sure you have access/permissions inside the devcontainer.
From inside the devcontainer after launch, check user and take ownership:
You can also work inside a docker container(devcontainer).

```bash
whoami
sudo chown -R $USER:$USER /workspaces/ -R
```

other option is to run as root from within the `devcontainer.json` `"remoteUser": "root"`
### some info about devcontainers:

- [poetry in a devcontainer](https://marioscalas.medium.com/using-python-and-poetry-inside-a-dev-container-33c80bc5a22c)

- [our python/container version](https://github.com/devcontainers/images/blob/main/src/python/history/1.1.9.md#variant-311-bookworm)

- notes on [devcontainer git authentication](https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials). dont forget to ssh-add if you use keys.

# Useful commands for dev work

## clean up
[vulture](https://github.com/jendrikseipp/vulture) for finding dead python 🐍
```pipx run vulture . --exclude venv```

[deptry](https://github.com/fpgmaas/deptry) for checking dependencies
```pipx run deptry . --ignore-notebooks```
[vulture](https://github.com/jendrikseipp/vulture) for finding dead python 🐍
`pipx run vulture . --exclude venv`

[deptry](https://github.com/fpgmaas/deptry) for checking dependencies
`pipx run deptry . --ignore-notebooks`
Loading

0 comments on commit bfcc45b

Please sign in to comment.