Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Latest commit

 

History

History
257 lines (187 loc) · 10.2 KB

CONTRIBUTING.rst

File metadata and controls

257 lines (187 loc) · 10.2 KB

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs at https://github.com/MeteoSwiss-APN/fls_sat_verif/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.

Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.

Write Documentation

fls_sat_verif could always use more documentation, whether as part of the official fls_sat_verif docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file an issue at https://github.com/MeteoSwiss-APN/fls_sat_verif/issues.

If you are proposing a feature:

  • Explain in detail how it would work.
  • Keep the scope as narrow as possible, to make it easier to implement.
  • Remember that this is a volunteer-driven project, and that contributions are welcome! :)

Get Started!

Ready to contribute? Here's how to set up fls_sat_verif for local development.

  1. Fork the fls_sat_verif repo on GitHub.

  2. Clone your fork locally:

    $ git clone [email protected]:your_name_here/fls_sat_verif.git
  3. Create a virtual environment and install the development dependencies:

        $ cd fls_sat_verif/
        $ make install-dev
    
    This will create a virtual environment named ``fls_sat_verif`` (change with ``VENV_NAME=my_venv``) in ``./venv`` (change with ``VEND_DIR=path/to/venv``) and install the following dependencies:
    
    -   Build dependencies in ``pyproject.toml``
    -   Runtime dependencies in ``setup.py``
    -   Testing dependencies in ``requirements/test-unpinned.txt``
    -   Development dependencies in ``requirements/dev-unpinned.txt``
    
    Optionally activate the virtual environment::
    
        $ source ./venv/bin/activate
    
    Note however that this is not required for ``make`` commands, which automatically detect and use the virtual environment.
  4. Create a branch for local development:

        $ git checkout -b name-of-your-bugfix-or-feature
    
    Now you can make your changes locally.
  5. When you're done making changes, format the code with black and check that your changes pass the static code analyses with flake8:

        $ make format
        $ make line
    
    Next, ensure that the code does what it is supposed to by running the tests with pytest::
    
        $ make test
    
    To make sure that your code is compatible with multiple Python version, and that it is properly packageable, run flake8 and pytest within tox::
    
        $ make test-all
  6. Commit your changes and push your branch to GitHub:

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
  7. Submit a pull request through the GitHub website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.
  2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
  3. The pull request should work for Python 3.6 and 3.7, and for PyPy. Make sure that the tests pass for all supported Python versions.

Tips

To run a subset of tests:

$ pytest tests.test_fls_sat_verif

Deploying

A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in HISTORY.rst). Then run:

$ make bump-patch # possible: major, minor, patch
$ git push
$ git push --tags

Project Structure

Managing dependencies

Generally, projects make use of other libraries, be it as (production) dependencies (e.g., import numpy in source code) Which libraries -- and any critical restrictions of their versions -- have to be listed in different places in the project:

  • Unpinned top-level runtime dependencies, which are required to run the application/library, belong in requirements/requirements.in (from which they are read in setup.py). The versions of unpinned dependencies are only restricted as necessary, e.g., if a minimum version is required for a certain feature or bugfix.
  • Unpinned top-level development dependencies, which are additional packages required during development, belong in requirements/dev-requirements.in.
  • Unpinned top-level testing dependencies, which are packages required by the testing framework tox to run unit tests, linters etc. as specified in tox.ini, belong in requirements/tox-requirements.in.
  • Pinned runtime, development and testing dependencies belong in requirements/requirements.txt, requirements/dev-requirements.txt and requirements/tox-requirements.txt, respectively. Pinned dependencies are recursive, i.e., include all dependencies of dependencies, and restricted to a specific version. This ensures a reproducible environment that is guaranteed to work.

How to provide executable scripts

By default, a single executable script called fls_sat_verif is provided. It is created when the package is installed. When you call it, the main function (cli) in src/fls_sat_verif/cli.py is called.

How many scripts that are created, their names and which functions are called can be configured in the setup.py file. The function setup has a named argument called entry_point which is a dictionary with an element console_scripts. The element is an array of string. For Example:

entry_points={
    'console_scripts': [
        'fls_sat_verif=fls_sat_verif.cli:main',
],

When the package is installed, a executable script is created in the Python's bin folder with the name fls_sat_verif. If a user calls this script, the function main in the file src/fls_sat_verif/cli.py is called. If more scripts should be created, add further entries to array console_scripts.