
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
sp_brew
is a package for analyzing and handling experimental data. In comes with a set of predefined analysis for each Building Block of smart photonics.
This section provides a slightly longer explanation of the package.
Example:
sp_brew
provides a suite of utility functions for data processing, including data cleaning, transformation, and analysis tools. It aims to simplify common data manipulation tasks for Python developers working with structured datasets.
If your package is intended to be used by others, explain how they can install it via pip.
pip install sp_brew
from sp_brew import greet # Replace with actual imports
# Assuming you have a function like 'greet' from a previous example
message = greet("Team!")
print(message)
This section is specifically for team members who will be contributing to the package.
Before you start, make sure you have:
Follow these steps to set up your development environment.
First, get a copy of the project code onto your local machine:
git clone https://git-main.smartphotonics.io/DMassella/sp_brew.git
cd sp_brew
uv
(Our Project Manager)We use uv as our primary tool for managing Python packages and virtual environments. It's designed to be extremely fast and efficient.
If you don't have uv
installed globally, please install it using one of the following methods:
macOS and Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows (PowerShell - Run as Administrator):
irm https://astral.sh/uv/install.ps1 | iex
After installation, ensure uv
is in your system's PATH. You might need to restart your terminal or add the uv
binary directory to your PATH environment variable (the installer usually tells you where it places the binary).
You can verify uv
is installed by running:
uv --version
uv
will automatically create and manage a dedicated virtual environment for our project. This keeps project dependencies isolated from your system Python.
From the project's root directory:
uv sync
What uv sync
does:
pyproject.toml
file to identify all required dependencies (both runtime and development dependencies)..venv
in the project root (if one doesn't exist) using Python 3.11 (as specified in our .python-version
file).uv.lock
, which pins exact versions of all dependencies for reproducible builds across different machines.You are now ready to start development!
We use pre-commit to automatically check code formatting and quality before each commit.
After installing dependencies with uv sync
, install the pre-commit hooks:
uv run pre-commit install
This will ensure that every time you make a commit, formatting and linting checks are run automatically.
To manually run all pre-commit checks on all files (recommended before pushing):
uv run pre-commit run --all-files
If any checks fail, follow the instructions in the terminal to fix the issues and re-commit.
We use pytest
for writing and running our tests. pytest
is installed as a development dependency.
To run all tests:
uv run pytest
To see more detailed test output (e.g., which tests were collected):
uv run pytest -v
To run tests and generate a coverage report (showing which lines of code are covered by tests):
uv run pytest --cov=sp_brew --cov-report=term-missing
For a detailed HTML coverage report (which you can open in your browser):
uv run pytest --cov=sp_brew --cov-report=html
This will create an htmlcov/
folder. Open htmlcov/index.html
in your web browser.
If your feature requires a new Python package, add it using uv
:
Runtime Dependency (required by the package itself):
uv add <package-name>
# Example:
uv add requests
Development Dependency (e.g., for testing, linting, or building tools):
uv add <package-name> --dev
# Example:
uv add black --dev # for code formatting
uv
will automatically update pyproject.toml
, install the package into your .venv
, and update uv.lock
.
You can execute any Python script or command within the project's virtual environment using uv run
without needing to manually activate the environment:
uv run python examples/simple.py # Example for running a specific script
Normally, uv
handles the virtual environment for you. However, if you ever need to manually activate it (e.g., to use pip directly, though uv
is preferred), you can:
macOS / Linux:
source .venv/bin/activate
Windows (Command Prompt):
.venv\Scripts\activate.bat
Windows (PowerShell):
.venv\Scripts\Activate.ps1
Once activated, your terminal prompt will typically show (.venv)
to indicate the environment is active. To deactivate:
deactivate
This project uses Git for version control. Here's a basic workflow for collaboration:
If you cloned the repository, you already have the origin
remote configured. You can verify it:
git remote -v
You should see output similar to:
origin https://git-main.smartphotonics.io/DMassella/sp_brew.git (fetch)
origin https://git-main.smartphotonics.io/DMassella/sp_brew.git (push)
Before starting new work or pushing changes, always pull the latest changes from the remote:
git pull origin main # Or 'master', depending on your main branch name
Once your changes are committed locally, push them to the remote repository:
git push origin main # Or 'master'
If it's your first time pushing a new local branch, you might need to set the upstream:
git push -u origin <your-new-branch-name>
We use Sphinx to automatically generate project documentation from docstrings and source files.
Make sure all dependencies are installed:
uv sync
(Optional) Regenerate API documentation stubs if you added/removed modules:
From the docs/source
directory, run:
uv run sphinx-apidoc -o . ../../src/sp_brew
Build the HTML documentation:
From the docs/source
directory, run:
uv run sphinx-build -b html . ../build
The generated HTML files will be in docs/build
. Open docs/build/index.html
in your browser to view the documentation.
We welcome contributions! Please follow these steps:
git checkout -b feature/your-feature-name
).uv run pytest
).uv run pre-commit
).git commit -m 'feat: Add new awesome feature'
).git push origin feature/your-feature-name
).This project is an internal SMART photonics project, all content must be considered confidentials and should not be shared externally. If you are not the intended recipient of this package, please return contact the administrator and delete and destroy all copies.
If you have any questions or issues, please open an issue on the Gitea repository or contact damiano.massella@smartphotonics.nl or the DE team.
FAQs
Module to visualize and extract information from raw data
We found that sp-brew demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.