Skip to content

Commit

Permalink
Merge branch 'main' into jelic/feature/optimize_line_collection
Browse files Browse the repository at this point in the history
  • Loading branch information
JCGoran committed Jul 22, 2024
2 parents 8e0a11e + 4d5319d commit baf638e
Show file tree
Hide file tree
Showing 15 changed files with 2,587 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ morphed_data/

# dev setup
.vscode/
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Set up the pre-commit hooks to make sure you can pass the CI checks:
$ pre-commit install
```

All commits will be squashed, so just make sure that the final commit passes all of the linting, documentation, and testing checks. These will run in GitHub Actions when you open a pull request, but you should also run them locally:
All commits will be squashed, so just make sure that the final commit passes all linting, documentation, and testing checks. These will run in GitHub Actions when you open a pull request, but you should also run them locally:

```shell
$ pre-commit run --all-files # linting and documentation format checks
Expand All @@ -29,7 +29,7 @@ $ cd docs && make html # build the documentation locally
Some things to remember:

- All code must be documented using docstrings in the [numpydoc style](https://numpydoc.readthedocs.io/en/latest/format.html) – the pre-commit hooks will check for this.
- Any changes to the API must be accompanied with either an additional test case or a new test. Run `pytest` to make sure your changes are covered.
- Any changes to the API must be accompanied by either an additional test case or a new test. Run `pytest` to make sure your changes are covered.
- Documentation for the project is built with Sphinx. Your changes must render correct in the output. Run `make html` from the `docs` directory and inspect the result.

## 3. Open a pull request
Expand All @@ -43,13 +43,13 @@ In your description, please do the following:

When you create your pull request, first-time contributors will need to wait for a maintainer to approve running the GitHub Actions workflows. Please be patient until this happens.

Once it does, the same checks described above (testing, documentation, linting) that you ran on your machine will run on Linux, MacOS, and Windows with multiple versions of Python. Please note that it is possible that differences in operating systems and/or Python versions results in a failure, despite it working on your machine.
Once it does, the same checks described above (testing, documentation, linting) that you ran on your machine will run on Linux, macOS, and Windows with multiple versions of Python. Please note that it is possible that differences in operating systems and/or Python versions results in a failure, despite it working on your machine.

If anything fails, please attempt to fix it as we're unlikely to review your code until everything passes. If stuck, please feel free to leave a note in the pull request enumerating what you have already tried and someone may be able to offer assistance.

## 4. Code review

After all of the checks in your pull request pass, a maintainer will review your code. In many cases, there will be some feedback to address, and this may require a few iterations to get to the best implementation. Remember to be patient and polite during this process.
After all checks in your pull request pass, a maintainer will review your code. In many cases, there will be some feedback to address, and this may require a few iterations to get to the best implementation. Remember to be patient and polite during this process.

## 5. Congratulations!

Expand Down
7 changes: 4 additions & 3 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
CLI Reference
=============

.. argparse::
:ref: data_morph.cli._generate_parser_for_docs
.. sphinx_argparse_cli::
:module: data_morph.cli
:func: generate_parser
:prog: data-morph
:noepilog:
:group_title_prefix:

----

Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx_copybutton',
'sphinxarg.ext',
'sphinx_argparse_cli',
'matplotlib.sphinxext.plot_directive',
]

Expand All @@ -63,7 +63,6 @@
'Pillow': ('https://pillow.readthedocs.io/en/stable/', None),
'pytest': ('https://pytest.org/en/stable/', None),
'python': ('https://docs.python.org/3/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
}


Expand Down
13 changes: 10 additions & 3 deletions docs/custom_datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,14 @@ Here is an example animation generated from a custom dataset:
(Optional) Contribute the dataset
---------------------------------

If you have the rights to distribute the dataset and you think it would be a good
inclusion as a built-in dataset, make a PR to add it to Data Morph. Be sure to consult
the `contributing guidelines <https://github.com/stefmolin/data-morph/blob/main/CONTRIBUTING.md>`_
If you have the rights to distribute the dataset and you think it would
be a good built-in dataset, `create an issue <https://github.com/stefmolin/data-morph/issues>`_
in the Data Morph repository proposing its inclusion. Be sure to consult the
`contributing guidelines <https://github.com/stefmolin/data-morph/blob/main/CONTRIBUTING.md>`_
before doing so.

If and only if you are given the go ahead:

1. Add your CSV file to the ``src/data_morph/data/starter_shapes/`` directory.
2. Add an entry to the ``DataLoader._DATASETS`` dictionary in ``src/data_morph/data/loader.py``.
3. Submit your pull request.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ dependencies = [
"matplotlib>=3.3",
"numpy>=1.20",
"pandas>=1.2",
"scipy>=1.10.0",
"tqdm>=4.64.1",
]
optional-dependencies.dev = [
Expand All @@ -60,7 +59,7 @@ optional-dependencies.dev = [
optional-dependencies.docs = [
"pydata-sphinx-theme>=0.15.3",
"sphinx>=7.2.6",
"sphinx-argparse>=0.4.0",
"sphinx-argparse-cli>=1.16.0",
"sphinx-copybutton>=0.5.1",
]
urls."Bug Tracker" = "https://github.com/stefmolin/data-morph/issues"
Expand Down
24 changes: 0 additions & 24 deletions src/data_morph/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import argparse
import sys
import textwrap
from typing import Sequence, Union

from . import __version__
Expand All @@ -18,8 +17,6 @@
'freeze': 0,
}

USAGE_WIDTH_FOR_DOCS = 80


def generate_parser() -> argparse.ArgumentParser:
"""
Expand Down Expand Up @@ -209,27 +206,6 @@ def generate_parser() -> argparse.ArgumentParser:
return parser


def _generate_parser_for_docs() -> argparse.ArgumentParser:
"""
Generate an argument parser for the documentation only.
Returns
-------
argparse.argparse.ArgumentParser
Modified argument parser class for the documentation.
"""
parser = generate_parser()
usage_text = parser.format_usage()
parser.format_usage = lambda: textwrap.fill(
usage_text.replace(' ', ' '),
width=USAGE_WIDTH_FOR_DOCS,
subsequent_indent='\t',
break_on_hyphens=False,
break_long_words=False,
)
return parser


def main(argv: Union[Sequence[str], None] = None) -> None:
"""
Run Data Morph as a script.
Expand Down
2 changes: 2 additions & 0 deletions src/data_morph/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class DataLoader:
'dog': 'dog.csv',
'music': 'music.csv',
'panda': 'panda.csv',
'pi': 'pi.csv',
'Python': 'python.csv',
'SDS': 'superdatascience.csv',
'sheep': 'sheep.csv',
'soccer': 'soccer_ball.csv',
}
AVAILABLE_DATASETS = sorted(_DATASETS.keys(), key=str.lower)
"""list[str]: List of available built-in starter datasets,
Expand Down
Loading

0 comments on commit baf638e

Please sign in to comment.