Skip to content

Conversation

@np-complete0
Copy link
Contributor

@np-complete0 np-complete0 commented Oct 20, 2025

JIRA Ticket:
BFD-4351

What Does This PR Do?

This PR centralizes Python dependency and tooling configuration by introducing a uv workspace in apps. It consolidates Python version pinning, dev tools, and lockfile management, and updates CI to run checks at the workspace level. It also removes redundant per-project .python-version files.

What Should Reviewers Watch For?

If you're reviewing this PR, please check for these things in particular:

  • Verify the non-workspace ops project job behaves as expected and didn’t accidentally get included/excluded.
  • Verify requires python in pyproject.toml and critical ops projects are compatible.
  • Run the quick local commands to sanity-check the workspace:

Usage

From the apps directory:

Install all dependencies

uv sync --all-groups

Install dependencies for a specific project

uv sync --package bfd-pipeline-idr

Run commands

# Run tests
uv run pytest

# Run tests for a specific project
uv run pytest bfd-pipeline/bfd-pipeline-idr

# Check linting
uv run ruff check

# Format code
uv run ruff format --check

# Check types
uv run pyright

Add a dependency to a project

# Navigate to the project directory
cd bfd-pipeline/bfd-pipeline-idr

# Add a dependency
uv add <package-name>

Add a dev dependency

# Add to workspace-level dev dependencies
uv add --dev <package-name>

# Add to a specific project's dev dependencies
cd bfd-pipeline/bfd-pipeline-idr
uv add --dev <package-name>

Configuration

Python Version

The Python version (3.13) is specified in:

  • Repository root .python-version
  • apps/pyproject.toml (requires-python field)

Tool Configuration

Tool configurations (ruff, pyright) are centralized in apps/pyproject.toml under the [tool.*] sections. Individual projects can override these settings if needed.

Dependency Groups

  • Common dev dependencies (ruff, pyright, pytest) are defined at the workspace level
  • Project-specific dependencies are defined in each project's pyproject.toml
  • Optional dependency groups (like lambda-run-locust for locust_tests) are project specific

CI/CD

The CI workflow (.github/workflows/ci-python.yml) runs workspace level checks:

  1. Linting with ruff check
  2. Formatting check with ruff format --check
  3. Type checking with pyright
  4. Tests with pytest

Python and tool versions are pinned in the CI workflow to ensure consistency.

Migrating from Individual Projects

Previously, each Python project had its own:

  • .python-version file
  • uv.lock file
  • Tool configurations (ruff, pyright)

With the workspace setup:

  • Single .python-version at repository root
  • Single uv.lock at workspace root (apps/uv.lock)
  • Unified tool configurations
  • Simplified dependency management
  • Faster CI/CD (single install step)

Troubleshooting

Lock file out of sync

If you see errors about the lock file being out of sync, run:

uv lock

Virtual environment issues

If you encounter virtual environment issues, remove and recreate:

rm -rf .venv
uv sync --all-groups

Project not found

Make sure the project is listed in the [tool.uv.workspace] section of apps/pyproject.toml.


What Security Implications Does This PR Have?

Please indicate if this PR does any of the following:

  • Adds any new software dependencies

  • No

  • Modifies any security controls

  • No

  • Adds new transmission or storage of data

  • No

  • Any other changes that could possibly affect security?

  • No

  • I have considered the above security implications as it relates to this PR. (If one or more of the above apply, it cannot be merged without the ISSO or team security engineer's (@sb-benohe) approval.)

  • I have created tests to sufficiently ensure the reliability of my code, if applicable. If this is a modification to an existing piece of code, I have audited the associated tests to ensure everything works as expected.

Validation

Have you fully verified and tested these changes? Is the acceptance criteria met? Please provide reproducible testing instructions, code snippets, or screenshots as applicable.

@np-complete0 np-complete0 self-assigned this Oct 20, 2025
@np-complete0 np-complete0 added the enhancement New feature or request label Oct 20, 2025
@np-complete0 np-complete0 marked this pull request as draft October 20, 2025 14:06
@np-complete0 np-complete0 force-pushed the BFD-4351 branch 7 times, most recently from 6818439 to 5599ce5 Compare October 20, 2025 14:59
@np-complete0 np-complete0 force-pushed the BFD-4351 branch 5 times, most recently from d76666e to 00cacbc Compare October 20, 2025 17:46
@np-complete0 np-complete0 marked this pull request as ready for review October 20, 2025 17:56
Copy link
Collaborator

@malessi malessi left a comment

Choose a reason for hiding this comment

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

I haven't taken too much of a look at everything else quite yet, but from my cursory glance it looks like this is going in the right direction! The pyproject.toml should get moved to the root, first.

@np-complete0 np-complete0 force-pushed the BFD-4351 branch 3 times, most recently from 38c2688 to 8f110ec Compare October 29, 2025 21:06
@np-complete0 np-complete0 marked this pull request as draft October 30, 2025 14:37
auto-merge was automatically disabled October 30, 2025 14:37

Pull request was converted to draft

… a uv workspace in apps.

It consolidates Python version pinning, dev tools, and lockfile management, and updates CI to run checks at the workspace level.
It also removes redundant per-project .python-version files.
@np-complete0 np-complete0 requested a review from malessi November 3, 2025 21:26
@np-complete0 np-complete0 marked this pull request as ready for review November 3, 2025 21:27
@np-complete0
Copy link
Contributor Author

apps/pyproject.toml and ops/pyproject.toml have been merged into /pyproject.toml
@aschey-forpeople @malessi

@bfd-sast
Copy link

bfd-sast bot commented Nov 10, 2025

Quality Gate passed Quality Gate passed for 'bfd-parent'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants