We welcome all contributions to Scrapbook both large and small. We encourage you to join our community.
We are an open and friendly community. Everybody is welcome.
We encourage friendly discussions and respect for all. There are no exceptions.
All contributions are equally important. Documentation, answering questions, and fixing bugs are equally as valuable as adding new features.
Please read our entire code of conduct here. Also, check out the for the Python code of conduct.
Following these instructions should give you an efficient path to opening your first pull-request.
Fork the repository to your local Github account. Clone this repository to your local development machine.
git clone https://github.com/<your_account>/scrapbook
cd scrapbook
We prefer to use conda to manage the development environment.
conda create -n dev
. activate env
or use native venv capabilities if you prefer.
python3 -m venv dev
Install Scrapbook using:
pip install -e .[dev]
Note: When you are finished you can use source deactivate
to go back to your base environment.
We need to install the development package before we can run the tests. If anything is confusing below, always resort to the relevant documentation.
For the most basic test runs against python 3.6 use this tox subset (callable after pip install tox
):
tox -e py36
This will just execute the unittests against python 3.6 in a new virtual env. The first run will take longer to setup the virtualenv, but will be fast after that point.
For a full test suite of all envs and linting checks simply run tox without any arguments
tox
This will require python3.6, python3.7, python3.8 and python3.9 to be installed.
Alternavitely pytest can be used if you have an environment already setup which works or has custom packages not present in the tox build.
pytest --pyargs scrapbook
The pyargs
option allows pytest
to interpret arguments as python package
names. An advantage is that pytest
will run in any directory, and this
approach follows the pytest
[best
practices](https://docs.pytest.org/en/latest/goodpractices.html#tests-as-part-
of-application-code).
Now there should be a working and editable installation of Scrapbook to start making your own contributions.
The general workflow for this will be:
- Run local tests
- Pushed changes to your forked repository
- Open pull request to main repository
Your commits should be pushed to the forked repository. To verify this type
git remote -v
and ensure the remotes point to your GitHub. Don't work on the main branch!
-
Commit changes to local repository:
git checkout -b my-feature git add <updated_files> git commit
-
Push changes to your remote repository:
git push -u origin my-feature
Follow [these](https://help.github.com/articles/creating-a-pull-request- from-a-fork/) instructions to create a pull request from a forked repository. If you are submitting a bug-fix for a specific issue make sure to reference the issue in the pull request.
There are good references to the Git documentation and [Git workflows](https://docs.scipy.org/doc/numpy/dev/gitwash/development_w orkflow.html) for more information if any of this is unfamiliar.
Note: You might want to set a reference to the main repository to fetch/merge from there instead of your forked repository. You can do that using:
git remote add upstream https://github.com/nteract/scrapbook
It's possible you will have conflicts between your repository and main. Here,
main
is meant to be synchronized with the upstream
repository. GitHub has
some good documentation
on merging pull requests from the command line.
- Set up a virtual environment and activate it.
python3 -m venv mydocs
source mydocs/bin/activate
- From the repo's root directory, install dependencies needed for documentation and the development version of Scrapbook:
pip install -r docs/requirements-doc.txt
pip install -e .
- Change to the
docs
directory and clean out any stale documentation builds:
cd docs
make clean
- Build the documentation
make html
If the build succeeds, it will display a message letting you know where to find the documentation:
The HTML pages are in _build/html.
- Serve the documentation locally
python -m http.server
This will return a message letting you know where to direct your browser:
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Happy hacking on Scrapbook!