Skip to content
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

Readme tools samples #9

Merged
merged 1 commit into from
Aug 27, 2022
Merged

Readme tools samples #9

merged 1 commit into from
Aug 27, 2022

Conversation

jtmoon79
Copy link
Contributor

@jtmoon79 jtmoon79 commented Aug 21, 2022

revise README, add samples

Revise README.rst to use syntax sections recommended in
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections

Improve README opening to better explain ipromise.

Add table of contents to README.

Revise README.rst line widths.

Add easier-to-read sample code, both in README and in python
files under samples/.

@jtmoon79
Copy link
Contributor Author

@NeilGirdhar any opinion on this PR?

README.rst Outdated Show resolved Hide resolved
README.rst Outdated
.. image:: https://badge.fury.io/py/ipromise.svg
:target: https://badge.fury.io/py/ipromise

This repository provides a Python base class, and various decorators for specifying promises relating to inheritance.
It provides three inheritance patterns:
This repository, ``ipromise``, provides a Python base class and
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either say "this repository" or "I Promise". Just choose one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

README.rst Outdated
This repository provides a Python base class, and various decorators for specifying promises relating to inheritance.
It provides three inheritance patterns:
This repository, ``ipromise``, provides a Python base class and
decorators to guarantee inheritance "promises".
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is good, but no need for the quotations around "promises".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

README.rst Outdated

* implementing
* overriding
* augmenting
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the commas and the "and". This is still a sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

README.rst Outdated
* overriding
* augmenting

Using the ``ipromise`` inheritance patterns can ensure an inheritance hierarchy
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this para is redundant. It doesn't say anything the previous paragraph doesn't. "Build time" doesn't mean anything in Python either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really preferred this as it explains the mechanism by which ipromise works. Not all Python users may intuit how ipromise functions.

I can remove it if you'd still prefer it removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed "build time".

tools/flake8.sh Outdated
#
# run flake8 with project settings

set -eu
Copy link
Owner

@NeilGirdhar NeilGirdhar Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this file add? I just do this:

poetry install
poetry shell
pflake8 .

I don't think we need complicated scripts for people who don't know how to use poetry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted the install script help instructions to the general poetry steps.

The wrapper scripts handle the details for developers:

  • running from the correct path
  • explicitly specifying a config file
  • passing expected arguments
  • sanity check the program exists and can run --version

IME wrapper scripts like this greatly reduce confusion around running project tools.

Also, having these tool wrapper scripts is like a big hint "make sure to run these tools with these settings!".

Also, in my case, some poetry commands failed with what appears to be a poetry bug. I had to come up with some workarounds. For example, sometimes I would get

$ poetry install

Updating dependencies
Resolving dependencies... (4.1s)

  ValueError

  invalid literal for int() with base 10: b''

  at .venv-3.9.13_ubuntu-22.04/lib/python3.9/site-packages/cachy/stores/file_store.py:65 in _get_payload
       61│
       62│         with open(path, 'rb') as fh:
       63│             contents = fh.read()
       64│
    →  65│         expire = int(contents[:10])

The slightly unusual command-lines in the "tools" scripts were what worked for me most often. My updates to this PR removed my uncommon approach.

Check out the updated "tools" scripts in my update push.
If you'd still like the "tools" scripts removed then I will remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed scripts.

tools/mypy.sh Outdated

set -eu

cd "$(dirname -- "${0}")/.."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, i don't think this file helps. I just do

mypy ipromise

Copy link
Contributor Author

@jtmoon79 jtmoon79 Aug 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, I recommended two paths for mypy, ipromise and test. mypy passes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then just do mypy ipromise tests. You can add that to the readme?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

tools/pytest.sh Outdated
set -eu

cd "$(dirname -- "${0}")/.."

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, no need for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

set -eu

cd "$(dirname -- "${0}")/.."

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good information. Would you mind putting this line:

rst-lint --level info README.rst

into the readme itself? You could add information about runnning mypy. pflake8, etc. there too? Maybe create a new section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is currently section Development which refers to these scripts. Is that adequate?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sounds great. Would you mind adding this line to that section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

README.rst Show resolved Hide resolved
@jtmoon79
Copy link
Contributor Author

I squashed the force-pushed the commits (which messes up the PR review history above 😕 but is a cleaner commit to master branch).

@NeilGirdhar
Copy link
Owner

@jtmoon79 Thanks, can you remove the scripts? I still see them.

@jtmoon79
Copy link
Contributor Author

@jtmoon79 Thanks, can you remove the scripts? I still see them.

Whoops, for some reason the git rm commit was dropped. Should be fixed now.

Copy link
Owner

@NeilGirdhar NeilGirdhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there

README.rst Outdated Show resolved Hide resolved
README.rst Outdated

.. code-block:: shell

pip install restructuredtext_lint Pygments
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This install should be in pyproject. If it isn't working for you, there's something wrong with your poetry setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

python -m pip install ipromise

***
Use
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks.

return super().f(**kwargs)

MyClassAgumentedOnce().f()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay that makes sense.

Revise README.rst to use syntax sections recommended in
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#sections

Improve README opening to better explain `ipromise`.

Add table of contents.

Revise README.rst line widths.

Add easier-to-read sample code, both in README and in python
files under `samples/`.
@jtmoon79
Copy link
Contributor Author

@NeilGirdhar how about this round of updates?

Copy link
Owner

@NeilGirdhar NeilGirdhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this PR, and for your patience with the review!

@NeilGirdhar NeilGirdhar merged commit d05cbab into NeilGirdhar:master Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants