Skip to content

FAQ: Installation for contributing #6840

Open

Description

@rluedde

On this page, it says to fork, clone and get to hacking away. On this page (in "Obtaining the source") it says to clone directly from the unforked repo to be able to run tests. How do run tests on your own fork if the unforked repo is the one that is set up for testing?

What am I missing here? Also, is this the right way to ask questions?

Activity

  1. bashtage commented on Jul 1, 2020

    @bashtage
    Member

    To develop you should

    1. Fork statsmodels
    2. Clone your fork, e.g, git clone [email protected]:bashtage/statsmodels.git for me
    3. Enter the statsmodels directory, cd statsmodels
    4. Add upstream, git remote add upstream https://github.com/statsmodels/statsmodels.git
    5. Fetch everything, get fetch --all
    6. Check out your new feature branch, git checkout -b meaningful-name-for-new-feature
    7. Build and install statsmodels in development branch using pip install -e . --no-build-isolation
    8. Add code and tests to your new branch. If you change C or Cython you will need to rebuild with pip or using python setup.py build_ext -i
    9. Run tests using pytest statsmodels or a specific test location or file, e.g., pytest statsmodels/discrete/tests/
    10. Push your new branch to your fork
    11. Open a PR to statsmodels.

    Edited with a few more steps.

  2. bashtage commented on Jul 1, 2020

    @bashtage
    Member

    Your fork will be identical to the repo when you fork. Over time it will diverge. I frequently run

    git checkout master
    git fetch --all
    git rebase upstream/master
    git push
    

    to keep my fork's master in sync with statsmodels.

  3. rluedde commented on Jul 1, 2020

    @rluedde
    Author

    So in order to use pytest, you would do pip install -e on your cloned, forked copy and NOT a copy cloned directly from statsmodels?

    As a developer, would you need to be building whenever any change is made or do you only worry about invoking the compiler when a change is made to a C/Cython file?

  4. bashtage commented on Jul 1, 2020

    @bashtage
    Member

    I use

    pip install -e . --no-build-isolation
    

    from the repo root. This assumes the environment you are working in has the core requirements already installed, but is much faster than using build isolation.

    You will always need a compiler to develop, even if you don't touch C or Cython. It is pretty easy to get one installed on any of the big 3 platforms these days though.

  5. rluedde commented on Jul 1, 2020

    @rluedde
    Author

    The core requirements being NumPy, SciPy, pandas, etc?

    Will you ever have to do anything with the compiler directly or will it just run in the background whenever you run something?

    Everything is falling into place. Thanks, Kevin.

  6. bashtage commented on Jul 1, 2020

    @bashtage
    Member

    The core requirements being NumPy, SciPy, pandas, etc?

    Yes, plus Cython and patsy.

    Will you ever have to do anything with the compiler directly or will it just run in the background whenever you run something?

    Should always be automatic.

  7. changed the title [-]Installation for contributing[/-] [+]FAQ: Installation for contributing[/+] on Jul 2, 2020
  8. bashtage commented on Jul 2, 2020

    @bashtage
    Member

    I'm going to close this as answered; please feel free to post more here if needed.

  9. rluedde commented on Jul 6, 2020

    @rluedde
    Author

    What should an Anaconda environment look like for developing statsmodels? Should you just worry about installing dependencies before working on a branch?

    Something like a conda create -n sm_dev numpy scipy pandas patsy cython? Is it a good idea to declare versions for all of these packages to ensure that you meet the minimum dependencies?

  10. bashtage commented on Jul 6, 2020

    @bashtage
    Member

    Install anaconda (I use miniconda personally).

    conda install statsmodels cython ipython pytest matplotlib
    conda uninstall statsmodels
    cd ~/git/statsmodels <or whereever>
    pip install -e . --no-build-isolation
    
  11. rluedde commented on Jul 7, 2020

    @rluedde
    Author

    @bashtage It looks like the flag is --no-build-isolation.

    Also it looks like conda uninstall statsmodels uninstalls scipy which caused me big errors come build time. Running conda install scipy after sm uninstallation fixed the problem.

  12. bashtage commented on Jul 7, 2020

    @bashtage
    Member

    That is right.

  13. added this to the 0.12 milestone on Jul 27, 2020
  14. josef-pkt commented on Aug 3, 2023

    @josef-pkt
    Member

    We keep it open as FAQ
    (I need it once a year)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions