iiasa / rime

Rapid Impact Model Emulator
GNU General Public License v3.0
7 stars 1 forks source link

update poetry install #5

Closed byersiiasa closed 8 months ago

byersiiasa commented 8 months ago

Install is mostly working, but now getting stuck on sphinx-build. I couldn't work it out looking at ixmp4 though, would sphinx need to be in the pyproject.toml?

@glatterf42

byersiiasa commented 8 months ago

@glatterf42 i don't understand the lint fails also - am I supposed to run black everytime before push or should it happen automatically?

glatterf42 commented 8 months ago

For sphinx, we do have this in ixmp4:

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
sphinx = "^7.2.6"
sphinx-multiversion = "^0.2.4"
sphinx-rtd-theme = "^2.0.0"
sphinxcontrib-bibtex = "^2.6.2"
sphinxcontrib-openapi = "^0.8.3"

This is making use of poetry's optional dependency groups. You can specify these and they will only be installed if explicitly requested on the command line. So for the full install command, you'd then need to run poetry install --with docs. This allows users who are only interested in core functionality to keep the installation size small.

glatterf42 commented 8 months ago

About the code style: I'm not sure whether you want to keep using black or switch to ruff. We are currently using ruff for most parts of our message stack since it combines formatting (which is compatible with black) with linting capabilities.

In general, if you want your code to adhere to a certain style, these are your options: run the formatting tools manually before you push or have them run automatically, yes. Formatting manually is error-prone, that's why we recently organized a workshop about setting up tools to run automatically (e.g. every time you hit save in your editor or before every git commit is accepted). You might be interested in finding the slides about that here (the audio recording of the presentation is quite bad, unfortunately).

At the very least, if you want to stick with black and keep the existing GitHub Action as similar as possible, I'd recommend the following updates:

# This workflow checks that the code conforms to the Black style
# See https://black.readthedocs.io/en/stable/github_actions.html for details

name: Black formatting

on: [pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
      - uses: psf/black@stable
        with:
          options: "--color"