Skip to content

Refactor repo structure and move package management to uv#38

Merged
masquare merged 6 commits intomainfrom
masquare/refactor-structure
Dec 17, 2025
Merged

Refactor repo structure and move package management to uv#38
masquare merged 6 commits intomainfrom
masquare/refactor-structure

Conversation

@masquare
Copy link
Collaborator

@masquare masquare commented Dec 9, 2025

Refactor repo structure and move package management to uv

♻️ Current situation & Problem

This PR restructures the repository for better organization and modernizes the package management by migrating from requirements.txt to uv (a fast Python package installer and resolver). This addresses:

  • Organization: Improved project structure with proper separation of concerns
  • Package Management: Migration to uv for faster, more reliable dependency resolution
  • Maintainability: Cleaner project layout that aligns with Python best practices
  • Submodule Cleanup: Removal of unused submodule dependencies

Resolves the ongoing effort to improve project organization and developer experience.

⚙️ Release Notes

Features

  • Package Management Migration: Migrated from requirements.txt to pyproject.toml with uv.lock for reproducible builds

    • Faster dependency resolution with uv
    • Better lock file management for reproducible environments
    • Centralized project metadata in pyproject.toml
  • Repository Structure Improvements:

    • Moved root-level utility scripts to scripts/ directory for better organization
    • Converted .gitignore files to .gitkeep in empty directories (data/, notebooks/)
    • Removed unused .gitmodules and submodule references
    • Updated .python-version to specify Python 3.12
  • Updated Documentation: README now reflects the new structure and package management approach

Migration Guide for Users

If you were previously using requirements.txt:

Before:

pip install -r requirements.txt

After:

uv sync

📚 Documentation

The project now uses pyproject.toml as the single source of truth for project metadata and dependencies. Key sections include:

  • Project Metadata: Name, version, description, authors, keywords, and classifiers
  • Dependencies: All runtime and optional development dependencies are clearly specified
  • Python Requirements: Requires Python >= 3.12

For detailed project information, see README.md and the inline documentation in pyproject.toml.

The repository structure has been improved:

opentslm/
├── src/                 # Source code
├── test/                # Test suite
├── scripts/             # Utility scripts
├── demo/                # Demo notebooks and examples
├── evaluation/          # Evaluation tools and scripts
├── data/                # Data storage
└── notebooks/           # Jupyter notebooks

✅ Testing

This PR maintains full backward compatibility with existing tests. No new test files were added as this is primarily a structural and tooling refactoring:

  • All existing tests remain in the test/ directory
  • Import paths in model files were updated to reflect organizational changes
  • Development environment can be tested using uv sync followed by test execution

Manual testing steps:

  1. Clone/update the repository
  2. Run uv sync to install all dependencies
  3. Verify scripts in scripts/ directory are executable and functional
  4. Run the existing test suite to ensure no regressions

Code of Conduct & Contributing Guidelines

By creating and submitting this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@masquare masquare requested a review from RealLast December 9, 2025 10:27
@masquare masquare force-pushed the masquare/refactor-structure branch from 3515876 to dd1ed36 Compare December 9, 2025 10:31
@masquare masquare force-pushed the masquare/refactor-structure branch 6 times, most recently from 42964c5 to 594af67 Compare December 12, 2025 09:53
@masquare masquare force-pushed the masquare/refactor-structure branch from 594af67 to 434271b Compare December 12, 2025 10:25
@PSchmiedmayer PSchmiedmayer mentioned this pull request Dec 12, 2025
1 task
@PSchmiedmayer
Copy link
Member

@masquare As noted on Slack; created #39 to address the REUSE questions. CC: @RealLast

RealLast pushed a commit that referenced this pull request Dec 15, 2025
# Add Automated REUSE Setup

## ♻️ Current situation & Problem
- As noted in #38 , our current licensing setup is a bit inconsistent.

## ⚙️ Release Notes
- Adds a template and command example to unity the header setup.

## ✅ Testing
- @masquare: I ran the command once to adjust all headers.

### Code of Conduct & Contributing Guidelines
By creating and submitting this pull request, you agree to follow our
[Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
@RealLast
Copy link
Collaborator

Accepted #39 @masquare @PSchmiedmayer

@PSchmiedmayer
Copy link
Member

Thanks @RealLast and thanks for the work here @masquare 🚀

Copy link
Collaborator

@ThomasKaar ThomasKaar left a comment

Choose a reason for hiding this comment

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

thanks a lot for the work here @masquare !! 🚀

added some minor questions. the one from common_evaluator_plot.py needs to be resolved, the others are fine either way for me
when those are resolved it is good to go

@masquare masquare force-pushed the masquare/refactor-structure branch 3 times, most recently from 4d5b79c to a63c76d Compare December 17, 2025 10:49
Signed-off-by: masquare <masquare@users.noreply.github.com>
@masquare masquare force-pushed the masquare/refactor-structure branch from a63c76d to b7043ca Compare December 17, 2025 10:50
@masquare masquare merged commit 9f22622 into main Dec 17, 2025
2 checks passed
@masquare masquare deleted the masquare/refactor-structure branch December 17, 2025 11:06
masquare added a commit that referenced this pull request Dec 19, 2025
# Fix publish workflow inputs and add branch verification

## ♻️ Current situation & Problem

Fixes issues with the PyPI publish workflow (`publish.yml`):
1. Incorrect YAML structure for workflow dispatch inputs (nested under
`target` instead of directly under `inputs`)
2. Inconsistent casing for TestPyPI (was `TestPyPi`)
3. Smoke tests referencing old `tests/` directory (should be `test/`)
4. Missing safety mechanism to prevent accidental publication to PyPI
from non-main branches

Related to: [Refactor repo structure and move package management to uv
(#38)](#38)


## ⚙️ Release Notes

**Improvements:**
- Fixed GitHub Actions workflow YAML syntax for publish workflow
dispatch inputs
- Added branch verification step to prevent publishing to PyPI from
non-main branches
- Updated smoke test paths to match current repository structure
- Fixed casing inconsistency: `TestPyPi` → `TestPyPI`

**Breaking Changes:** None


## 📚 Documentation

The changes are self-documented through:
- Clear error message when attempting to publish to PyPI from a non-main
branch
- In-line comments explaining the branch verification check
- Consistent naming conventions across the workflow


## ✅ Testing

The workflow has been tested with:
- Manual workflow dispatch to verify input structure is correctly parsed
- Branch verification logic confirms that only the main branch can
publish to PyPI
- Smoke tests now correctly reference the `test/` directory
- All changes maintain backward compatibility with existing PyPI and
TestPyPI publication flows

**Testing performed:**
- ✅ Verified workflow YAML syntax is valid
- ✅ Tested branch verification logic blocks non-main branch publications
- ✅ Confirmed smoke test paths exist and are executable


### Code of Conduct & Contributing Guidelines
By creating and submitting this pull request, you agree to follow our
[Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
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.

4 participants