Skip to content

[DOC] Add PyPI description #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ v0.18.1 (on deck)
- [ENH] add camelCase conversion to snake_case on ``clean_names`` by @ericmjl,
h/t @jtaylor for sharing original
- [ENH] add engineering submodule with unit conversion method by @rahosbach
- [DOC] add PyPI project description

For changes that happened prior to v0.18.1,
please consult the closed PRs,
Expand Down
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pyjanitor
.. image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/ericmjl/pyjanitor/dev

.. pypi-doc

``pyjanitor`` is a Python implementation of the R package `janitor`_, and
provides a clean API for cleaning data.

Expand Down Expand Up @@ -46,6 +48,8 @@ Inspired by the ease-of-use
and expressiveness of the ``dplyr`` package of the R statistical language ecosystem,
we have evolved ``pyjanitor`` into a language for expressing the data processing DAG for ``pandas`` users.

.. pypi-doc

To accomplish this, actions for which we would need to invoke imperative-style statements,
can be replaced with method chains
that allow one to read off the logical order of actions taken.
Expand Down Expand Up @@ -145,6 +149,8 @@ Installation

``pyjanitor`` requires Python 3.6+.

.. pypi-doc

Functionality
-------------

Expand All @@ -164,6 +170,8 @@ Current functionality includes:
- Syntactic sugar for filtering the dataframe based on queries on a column
- Experimental submodules for finance, biology, chemistry, and engineering

.. pypi-doc

API
---

Expand Down
35 changes: 35 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import re
from pathlib import Path

from setuptools import setup


Expand All @@ -6,6 +9,36 @@ def requirements():
return f.read()


def generate_long_description() -> str:
"""
Extra chunks from README for PyPI description.

Target chunks must be contained within `.. pypi-doc` pair comments,
so there must be an even number of comments in README.

:returns: Extracted description from README

"""
# Read the contents of README file
this_directory = Path(__file__).parent
with open(this_directory / "README.rst", encoding="utf-8") as f:
readme = f.read()

# Find pypi-doc comments in README
indices = [m.start() for m in re.finditer(".. pypi-doc", readme)]
assert (
len(indices) % 2 == 0
), "Odd number of `.. pypi-doc` comments in README"

# Loop through pairs of comments and save text between pairs
long_description = ""
for i in range(0, len(indices), 2):
start_index = indices[i] + 11
end_index = indices[i + 1]
long_description += readme[start_index:end_index]
return long_description


setup(
name="pyjanitor",
version="0.18.0",
Expand All @@ -16,4 +49,6 @@ def requirements():
packages=["janitor"],
install_requires=requirements(),
python_requires=">=3.6",
long_description=generate_long_description(),
long_description_content_type="text/x-rst",
)