Skip to content

Add new board to TOML & improve the board logic #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 97 additions & 29 deletions docs/operations/boards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,108 @@ Kanonickým zdrojem pravdy je ale `výpis na justice.cz <https://or.justice.cz/i



Výbor od 9.4.2022
Nově zvolený výbor
------------------

.. list-table::
:header-rows: 1

* * Jméno
* GitHub
* Funkce
* * Jakub Vysoký
* `@kvbik <https://github.com/kvbik>`_
*
* * Jan Čermák
* `@sairon <https://github.com/sairon>`_
* |:moneybag:|
* * Karolina Surma
* `@befeleme <https://github.com/befeleme>`_
* |:crown:|
* * Petr Viktorin
* `@encukou <https://github.com/encukou>`_
*
* * Jakub Červinka
* `@JakubDotPy <https://github.com/JakubDotPy>`_
*

Výbor od 1.9.2022
-------------------------------------------------

.. csv-table::
:header: "Jméno", "GitHub", "Funkce"

Barbora Drbohlavová, `@baradrb <https://github.com/baradrb>`_, |:crown:|
Anežka Müller, `@anezkamll <https://github.com/anezkamll>`_,
Jan Javorek, `@honzajavorek <https://github.com/honzajavorek>`_,
Jakub Vysoký, `@kvbik <https://github.com/kvbik>`_,
Jan Čermák, `@sairon <https://github.com/sairon>`_, |:moneybag:|

Výbor od 8.4.2019
.. list-table::
:header-rows: 1

* * Jméno
* GitHub
* Funkce
* * Barbora Drbohlavová
* `@baradrb <https://github.com/baradrb>`_
* |:crown:|
* * Anežka Müller
* `@anezkamll <https://github.com/anezkamll>`_
*
* * Jan Javorek
* `@honzajavorek <https://github.com/honzajavorek>`_
*
* * Jakub Vysoký
* `@kvbik <https://github.com/kvbik>`_
*
* * Jan Čermák
* `@sairon <https://github.com/sairon>`_
* |:moneybag:|

Výbor od 4.5.2019
-------------------------------------------------

.. csv-table::
:header: "Jméno", "GitHub", "Funkce"

Martin Bílek, `@martinbilek <https://github.com/martinbilek>`_, |:crown:| |:moneybag:|
Aleš Zoulek, `@aleszoulek <https://github.com/aleszoulek>`_,
Jan Javorek, `@honzajavorek <https://github.com/honzajavorek>`_,
Jakub Vysoký, `@kvbik <https://github.com/kvbik>`_,
Jiří Bartoň, `@whiskybar <https://github.com/whiskybar>`_,
.. list-table::
:header-rows: 1

* * Jméno
* GitHub
* Funkce
* * Martin Bílek
* `@martinbilek <https://github.com/martinbilek>`_
* |:crown:| |:moneybag:|
* * Aleš Zoulek
* `@aleszoulek <https://github.com/aleszoulek>`_
*
* * Jan Javorek
* `@honzajavorek <https://github.com/honzajavorek>`_
*
* * Jakub Vysoký
* `@kvbik <https://github.com/kvbik>`_
*
* * Jiří Bartoň
* `@whiskybar <https://github.com/whiskybar>`_
*

Výbor od 27.3.2012
-------------------------------------------------

.. csv-table::
:header: "Jméno", "GitHub", "Funkce"

Martin Bílek, `@martinbilek <https://github.com/martinbilek>`_, |:crown:| |:moneybag:|
Aleš Zoulek, `@aleszoulek <https://github.com/aleszoulek>`_,
Robin Gottfried, `@czervenka <https://github.com/czervenka>`_,
Jan Král, `@honzakral <https://github.com/honzakral>`_,
Jakub Vysoký, `@kvbik <https://github.com/kvbik>`_,
Jiří Bartoň, `@whiskybar <https://github.com/whiskybar>`_,
Vítězslav Pliska, `@whit <https://github.com/whit>`_,
.. list-table::
:header-rows: 1

* * Jméno
* GitHub
* Funkce
* * Martin Bílek
* `@martinbilek <https://github.com/martinbilek>`_
* |:crown:| |:moneybag:|
* * Aleš Zoulek
* `@aleszoulek <https://github.com/aleszoulek>`_
*
* * Robin Gottfried
* `@czervenka <https://github.com/czervenka>`_
*
* * Jan Král
* `@honzakral <https://github.com/honzakral>`_
*
* * Jakub Vysoký
* `@kvbik <https://github.com/kvbik>`_
*
* * Jiří Bartoň
* `@whiskybar <https://github.com/whiskybar>`_
*
* * Vítězslav Pliska
* `@whit <https://github.com/whit>`_
*
29 changes: 23 additions & 6 deletions docs/operations/boards.rst.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,29 @@ Kanonickým zdrojem pravdy je ale `výpis na justice.cz <https://or.justice.cz/i


{% for board in boards %}
{%- if board.has_started %}
Výbor od {{ board.start_on.strftime("%-d.%-m.%Y") }}
-------------------------------------------------

.. csv-table::
:header: "Jméno", "GitHub", "Funkce"
{% for member in board.members %}
{{ member.name }}, `@{{ member.github }} <https://github.com/{{ member.github }}>`_, {% if member.is_chair %}|:crown:| {% endif %}{% if member.is_treasurer %}|:moneybag:| {% endif %}
{%- endfor %}
{%- else %}
Nově zvolený výbor
------------------
{%- endif %}

.. list-table::
:header-rows: 1

