Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ jobs:
uses: astral-sh/setup-uv@v6
- name: Install dependencies
working-directory: v3 # Set the working directory to v3 where pyproject.toml is located
run: uv sync --all-extras --dev
run: |
sudo apt-get install libldap2-dev libsasl2-dev
uv sync --all-extras --dev
- name: Testing with ruff
working-directory: v3 # Ensure ruff runs in the correct directory
run: uv run ruff check
4 changes: 3 additions & 1 deletion .github/workflows/type-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ jobs:
uses: astral-sh/setup-uv@v6
- name: Install dependencies
working-directory: v3 # Set the working directory to v3 where pyproject.toml is located
run: uv sync --all-extras --dev
run: |
sudo apt-get install libldap2-dev libsasl2-dev
uv sync --all-extras --dev
- name: Type testing with mypy
working-directory: v3 # Ensure mypy runs in the correct directory
run: uv run mypy --cache-dir /tmp/ --ignore-missing-imports .
1 change: 0 additions & 1 deletion v3/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
steve.db
poetry.lock
uv.lock

server/bin/bs.zip
Expand Down
2 changes: 1 addition & 1 deletion v3/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Repository = "https://github.com/apache/steve"
Issues = "https://github.com/apache/steve/issues"

[dependency-groups]
dev = ["faker~=37.8.0", "python-ldap~=3.0.0", { include-group = "lint" }]
lint = [
"coverage>=7.10.6,<8",
"ruff>=0.14.3",
Expand All @@ -33,7 +34,6 @@ lint = [
"types-aiofiles>=24.1.0,<25",
]


[build-system]
requires = ["uv_build"]
build-backend = "uv_build"
Expand Down
10 changes: 4 additions & 6 deletions v3/server/bin/asf-load-ldap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand All @@ -14,23 +15,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import pathlib
import logging

import ldap # pip3 install python-ldap
import asfpy.db
import ldap
import asfpy.stopwatch
from easydict import EasyDict as edict

import steve.persondb

_LOGGER = logging.getLogger(__name__)

THIS_DIR = pathlib.Path(__file__).resolve().parent
DB_FNAME = THIS_DIR.parent / 'steve.db'

sys.path.insert(0, str(THIS_DIR.parent.parent))
import steve.persondb # noqa: E402

# The ASF's LDAP server, available for read-only for finding potential voters.
LDAP_URL = 'ldaps://ldap-us.apache.org/'
LDAP_DN = 'ou=people,dc=apache,dc=org'
Expand Down
9 changes: 4 additions & 5 deletions v3/server/bin/fetch-bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same flavor like Python scripts to resolve commands.


# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand All @@ -14,9 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Fetch latest bootstrap, and places files into our git working copy.
#

#set -x

Expand All @@ -28,8 +27,8 @@ I_VERSION="1.13.1"
I_DIST="bootstrap-icons-${I_VERSION}"
I_URL="https://github.com/twbs/icons/releases/download/v${I_VERSION}/${I_DIST}.zip"

THIS_DIR=$(/bin/dirname "`realpath $0`")
PARENT_DIR=$(/bin/dirname "$THIS_DIR")
THIS_DIR=$(dirname "`realpath $0`")
PARENT_DIR=$(dirname "$THIS_DIR")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS, dirname locates at /usr/bin/dirname. Use dirname for compatibility.

STATIC_DIR="${PARENT_DIR}/static"

# --------------------
Expand Down
16 changes: 6 additions & 10 deletions v3/server/bin/load_fakedata.py → v3/server/bin/load-fakedata.py
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename file to keep using kebab-style.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagined another script importing this to do more sophisticated loading of fake data. ... but we can cross that bridge if that ever happens.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
Expand All @@ -13,30 +14,25 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Load a bunch of fake data into the database, for stuff to work with.


import argparse
import sqlite3
import sys
import pathlib
import logging

import faker # pip3 install faker
import faker

import steve.election
### we shouldn't need this. do so, for now.
import steve.crypto

_LOGGER = logging.getLogger(__name__)

THIS_DIR = pathlib.Path(__file__).resolve().parent
DB_FNAME = THIS_DIR.parent / 'steve.db'

sys.path.insert(0, str(THIS_DIR.parent.parent))
import steve.election # noqa: E402

### we shouldn't need this. do so, for now.
import steve.crypto # noqa: E402

# Do we need individual instances? Use a singleton for now.
FAKE = faker.Faker()

Expand Down