diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index fa207711..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,131 +0,0 @@ -# Contributing to pulse2percept - -Welcome to the pulse2percept repository! We're excited you're here and want to contribute. - -These guidelines are designed to make it as easy as possible to get involved. If you have any questions that aren't discussed below, please let us know by opening an [issue][link_issues]! - -Before you start you'll need to set up a free [GitHub][link_github] account and sign in. Here are some [instructions][link_signupinstructions]. - -Already know what you're looking for in this guide? Jump to the following sections: -* [Understanding issue labels](#issue-labels) -* [Making a change](#making-a-change) -* [Notes for new code](#notes-for-new-code) -* [Recognizing contributions](#recognizing-contributions) - -## Issue labels - -The current list of issue labels are [here][link_labels] and include: - -* [![Bugs](https://img.shields.io/badge/-bugs-fc2929.svg)][link_bugs] *These issues point to problems in the project.* - - If you find new a bug, please provide as much information as possible to recreate the error. - The issue template will automatically populate any new issue you open, and contains information we've found to be helpful in addressing bug reports. - Please fill it out to the best of your ability! - - If you experience the same bug as one already listed in an open issue, please add any additional information that you have as a comment. - -* [![Help Wanted](https://img.shields.io/badge/-help%20wanted-c2e0c6.svg)][link_helpwanted] *These issues contain a task that a member of the team has determined we need additional help with.* - - If you feel that you can contribute to one of these issues, we especially encourage you to do so! - Issues that are also labelled as [good-first-issue][link_good_first_issue] are a great place to start if you're looking to make your first contribution. - -* [![Enhancement](https://img.shields.io/badge/-enhancement-00FF09.svg)][link_enhancement] *These issues are asking for new features to be added to the project.* - - Please try to make sure that your requested enhancement is distinct from any others that have already been requested or implemented. - If you find one that's similar but there are subtle differences, please reference the other request in your issue. - -## Making a change - -We appreciate all contributions to pulse2percept, but those accepted fastest will follow a workflow similar to the following: - -**1. Comment on an existing issue or open a new issue referencing your addition.** - -This allows other members of the pulse2percept development team to confirm that you aren't overlapping with work that's currently underway and that everyone is on the same page with the goal of the work you're going to carry out. - -[This blog][link_pushpullblog] is a nice explanation of why putting this work in up front is so useful to everyone involved. - -**2. [Fork][link_fork] the [pulse2percept repository][link_p2p] to your profile.** - -This is now your own unique copy of the pulse2percept repository. -Changes here won't affect anyone else's work, so it's a safe space to explore edits to the code! - -You can clone your pulse2percept repository in order to create a local copy of the code on your machine. -To install your version of pulse2percept, and the dependencies needed for development, -in your Python environment, run `pip install -e ".[dev]"` from your local pulse2percept -directory. - -Make sure to keep your fork up to date with the original puls2percept repository. -One way to do this is to [configure a new remote named "upstream"](https://help.github.com/articles/configuring-a-remote-for-a-fork/) - and to [sync your fork with the upstream repository][link_updateupstreamwiki]. - -**3. Make the changes you've discussed.** - -When you are working on your changes, test frequently to ensure you are not breaking the existing code. - -It's a good practice to create [a new branch](https://help.github.com/articles/about-branches/) -of the repository for a new set of changes. - - -**4. Submit a [pull request][link_pullrequest].** - -A new pull request for your changes should be created from your fork of the repository. - -When opening a pull request, please use one of the following prefixes: - -* **[ENH]** for enhancements -* **[FIX]** for bug fixes -* **[TST]** for new or updated tests -* **[DOC]** for new or updated documentation -* **[STY]** for stylistic changes -* **[REF]** for refactoring existing code - -
-Pull requests should be submitted early and often (please don't mix too many unrelated changes within one PR)! -If your pull request is not yet ready to be merged, please also include the **[WIP]** prefix (you can remove it once your PR is ready to be merged). -This tells the development team that your pull request is a "work-in-progress", and that you plan to continue working on it. - -Review and discussion on new code can begin well before the work is complete, and the more discussion the better! -The development team may prefer a different path than you've outlined, so it's better to discuss it and get approval at the early stage of your work. - -One your PR is ready a member of the development team will review your changes to confirm that they can be merged into the main codebase. - -## Notes for New Code - -#### Testing -New code should be tested, whenever feasible. -Bug fixes should include an example that exposes the issue. -Any new features should have tests that show at least a minimal example. -If you're not sure what this means for your code, please ask in your pull request. - -## Recognizing contributions - -We welcome and recognize all contributions from documentation to testing to code development. - -## Thank you! - -You're awesome. :wave::smiley: - -
- -*— Based on contributing guidelines from the [Nipype][link_nipype] project.* - -[link_github]: https://github.com/ -[link_pulse2percept]: https://github.com/uwescience/pulse2percept -[link_signupinstructions]: https://help.github.com/articles/signing-up-for-a-new-github-account -[link_react]: https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments -[link_issues]: https://github.com/nipy/pulse2percept/issues -[link_labels]: https://github.com/nipy/pulse2percept/labels -[link_discussingissues]: https://help.github.com/articles/discussing-projects-in-issues-and-pull-requests - -[link_bugs]: https://github.com/nipy/pulse2percept/labels/bug -[link_helpwanted]: https://github.com/nipy/pulse2percept/labels/help-wanted -[link_good_first_issue]: https://github.com/nipy/pulse2percept/issues?q=is%3Aopen+is%3Aissue+label%3Agood-first-issue -[link_enhancement]: https://github.com/nipy/pulse2percept/labels/enhancement - -[link_pullrequest]: https://help.github.com/articles/creating-a-pull-request-from-a-fork/ -[link_fork]: https://help.github.com/articles/fork-a-repo/ -[link_pushpullblog]: https://www.igvita.com/2011/12/19/dont-push-your-pull-requests/ -[link_updateupstreamwiki]: https://help.github.com/articles/syncing-a-fork/ - -[link_cloning]: https://help.github.com/articles/cloning-a-repository/ -[link_nipype]: https://github.com/nipy/nipype diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..783a13d0 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,351 @@ +============================= +Contributing to pulse2percept +============================= + +.. note:: + + If you found a bug or want to request a feature, please open an issue in our + `Issue Tracker`_ on GitHub. Make sure to + :ref:`label your issue appropriately `. + +We are excited that you are here and want to contribute! +If you have any questions that aren't discussed below, please let us know +by opening an issue in our `Issue Tracker`_ on GitHub. + +.. _Issue Tracker: https://github.com/pulse2percept/pulse2percept/issues + +Already know what you're looking for in this guide? Jump to the following +sections: + +* `Recommended workflow`_ +* `Understanding issue labels`_ +* `Contributing code`_ +* `Testing your code`_ + +.. _dev-contributing-workflow: + +Recommended workflow +==================== + +We appreciate all contributions, but those accepted fastest will follow a +workflow similar to the following: + +1. **GitHub account**: + Before getting started, you will need to set up a free `GitHub account`_. + +2. **Claim an issue on GitHub**: + Check the `Issue Tracker`_ to find an issue you want to work on (look for + issues labeled `good-first-issue`_ or `help-wanted`_), and add a comment + announcing your intention to work on it. + If no such issue exists, create a new one (see + `Understanding issue labels`_). + This allows other members of the development team to confirm that you + aren't overlapping with existing work and that everyone is on the same page + with the goal of your proposed work. + +3. **Fork the repo**: + Follow the :ref:`Installation Guide ` to fork the repo and + install all developer dependencies. Make sure to keep your code up-to-date + with the :ref:`upstream repository `. + This is now your own unique pulse2percept copy - changes here won't affect + anyone else's work. + +4. **Create a new branch**: + You should always work on a `new branch`_. "git add" and "git commit" the + work you proposed to do, and "git push" it to your remote repository on + GitHub. + + .. important:: + + All code additions must be :ref:`documented ` and + :ref:`tested `. + See `Contributing code`_ below for more detailed instructions. + +5. **Submit a pull request**: + When opening a `pull request`_ (PR) against the pulse2percept master branch, + please use one of the following prefixes: + + * **[ENH]** for enhancements + * **[FIX]** for bug fixes + * **[TST]** for new or updated tests + * **[DOC]** for new or updated documentation + * **[STY]** for stylistic changes + * **[REF]** for refactoring existing code + + Once your PR is ready, request a review from `@arokem`_ and/or + `@mbeyeler`_, who will review your changes before merging them into the + main codebase. + + .. note:: + + If your PR is not yet ready to be merged, also add the **[WIP]** prefix + to label it as a "work in progress". + +.. _GitHub account: https://help.github.com/articles/signing-up-for-a-new-github-account +.. _good-first-issue: https://github.com/pulse2percept/pulse2percept/labels/good-first-issue +.. _help-wanted: https://github.com/pulse2percept/pulse2percept/labels/help-wanted +.. _new branch: https://help.github.com/articles/about-branches +.. _pull request: https://help.github.com/articles/creating-a-pull-request-from-a-fork/ +.. _@arokem: https://github.com/arokem +.. _@mbeyeler: https://github.com/mbeyeler + +.. _dev-contributing-issue-labels: + +Understanding issue labels +========================== + +Make sure to check out the current list of `issue labels`_: + +* .. image:: https://img.shields.io/badge/-bug-fc2929.svg + :target: https://github.com/pulse2percept/pulse2percept/labels/bug + :alt: Bug + :align: left + + *These issues point to problems in the project.* + + If you find new a bug, please provide as much information as possible to + recreate the error. + The issue template will automatically populate any new issue you open, and + contains information we've found to be helpful in addressing bug reports. + Please fill it out to the best of your ability! + + .. note:: + + If you experience the same bug as one already listed in an open issue, + please add any additional information that you have as a comment. + +* .. image:: https://img.shields.io/badge/-enhancement-00FF09.svg + :target: https://github.com/pulse2percept/pulse2percept/labels/enhancement + :alt: Enhancement + :align: left + + *These issues are asking for new features to be added to the project.* + + Please try to make sure that your requested enhancement is distinct from + any others that have already been requested or implemented. + + .. note:: + + If you find one that's similar but there are subtle differences, please + reference the other request in your issue. + +* .. image:: https://img.shields.io/badge/-help%20wanted-c2e0c6.svg + :target: https://github.com/pulse2percept/pulse2percept/labels/help-wanted + :alt: Help wanted + :align: left + + *These issues contain a task that a member of the team has determined we + need additional help with.* + + If you feel that you can contribute to one of these issues, we especially + encourage you to do so! + + .. note:: + + Issues that are also labelled as `good first issue`_ are a great place + to start if you're looking to make your first contribution. + +.. _issue labels: https://github.com/pulse2percept/pulse2percept/labels +.. _good first issue: https://github.com/pulse2percept/pulse2percept/issues?q=is%3Aopen+is%3Aissue+label%3Agood-first-issue + +Contributing code +================= + +Perform all your work on a `new branch`_ of the repository. For example, +say you want to add "feature1" to the latest version of pulse2percept: + +1. Make sure you have the latest code: + + .. code-block:: bash + + git checkout master + git pull upstream master + + .. note:: + + If you get an error saying "upstream does not appear to be a git + repository", you need to run the following command first: + ``git remote add upstream https://github.com/pulse2percept/pulse2percept.git`` + +2. Create a new branch (aptly named "feature1" or similar): + + .. code-block:: bash + + git checkout -b feature1 + +3. Add and commit your changes to this branch. Then push it to your remote + repository on GitHub: + + .. code-block:: bash + + git push origin feature1 + + .. important:: + + All code additions must be :ref:`documented ` and + :ref:`tested `. + +4. Go to GitHub and `submit a pull request`_: + + 1. Click on "compare across forks" at the top of the page. + + 2. Choose "pulse2percept/pulse2percept" as the base repository and "master" + as the base branch. + + 3. Choose "/pulse2percept" as the head repository and "feature1" + as the compare branch, where "" is your GitHub user name. + + 4. Click on "Create pull request" and describe the work you have done. + Make sure to mention the issue number you are addressing (use # as + prefix). + + An easy way to list all the things you changed is to use a list of + checkboxes (type ``- [X]``; or ``- [ ]`` for an item that has yet to be + implemented). + +.. _submit a pull request: https://github.com/pulse2percept/pulse2percept/compare + +.. _dev-contributing-doc: + +Documenting your code +===================== + +You are expected to document your code using `NumPy docstrings`_. +Make sure to: + +* supply short and long descriptions, +* describe all input arguments to a function/method, +* describe the output of a function/method, +* provide examples of how to use your code. + +For example, consider an appropriate docstring for a hypothetical function +``rad2deg``: + +.. code-block:: python + + def rad2deg(angle_rad): + """Converts radians to degrees + + This function converts an angle in radians to degrees. + + Parameters + ---------- + angle_rad : int, float + The input angle in radians + + Returns + ------- + angle_deg : float + The corresponding angle in degrees + + Examples + -------- + Converting pi to degrees: + >>> import numpy as np + >>> rad2deg(np.pi) + 180.0 + + .. seealso:: `deg2rad` + """ + ... + +You can generate the documentation yourself using Sphinx. From the root directory +of your git clone, type: + +.. code-block:: bash + + cd doc + pip3 install -r requirements.txt + make html + google-chrome _build/html/index.html + +This will build the documentation in "doc/_build/html". +To see the documentation, use the above command or open "doc/_build/html/index.html" +in your browser of choice. + +.. _NumPy docstrings: https://numpydoc.readthedocs.io/en/latest/format.html + +.. _dev-contributing-test: + +Testing your code +================= + +You are expected to test your code using `pytest`_: + +* Bug fixes should include an example that exposes the issue. + +* New features should have tests that show at least a minimal example. + +Running the test suite +---------------------- + +pulse2percept uses `pytest`_ and `numpy-testing`_ for testing. + +Every subpackage of pulse2percept (e.g., :py:mod:`~pulse2percept.stimuli`) +has a subdirectory called "tests". +Within the test directory, there is a "test_.py" file for every +subsubpackage of pulse2percept (e.g., +"pulse2percept/stimuli/tests/test_pulse_trains.py" for +:py:mod:`~pulse2percept.stimuli.pulse_trains`). + +When you contribute new code, you are expected to test your code in the +corresponding test file. + +You can run the test suite with: + +.. code-block:: bash + + pip3 install -r requirements-dev.txt + pytest --doctest-modules --showlocals -v pulse2percept + +Successful tasks will be marked with "PASSED", unsuccessful ones with "FAILED". +We will usually not accept pull requests that don't pass all tests. + +.. _pytest: https://pytest.org +.. _numpy-testing: https://docs.scipy.org/doc/numpy/reference/routines.testing.html + +Writing your own tests +---------------------- + +If you work on code from an existing subpackage (e.g., +:py:mod:`pulse2percept.stimuli.pulse_trains`), open the corresponding test file +(e.g., "pulse2percept/stimuli/tests/test_pulse_trains.py"). + +You can add a new test by adding a function whose name starts with "test\_", +followed by the name of the class or function you want to test. +For example: + +* ``def test_TimeSeries`` for testing the + :py:class:`~pulse2percept.stimuli.TimeSeries` object (note that this + function already exists). +* ``def test_TimeSeries_resample`` for testing the + :py:meth:`~pulse2percept.stimuli.TimeSeries.resample` method of the + :py:class:`~pulse2percept.stimuli.TimeSeries` object. +* ``def test_newfunc`` for a new function called ``newfunc``. + +Within this function, you want to make sure your code works as expected. +Useful `numpy-testing`_ routines for achieving this include: + +* ``assert_equal(actual, desired)`` returns an ``AssertionError`` if two + objects are not equal. +* ``assert_almost_equal(actual, desired, decimal=7)`` returns an + ``AssertionError`` if two items are not equal up to desired precision + (good for testing doubles). +* ``assert_raises(exception_class)`` fails unless an ``Exception`` of class + ``exception_class`` is thrown. + +In addition, we provide +:py:meth:`~pulse2percept.utils.testing.assert_warns_msg` to ensure that a +specific warning message is thrown. + +.. seealso:: :ref:`Tutorial: Writing your own test case ` + +Thank you +========= + +You are awesome! + +*This guide is based on contributing guidelines from the `Nipype`_ project.* + +.. _Nipype: https://github.com/nipy/nipype + diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..02097038 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,60 @@ +trigger: + # Whenever someone pushes to master: + branches: + include: + - master + # Whenever a tag is pushed: + tags: + include: + - v* + +pr: +- master +- develop + +variables: + # Install p2p in Docker container + install_p2p: "pip install -r requirements.txt && pip install -e ." + CIBW_BEFORE_BUILD: $(install_p2p) + # On Linux, need to install Matplotlib depedencies in Docker container: + CIBW_BEFORE_BUILD_LINUX: "yum -y install freetype-devel pkg-config libpng-devel && $(install_p2p)" + # Skip building on Python 2.7 and 3.8 on all platforms + CIBW_SKIP: "cp27-* cp38-*" + +jobs: +- job: linux + pool: {vmImage: 'Ubuntu-16.04'} + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: 3.5 + - bash: | + python -m pip install --upgrade pip + pip install cibuildwheel==1.0.0 + cibuildwheel --output-dir wheelhouse . + - task: PublishBuildArtifacts@1 + inputs: {pathtoPublish: 'wheelhouse'} +- job: macos + pool: {vmImage: 'macOS-10.13'} + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: 3.5 + - bash: | + python -m pip install --upgrade pip + pip install cibuildwheel==1.0.0 + cibuildwheel --output-dir wheelhouse . + - task: PublishBuildArtifacts@1 + inputs: {pathtoPublish: 'wheelhouse'} +- job: windows + pool: {vmImage: 'vs2017-win2016'} + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: 3.5 + - bash: | + python -m pip install --upgrade pip + pip install cibuildwheel==1.0.0 + cibuildwheel --output-dir wheelhouse . + - task: PublishBuildArtifacts@1 + inputs: {pathtoPublish: 'wheelhouse'} diff --git a/doc/developers/contributing.rst b/doc/developers/contributing.rst new file mode 100644 index 00000000..094ea237 --- /dev/null +++ b/doc/developers/contributing.rst @@ -0,0 +1,3 @@ +.. _dev-contributing: + +.. include:: ../../CONTRIBUTING.rst diff --git a/doc/developers/releases.rst b/doc/developers/releases.rst new file mode 100644 index 00000000..b7b22a56 --- /dev/null +++ b/doc/developers/releases.rst @@ -0,0 +1,41 @@ +.. _dev-releases: + +===================== +Cutting a new release +===================== + +pulse2percept wheels are built using Azure Pipelines to support the following: + +- Python 3.5 - 3.7 +- Linux: manylinux1, manylinux2010 for i686 and x86_64 +- macOS: OS X 10.6 and up +- Windows: Server 2016 with VS 2017 for win-32 and amd64 (closes issue #88) + +Wheels are built using the `cibuildwheel`_ package. Once their `PR194`_ is merged, +we can start automating the PyPI upload whenever a tag is pushed using GitHub Actions. + +Until then, the artifacts need to be downloaded from Azure Pipelines. +The following recipe will upload the files to PyPI: + +.. code-block:: python + + cd pulse2percept + + # Clear out your 'dist' folder. + rm -rf dist + # Make a source distribution + python setup.py sdist + + # Go and download your wheel files from wherever you put them. e.g. your CI + # provider can be configured to store them for you. Put them all into the + # 'dist' folder. + wget ... + + # Upload using 'twine' (you may need to 'pip install twine') + twine upload dist/* + + # Or for TestPyPI: + twine upload --repository-url https://test.pypi.org/legacy/ dist/* + +.. _cibuildwheel: https://github.com/joerick/cibuildwheel +.. _PR194: https://github.com/joerick/cibuildwheel/pull/194 diff --git a/doc/index.rst b/doc/index.rst index 755edf62..035c02e7 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,4 +1,21 @@ -pulse2percept: Models for Sight Restoration +.. toctree:: + :caption: User Guide + :hidden: + :maxdepth: 1 + + Overview + install + reference/index + +.. toctree:: + :caption: Developer Guide + :hidden: + :maxdepth: 1 + + developers/contributing + developers/releases + +pulse2percept: Models for sight restoration =========================================== By 2020 roughly 200 million people worldwide will suffer from retinal @@ -126,18 +143,6 @@ outlines, or experience temporary disappearances if the object moves too fast. Simulations such as these, which provide an insight into the perceptual outcomes of prosthetic vision, are likely to be critical for providing realistic estimates of prosthetic vision, providing regulatory bodies with guidance into what sort of visual tests are appropriate for evaluating prosthetic performance, and improving current and future technology. - - - - - .. toctree:: - :maxdepth: 2 - - installation_guide - auto_examples/index - reference/index - - .. figure:: _static/eScience_Logo_HR.png :align: center :figclass: align-center diff --git a/doc/install.rst b/doc/install.rst new file mode 100644 index 00000000..d76ace34 --- /dev/null +++ b/doc/install.rst @@ -0,0 +1,261 @@ +.. _install: + +============ +Installation +============ + +pulse2percept is in active development. +To get the latest stable version, we recommend installing our +:ref:`latest release `. +If you wish to contribute to the project or require +the bleeding-edge version, you will want to install +:ref:`from source ` instead. + +.. note:: + + Having trouble with the installation? + Please refer to our :ref:`Troubleshooting Guide `. + +.. _install-prerequisites: + +Prerequisites +============= + +* **Python** (3.5 - 3.7): Before getting started, you will need to have to + `install Python`_ on your computer. Check if Python is installed on your + system by typing ``python --version`` in a terminal or command prompt. + + .. important:: + + pulse2percept 0.4.3 was the last release to support Python 2.7 and 3.4. + pulse2percept 0.5+ will require **Python 3.5 - 3.7**. + +* **Cython** (>= 0.28): pulse2percept relies on C extension modules for code + acceleration. These require a C compiler, which on Unix platforms is + already installed (``gcc``). However, on Windows you will have to install a + compiler yourself: + + 1. Install **Build Tools for Visual Studio 2019** from the + `Microsoft website`_. + Note that the build tools for Visual Studio 2015 or 2017 should work as + well (Python >= 3.5 requires C++ 14.X to be exact). + Also note that you don't need to install Visual Studio itself. + + 2. `Install Cython`_: + + .. code-block:: bash + + pip3 install Cython + + If you get an error saying ``unable to find vcvarsall.bat``, then there + is a problem with your Build Tools installation, in which case you + should follow `this guide`_. + + .. warning:: + + Some guides on the web tell you to install MinGW instead of Visual Studio. + However, this is not recommended for 64-bit platforms. + When in doubt, follow `this guide`_. + +.. _install Python: https://wiki.python.org/moin/BeginnersGuide/Download +.. _Microsoft website: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019 +.. _Install Cython: https://cython.readthedocs.io/en/latest/src/quickstart/install.html +.. _this guide: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows + +.. _install-release: + +Installing a release +==================== + +After taking care of the :ref:`prerequisites `, +the latest pulse2percept release can be installed using pip: + +.. code-block:: bash + + pip3 install pulse2percept + +Then from any Python console or script, try: + +.. code-block:: python + + import pulse2percept as p2p + +.. _install-source: + +Installing from source +====================== + +.. _install-source-prerequisites: + +Prerequisites +------------- + +**Git**: On Unix, you can install git from the `command line`_. On Windows, +make sure to download `Git for Windows`_. + +.. _command line: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git +.. _Git for Windows: https://gitforwindows.org + +Dependencies +------------ + +**pulse2percept 0.4.3 was the last version to support Python 2.7 and 3.4. pulse2percept 0.5+ require Python 3.5 or newer.** + +pulse2percept requires: + +- Python (3.5 - 3.7) +- Cython (>= 0.28) +- NumPy (>= 1.9) +- SciPy (>= 1.0) +- Matplotlib (>= 2.0) +- JobLib (>= 0.11) + +Optional packages: + +- scikit-image for image functionality in the ``files`` module. +- scikit-video for video functionality in the ``files`` module. You will also need an FFMPEG codec (see next bullet point). +- ffmpeg codec if you're on Windows and want to use functions in the ``files`` module. +- Dask for parallel processing (a joblib alternative). Use ``conda`` to install. +- Numba for just-in-time compilation. Use ``conda`` to install. +- Pytest to run the test suite. + +All required packages are listed in requirements.txt in the root directory of the git repository, and can be installed with the following command: + +.. code-block:: bash + + git clone https://github.com/pulse2percept/pulse2percept.git + cd pulse2percept + pip3 install -r requirements.txt + +Obtaining the latest code from GitHub +------------------------------------- + +1. Go to `pulse2percept on GitHub`_ and click on "Fork" in the top-right + corner (you will need a `GitHub account`_ for this). + This will allow you to work on your own copy of the code + (``https://github.com//pulse2percept``) + and contribute changes later on. + +2. Clone the repository to get a local copy on your computer: + + .. code-block:: bash + + git clone https://github.com//pulse2percept.git + cd pulse2percept + + Make sure to replace ```` above with your actual GitHub user + name. + + .. note:: + + A "fork" is basically a "remote copy" of a GitHub repository; i.e., + creating "https://github.com//pulse2percept.git" from + "https://github.com/pulse2percept/pulse2percept.git". + + A "clone" is basically a "local copy" of your GitHub repository; i.e., + creating a local "pulse2percept" directory (including all the git + machinery and history) from + "https://github.com//pulse2percept.git". + +3. Install all dependencies listed in ``requirements.txt``: + + .. code-block:: bash + + pip3 install -r requirements.txt + + This includes Cython. If you are on Windows, you will also need a suitable + C compiler (see :ref:`Prerequisites ` above). + + If you plan on :ref:`contributing to pulse2percept `, + you should also install all developer dependencies listed in + ``requirements-dev.txt``: + + .. code-block:: bash + + pip3 install -r requirements-dev.txt + +.. _pulse2percept on GitHub: https://github.com/pulse2percept/pulse2percept +.. _GitHub account: https://help.github.com/articles/signing-up-for-a-new-github-account + +Building pulse2percept +---------------------- + +Assuming you are still in the root directory of the git clone, type: + +.. code-block:: bash + + pip3 install -e . + +Then from any Python console or script, try: + +.. code-block:: python + + import pulse2percept as p2p + +.. _install-upgrade: + +Upgrading pulse2percept +======================= + +If you have previously installed pulse2percept, but wish to upgrade to the +latest version, you have two options. + +To upgrade to the latest stable release, use the ``-U`` option with pip: + +.. code-block:: bash + + pip3 install -U pulse2percept + +To upgrade to the bleedingest-edge version, navigate to the directory where you +cloned the git repository. If you have never upgraded your code before, add +a new `remote repository`_ named "upstream" (you need to do this only once): + +.. code-block:: bash + + git remote add upstream https://github.com/pulse2percept/pulse2percept.git + +Then you `sync your fork`_ by grabbing the latest code from the pulse2percept +master branch: + +.. code-block:: bash + + git pull upstream master + +.. _remote repository: https://help.github.com/articles/configuring-a-remote-for-a-fork +.. _sync your fork: https://help.github.com/articles/syncing-a-fork/ + +.. _install-uninstall: + +Uninstalling pulse2percept +========================== + +You can uninstall pulse2percept using pip: + +.. code-block:: python + + pip3 uninstall pulse2percept + +In addition, if you installed :ref:`from source `, you may want +to manually delete the directory where you cloned the git repository that +contains all the source code. + +.. _install-troubleshooting: + +Troubleshooting +=============== + +I'm getting an error in fast_retina.pyx when installing with pip on Windows +--------------------------------------------------------------------------- + +Early builds of pulse2percept 0.4 mistakingly omitted the Windows binary +for the Cython-dependent ``fast_retina`` module (see :issue:`88`). +The solution is to either pip install :ref:`a later version `, +or to :ref:`build from source `. + +.. note:: + + Still having trouble? Please `open an issue`_ on GitHub and describe your + problem there. Make sure to mention your platform and whether you are + installing using pip or from source. + +.. _open an issue: https://github.com/pulse2percept/pulse2percept/issues diff --git a/requirements.txt b/requirements.txt index b1c4d2ec..7e222eaf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,9 @@ numpy +cython scipy -joblib +matplotlib scikit_image sk_video -cython +joblib dask -numba \ No newline at end of file +numba