* * Jméno
* GitHub
* Funkce
{%- for member in board.members %}
* * {{ member.name }}
* `@{{ member.github }} <https://github.com/{{ member.github }}>`_
*
{%- if member.is_chair -%}
{{- " " -}} |:crown:|
{%- endif -%}
{%- if member.is_treasurer -%}
{{- " " -}} |:moneybag:|
{%- endif -%}
{% endfor %}
{% endfor %}
10 changes: 5 additions & 5 deletions docs/operations/elections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Volby do výboru probíhají asynchronně a zpravidla trvají týden, aby stihli
Kdy se volí
-----------

+------------------------------------+--------------------+
| |:ballot_box:| Předchozí volba | |board_start| |
+------------------------------------+--------------------+
| |:warning:| Příští volba | |board_end| |
+------------------------------------+--------------------+
+------------------------------------+------------------------+
| |:ballot_box:| Předchozí volba | |board_vote_date| |
+------------------------------------+------------------------+
| |:warning:| Příští volba | |next_board_vote_date| |
+------------------------------------+------------------------+

Příprava
--------
Expand Down
26 changes: 24 additions & 2 deletions src/pyvec_docs/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,26 @@ def is_treasurer(self) -> bool:

class Board(BaseModel):
start_on: date
voted_on: date
has_started: bool
members: list[BoardMember]

model_config = {"extra": "forbid", "frozen": True}

@classmethod
def create(cls, voted_on=None, start_on=None, **kwargs):
if start_on is None:
start_on = voted_on
has_started = False
else:
has_started = True
return cls(
voted_on=voted_on,
start_on=start_on,
has_started=has_started,
**kwargs,
)

@property
def years(self) -> tuple[int, int]:
start_year = self.start_on.year
Expand All @@ -52,9 +68,15 @@ def years(self) -> tuple[int, int]:

@cache
def load_boards(path: Path | str = BOARDS_CONFIG_PATH) -> list[Board]:
"""Load all boards, including inactive ones"""
data = tomllib.loads(Path(path).read_text())
return sorted(
(Board(**board) for board in data["board"]),
key=attrgetter("start_on"),
(Board.create(**board) for board in data["board"]),
key=attrgetter('start_on'),
reverse=True,
)

@cache
def load_current_board(path: Path | str = BOARDS_CONFIG_PATH) -> Board:
"""Load the board that is currently in power"""
return next(board for board in load_boards(path) if board.has_started)
43 changes: 40 additions & 3 deletions src/pyvec_docs/boards.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,44 @@
# The Pyvec board members in time
# The current board is first, previous boards are listed in descending order
# The most recent board is first, previous boards are listed in descending order
# Each member has a `name`, `github`, and optionally a `roles` array
#
# "voted_on" is the day when we voted for the board. It's approximate, since
# votes can take longer than a day.
#
# "start_on" should ideally be the date from justice.cz.
# If the board doesn't officially have power yet, leave it out; "voted_on` will
# be used as default.


[[board]]
voted_on = "2025-05-07"

[[board.members]]
name = "Jakub Vysoký"
github = "kvbik"

[[board.members]]
name = "Jan Čermák"
github = "sairon"
roles = ["treasurer"]

[[board.members]]
name = "Karolina Surma"
github = "befeleme"
roles = ["chair"]

[[board.members]]
name = "Petr Viktorin"
github = "encukou"

[[board.members]]
name = "Jakub Červinka"
github = "JakubDotPy"


[[board]]
start_on = "2022-04-09"
start_on = "2022-09-01"
voted_on = "2022-04-09"

[[board.members]]
name = "Barbora Drbohlavová"
Expand All @@ -30,7 +65,8 @@ roles = ["treasurer"]


[[board]]
start_on = "2019-04-08"
start_on = "2019-05-04"
voted_on = "2019-04-08"

[[board.members]]
name = "Martin Bílek"
Expand All @@ -57,6 +93,7 @@ github = "whiskybar"

[[board]]
start_on = "2012-03-27"
voted_on = "2012-03-27" # approximation

[[board.members]]
name = "Martin Bílek"
Expand Down
8 changes: 4 additions & 4 deletions src/pyvec_docs/ext/board_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
def board_dates(app: Sphinx, config: Config):
board = load_boards()[0]

board_start = board.start_on
board_end = board_start + timedelta(days=BOARDS_MANDATE_LENGTH * 365)
last_vote = board.voted_on
next_vote = last_vote + timedelta(days=BOARDS_MANDATE_LENGTH * 365)

existing_epilog = app.config.rst_epilog or ""
app.config.rst_epilog = (
f"{existing_epilog}\n\n"
f".. |board_start| replace:: {board_start:%-d.%-m.%Y}\n"
f".. |board_end| replace:: {board_end:%Y}\n"
f".. |board_vote_date| replace:: {last_vote:%-d.%-m.%Y}\n"
f".. |next_board_vote_date| replace:: {next_vote:%Y}\n"
)


Expand Down
4 changes: 2 additions & 2 deletions src/pyvec_docs/ext/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from docutils import nodes

from pyvec_docs.boards import load_boards
from pyvec_docs.boards import load_current_board


# https://docutils.readthedocs.io/en/sphinx-docs/howto/rst-roles.html
Expand All @@ -34,6 +34,6 @@ def slack(


def setup(app):
pyvec_board_years = load_boards()[0].years
pyvec_board_years = load_current_board().years
app.add_role("slack", functools.partial(slack, pyvec_board_years=pyvec_board_years))
return {"version": "1.0", "parallel_read_safe": True}
2 changes: 2 additions & 0 deletions src/pyvec_docs/grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def remove_comments(html):

def get_board_member_name(username, voted_at, boards: list[Board]):
for board in boards: # sorted from the most recent
if not board.has_started:
continue
if voted_at > board.start_on:
for member in board.members:
if member.github == username:
Expand Down
Loading