Skip to content

Commit 30b4ecd

Browse files
authored
Added guide on how to contribute (#119)
1 parent 72d784a commit 30b4ecd

File tree

3 files changed

+52
-11
lines changed

3 files changed

+52
-11
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Explain the steps needed to test the new code to verify that it does indeed addr
1919
## Checklist
2020
_Put an `x` in the boxes that apply._
2121

22+
- [ ] I have run `flake8` and `black` to make sure the code adheres to PEP-8 and is consistently formatted
2223
- [ ] I have run unit and regression tests which pass locally with my changes
2324
- [ ] I have added new tests that prove my fix is effective or that my feature works
2425
- [ ] I have added necessary documentation

doc/contribute.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
How to Contribute to pyOptSparse
2+
================================
3+
pyOptSparse is an open-source tool, thus we welcome users to submit additions or fixes to the code to make it better for everybody.
4+
5+
Issues
6+
------
7+
If you have an issue with pyOptSparse, a bug to report, or a feature to request, submit an issue on the GitHub repository.
8+
This lets other users know about the issue.
9+
If you are comfortable fixing the issue, please do so and submit a pull request.
10+
11+
Coding style
12+
------------
13+
We use `black <https://github.com/psf/black>`_ for formatting.
14+
Please install it following its documentation, and run it with the command line argument ``-l 120``, for example at the project root directory::
15+
16+
black . -l 120
17+
18+
This will automatically format all Python files.
19+
20+
We use `flake8 <https://flake8.pycqa.org/en/latest/>`_ for linting.
21+
Please install it following its instructions, and run it at the project root with::
22+
23+
flake8 .
24+
25+
which will use the ``.flake8`` configuration file provided by pyOptSparse.
26+
27+
For an easier workflow, we recommend integrating these tools with your code editor.
28+
29+
.. warning::
30+
For a PR to be accepted, it must pass all GitHub checks, which include both formatting checks with ``black`` and syntax checks with ``flake8``.
31+
32+
Documentation
33+
-------------
34+
When you add or modify code, make sure to provide relevant documentation that explains the new code.
35+
This should be done in code via docstrings and comments, but also in the Sphinx documentation as well if you add a new feature or capability.
36+
Look at the ``.rst`` files in the ``doc`` section of the repo.
37+
38+
Testing
39+
-------
40+
When you add code or functionality, add tests that cover the new or modified code.
41+
These may be units tests for individual components or regression tests for entire models that use the new functionality.
42+
All the existing tests can be found under the ``test`` folder.
43+
44+
Pull requests
45+
-------------
46+
Finally, after adding or modifying code, and making sure the steps above are followed, submit a pull request via the GitHub interface.
47+
This will automatically go through all of the tests in the repo to make sure everything is functioning properly.
48+
The main developers of pyOptSparse will then merge in the request or provide feedback on how to improve the contribution.

doc/index.rst

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
.. pyOptSparse documentation master file, created by
2-
sphinx-quickstart on Sat Dec 7 13:50:49 2013.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
5-
6-
.. _pyoptsparse:
7-
81
===========
92
pyOptSparse
103
===========
11-
12-
PYthon OPTimization (Sparse) Framework
13-
14-
`pyOptSparseSparse` is a replacement for pyOpt.
4+
pyOptSparse is an object-oriented framework for formulating and solving nonlinear constrained optimization problems in an efficient, reusable, and portable manner.
5+
It is a fork of pyOpt that uses sparse matrices throughout the code to more efficiently handle large-scale optimization problems.
156

167
.. toctree::
178
:maxdepth: 2
@@ -24,3 +15,4 @@ PYthon OPTimization (Sparse) Framework
2415
optimizers
2516
reference
2617
postprocessing
18+
contribute

0 commit comments

Comments
 (0)