Skip to content

Latest commit

 

History

History
84 lines (53 loc) · 2.76 KB

CONTRIBUTING.md

File metadata and controls

84 lines (53 loc) · 2.76 KB

Contributing to marginaleffects for Python

Thank you for your interest in contributing to the marginaleffects Python project!

This document outlines guidelines and instructions for setting up the development environment, running tests, and ensuring your code follows the project standards.

Development Environment

We manage the development environment using uv for dependency management, task execution, and testing. All necessary information is in the .toml and .lock files, and uv will handle dependency management automatically.

Setting Up the Environment

Clone the repository

git clone git@github.com:vincentarelbundock/pymarginaleffects.git
cd pymarginaleffects

Create and activate the virtual environment using uv:

uv venv .venv
source .venv/bin/activate.sh

Install the project and its dependencies:

uv pip install .

Running Tests

We use pytest for testing. The testing environment is fully managed by uv. To run the tests, simply execute:

uv run --all-extras pytest

uv will automatically install any missing dependencies before running the tests.

Code Formatting and Linting

This project follows strict code formatting and linting rules enforced by ruff. Before submitting any code, make sure to run ruff to format your files and check for linting errors.

You can run ruff by executing:

uv run --all-extras ruff check marginaleffects
uv run --all-extras ruff format marginaleffects

Make sure there are no linting errors before submitting your changes.

Contribution Guidelines

  1. Be nice!
  2. Fork the repository and create a new branch for your feature or bugfix.
  3. Ensure all your changes are well-documented in the code, documentation, and changelog (if necessary).
  4. Write tests for any new functionality or changes you make.
  5. Run the tests and ensure everything passes before submitting your pull request.
  6. Ensure your code is formatted and linted using ruff.
  7. Push your changes to your forked repository.
  8. Create a pull request (PR) on the main repository.
  9. Make sure to include a clear description of your changes and reference any related issues (if applicable).

We appreciate your contributions and look forward to reviewing your pull requests!

Documentaion Guidelines

  • Follow the Numpydoc docstring style for the documentation, see link

Makefile

The marginaleffects repository includes a Makefile to facilitate some common tasks.

Windows

  1. Install make for Windows https://gnuwin32.sourceforge.net/packages/make.htm.
  2. Add it to your path variable.
  3. Then you can use scripts specified in the Makefile. e.g. make test