Contributing Guide
We welcome contributions to improve and extend the OVSAM and RWKV-SAM projects. This guide provides instructions on how to set up your development environment and run tests.
Development Setup
This project uses Poetry to manage dependencies. Follow these steps to set up your local development environment.
-
Fork and Clone the Repository: First, fork the repository on GitHub, then clone your fork to your local machine.
git clone https://github.com/YOUR-USERNAME/ovsam.git cd ovsam
-
Install Dependencies: Assuming you have completed the main Installation steps within a conda environment, you can install the additional development dependencies using Poetry.
# Install poetry if you don't have it # pip install poetry # Install project dependencies, including the 'dev' group poetry install --with dev
This command will install packages like
pytest
,pytest-cov
, andpytest-mock
which are required for running the test suite.
Running Tests
We use pytest
for running our test suite. The tests are located in the /tests
directory and are categorized into unit
and integration
tests.
To run all tests, execute the following command from the project root:
poetry run pytest
Test Configuration
The pytest
configuration is defined in the pyproject.toml
file under the [tool.pytest.ini_options]
section. Key settings include:
testpaths
: Specifies that tests are located in thetests/
directory.python_files
: Defines the naming convention for test files (test_*.py
,*_test.py
).markers
: Registers custom markers likeunit
,integration
, andslow
to categorize tests.
You can run specific categories of tests using markers:
# Run only unit tests
poetry run pytest -m unit
# Run tests that are not marked as slow
poetry run pytest -m "not slow"
Coverage
To run tests and generate a code coverage report, you can use pytest-cov
:
poetry run pytest --cov
The coverage configuration in pyproject.toml
specifies which source directories (projects
, seg
, ext
) to include and which files to omit.
Submitting a Contribution
- Create a new branch for your feature or bug fix.
- Make your changes and ensure all tests pass.
- Write new tests for any new functionality you add.
- Submit a Pull Request (PR) to the main repository with a clear description of your changes.