Skip to content

BFD-4351: Python Unified Root UV Workspace - #3089

Closed
jonathan-cantu-icf wants to merge 38 commits into
epic/BFD-4669_Python-Workspace-Consolidation-AndCleanupfrom
feature/BFD-4351_Python-CI
Closed

BFD-4351: Python Unified Root UV Workspace#3089
jonathan-cantu-icf wants to merge 38 commits into
epic/BFD-4669_Python-Workspace-Consolidation-AndCleanupfrom
feature/BFD-4351_Python-CI

Conversation

@jonathan-cantu-icf

@jonathan-cantu-icf jonathan-cantu-icf commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

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

cd apps/bfd-model-idr
uv sync

Run commands

# Run tests
uv run pytest

# Run tests for a specific project
uv run pytest apps/bfd-model-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 apps/bfd-model-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 apps/bfd-model-idr
uv add --dev <package-name>

Configuration

Python Version

The Python version (3.13) is specified in:

  • 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.

While tackling the ticket and pushing changes, I observed the state of things in GitHub CI. It would seem we are at the same state as we were before with the added benefit of an initial stab at one root level uv workspace.

@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch from 73319ae to c604424 Compare April 7, 2026 22:27
@jonathan-cantu-icf
jonathan-cantu-icf marked this pull request as draft April 8, 2026 00:54
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch from 8dbd3d9 to b769c18 Compare April 9, 2026 00:55
@jonathan-cantu-icf
jonathan-cantu-icf marked this pull request as ready for review April 9, 2026 14:16
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch from 2d317dc to 79e1d22 Compare April 10, 2026 19:40
@jonathan-cantu-icf jonathan-cantu-icf changed the title BFD-4351: Python CI Improvements BFD-4351: Python Unified Root UV Workspace Apr 15, 2026
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch from 7905cff to 505289f Compare April 15, 2026 14:27
@jonathan-cantu-icf
jonathan-cantu-icf changed the base branch from master to epic/BFD-4669_Python-Workspace-Consolidation-AndCleanup April 16, 2026 15:16
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch from 505289f to 41ce7bb Compare April 16, 2026 18:00
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch 2 times, most recently from 966db57 to c0a8ed2 Compare April 23, 2026 22:49
@jonathan-cantu-icf
jonathan-cantu-icf marked this pull request as draft April 23, 2026 22:59
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch 4 times, most recently from cbc84fe to 91a2cbb Compare April 29, 2026 22:22
Comment thread apps/bfd-model-idr/dd_helper_script.py Outdated
# Conflicts:
#	apps/bfd-pipeline-idr/.python-version
#	apps/bfd-pipeline-idr/pyproject.toml
#	apps/bfd-pipeline-idr/uv.lock
… to get CI Actions to pass for 'uv run ruff check' on 2 particular projects (sftp-outbound-transfer-lambda and locust_tests).
… 'ruff' for 'sftp_outbound_transfer' without failure.
# Conflicts:
#	ops/services/04-idr-pipeline/lambda_src/consume-idr-events/pyproject.toml
#	ops/services/04-idr-pipeline/lambda_src/consume-idr-events/uv.lock

# Conflicts:
#	apps/bfd-model-idr/uv.lock

# Conflicts:
#	apps/bfd-pipeline-idr/pyproject.toml
…rkspace.

# Conflicts:
#	apps/bfd-pipeline-idr/.python-version
… to get CI Actions to pass for 'uv run ruff check' on 2 particular projects (sftp-outbound-transfer-lambda and locust_tests).
… to get CI Actions to pass for 'uv run ruff check' on 2 particular projects (sftp-outbound-transfer-lambda and locust_tests).
@jonathan-cantu-icf
jonathan-cantu-icf force-pushed the feature/BFD-4351_Python-CI branch from 91a2cbb to 15666a5 Compare May 1, 2026 20:02
@jonathan-cantu-icf
jonathan-cantu-icf marked this pull request as ready for review May 4, 2026 22:35
@bfd-sast

bfd-sast Bot commented May 7, 2026

Copy link
Copy Markdown

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

Issues
0 New issues
0 Accepted issues

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

See analysis details on SonarQube

@aschey-forpeople
aschey-forpeople marked this pull request as draft May 13, 2026 17:24
@aschey-forpeople

Copy link
Copy Markdown
Contributor

Closing as stale

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants