Skip to content
Open
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ dist
.ipynb_checkpoints/

.coverage
htmlcov/
htmlcov/

.python-version
uv.lock
185 changes: 185 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Contributing to PyFastL2LiR

Thank you for your interest in contributing to PyFastL2LiR! This document provides guidelines and instructions for contributing to the project.

## Table of Contents

- [Getting Started](#getting-started)
- [Development Setup](#development-setup)
- [Making Changes](#making-changes)
- [Testing](#testing)
- [Code Style](#code-style)
- [Submitting Changes](#submitting-changes)

## Getting Started

### Prerequisites

- [uv](https://github.com/astral-sh/uv)

## Development Setup

1. **Fork and clone the repository**

```bash
git clone https://github.com/<USERNAME>/PyFastL2LiR.git
cd PyFastL2LiR
```

2. **Create a virtual environment and install dependencies**

```bash
uv sync
```

This will install the package in editable mode along with all development dependencies.

## Making Changes

1. **Create a new branch for your changes**

```bash
git checkout -b feature/your-feature-name
```

Use descriptive branch names:
- `feature/` for new features
- `fix/` for bug fixes
- `docs/` for documentation changes
- `refactor/` for code refactoring

2. **Make your changes**

- Write clear, concise commit messages
- Keep commits focused and atomic
- Update documentation as needed

## Testing

We use pytest for testing. All tests should pass before submitting a pull request.

### Running Tests

Run all tests:

```bash
pytest
```

Run tests with coverage:

```bash
pytest --cov=fastl2lir --cov-report=term-missing
```

Run specific tests:

```bash
pytest tests/test_specific_module.py
```

### Writing Tests

- Place tests in the `tests/` directory
- Name test files with the `test_` prefix
- Name test functions with the `test_` prefix
- Aim for high test coverage, especially for new features
- Include both unit tests and integration tests where appropriate

## Code Style

We use [Ruff](https://github.com/astral-sh/ruff) for linting and code formatting.

### Running Ruff

Check for linting issues:

```bash
ruff check .
```

Automatically fix issues:

```bash
ruff check --fix .
```

Format code:

```bash
ruff format .
```

### Before Committing

Make sure your code passes both linting and formatting checks:

```bash
ruff check . && ruff format --check .
```

## Submitting Changes

1. **Ensure all tests pass**

```bash
pytest
```

2. **Ensure code passes linting**

```bash
ruff check .
ruff format --check .
```

3. **Commit your changes**

```bash
git add .
git commit -m "[tag] Brief description of your changes"
```

Write clear commit messages following these guidelines:
- Use the imperative mood ("Add feature" not "Added feature")
- Provide additional details in the body if needed

4. **Push to your fork**

```bash
git push origin feature/your-feature-name
```

5. **Create a Pull Request**

- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Provide a clear description of your changes
- Reference any related issues

### Pull Request Guidelines

- Provide a clear description of the problem and solution
- Include relevant issue numbers (e.g., "Fixes #123")
- Ensure CI checks pass
- Respond to review comments promptly
- Keep pull requests focused on a single feature or fix

## Code Review Process

- Maintainers will review your pull request
- Address any requested changes
- Once approved, your changes will be merged

## Questions?

If you have questions or need help, feel free to:
- Open an issue on GitHub
- Reach out to the maintainers

## License

By contributing to PyFastL2LiR, you agree that your contributions will be licensed under the same license as the project.

Thank you for contributing!
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[project]
name = "fastl2lir"
version = "0.10"
description = "Fast L2-reguralized linear regression"
readme = "README.md"
authors = [
{ name = "Kei Majima", email = "[email protected]" }
]
maintainers = [
{ name = "Shuntaro C. Aoki", email = "[email protected]" },
{ name = "Yoshihiro Nagano", email = "[email protected]" }
]
license = { file = "LICENSE" }
requires-python = ">=3.1"
dependencies = [
"numpy>=1.16.6",
"threadpoolctl>=2.1.0 ; python_full_version >= '3.5'",
"tqdm>=4.64.1",
]
[project.urls]
Homepage = "https://github.com/KamitaniLab/PyFastL2LiR"
Repository = "https://github.com/KamitaniLab/PyFastL2LiR"
"Bug Tracker" = "https://github.com/KamitaniLab/PyFastL2LiR/issues"

[build-system]
requires = ["uv_build>=0.8.22,<0.9.0"]
build-backend = "uv_build"

[dependency-groups]
dev = [
"pytest>=4.6.11",
"ruff>=0.0.17",
]
14 changes: 0 additions & 14 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
Empty file added src/fastl2lir/py.typed
Empty file.
12 changes: 6 additions & 6 deletions test.py → tests/test_fastl2lir.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestFastL2LiR(TestCase):
def test_basic(self):
'''Basic Test.'''

data = np.load('./test/testdata_basic.npz')
data = np.load('./tests/testdata_basic.npz')

model_1d = fastl2lir.FastL2LiR()
model_2d = fastl2lir.FastL2LiR()
Expand All @@ -38,7 +38,7 @@ def test_basic(self):
def test_alpha(self):
'''Test for alpha.'''

data = np.load('./test/testdata_alpha01.npz')
data = np.load('./tests/testdata_alpha01.npz')

model_1d = fastl2lir.FastL2LiR()
model_2d = fastl2lir.FastL2LiR()
Expand All @@ -60,7 +60,7 @@ def test_alpha(self):
def test_nfeat(self):
'''Test for n_feat.'''

data = np.load('./test/testdata_nfeat.npz')
data = np.load('./tests/testdata_nfeat.npz')

model_1d = fastl2lir.FastL2LiR()
model_2d = fastl2lir.FastL2LiR()
Expand All @@ -82,7 +82,7 @@ def test_nfeat(self):
def test_nfeat_no_feature_selection(self):
'''Test for n_feat when X.shape[1] < n_feat (more samples than features).'''

data = np.load('./test/testdata_basic.npz')
data = np.load('./tests/testdata_basic.npz')

model_1d = fastl2lir.FastL2LiR()
model_2d = fastl2lir.FastL2LiR()
Expand All @@ -104,7 +104,7 @@ def test_nfeat_no_feature_selection(self):
def test_nfeat_no_feature_selection_wide(self):
'''Test for n_feat when X.shape[1] < n_feat (more features than samples).'''

data = np.load('./test/testdata_wide.npz')
data = np.load('./tests/testdata_wide.npz')

model_1d = fastl2lir.FastL2LiR()
model_2d = fastl2lir.FastL2LiR()
Expand All @@ -126,7 +126,7 @@ def test_nfeat_no_feature_selection_wide(self):
def test_chunk(self):
'''Test for chunk_size.'''

data = np.load('./test/testdata_chunk.npz')
data = np.load('./tests/testdata_chunk.npz')

model_2d = fastl2lir.FastL2LiR()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.