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

Neaten up README.md a little #235

Merged
merged 16 commits into from
Feb 15, 2024
Merged

Neaten up README.md a little #235

merged 16 commits into from
Feb 15, 2024

Conversation

kaapstorm
Copy link
Contributor

Addresses a few nits:

  • Uses consistent spelling for "Python" and "CommCare HQ"
  • Drops a broken link
  • Fixes JSON and Python errors (except for one undefined variable that I couldn't figure out at a glance)
  • Simplifies virtualenv instructions a little
  • Applies recommended table formatting
  • Updates GitHub workflow to run tests against current Python releases

This is a documentation only change.

Copy link
Contributor

@mkangia mkangia left a comment

Choose a reason for hiding this comment

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

Looks great! Thank for you this.

Left just minor queries.

@@ -31,7 +31,7 @@ jobs:
- 5432:5432
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: '3.10' instead of 3.10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The quotes are required for 3.10 because without them YAML evaluates it as a float with the value 3.1. The others are fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh wow, can we keep all as strings then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

README.md Outdated

```shell
$ python --version
$ python3 --version
```
If python is installed, all of its available versions would be listed.
If Python is installed, its version will be listed.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:
version will be listed shown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

README.md Outdated

If python isn't installed, Install Python 3.8 from [this link](https://www.python.org/downloads/).
If Python isn't installed, [download and install](https://www.python.org/downloads/) the latest release.
Copy link
Contributor

Choose a reason for hiding this comment

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

should we say install any version from 3.8 to 3.12?
If the latest version is above 3.12, It could lead to unexpected errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

README.md Outdated

More about virtualenvs on https://docs.python.org/3/tutorial/venv.html

Setup a virtual environment using:

```shell
$ python3.8 -m venv .commcare-export-venv # update python version for the one installed
$ python3 -m venv .venv
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to change that back to venv?
I had made that change earlier to make the name more specific and avoid conflicts with any other setup since that is the name suggested by virtualenv documentation by default. We use the same name for CommCareHQ, venv.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally, I like "venv". (Some people seem to like to hide the directory.) I'll change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am happy with venv if you wish to keep that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

export HQ_API_KEY=<apikey>
```shell
$ export HQ_USERNAME=<username>
$ export HQ_API_KEY=<apikey>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:
Should not we generally avoid "$"?
Whenever I need to simply copy the command and run it, I need to remove that $ sign each time after pasting that into terminal.

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 added them in here to be consistent with the rest of the document (although I've just noticed I missed two others).

Generally, I have found it useful to indicate the prompt to make it clear what kind of prompt it is. e.g.

$ psql -U commcarehq

=# \l
    List of databases
...
=# \q

$ python3

>>> print('Hello world.')
Hello world.

I have found that often writers will leave out the prompt so consensus is not universal, but that more often than not, they include it. Certainly across Dimagi docs, we seem to include it most of the time.

README.md Outdated

results = query.eval(BuiltInEnv() | CommCareHqEnv(api_client) | JsonPathEnv())

if len(list(env.emitted_tables())) > 0:
# with writers.Excel2007TableWriter("excel-output.xlsx") as writer:
with writers.StreamingMarkdownTableWriter(sys.stdout) as writer:
# with Excel2007TableWriter("excel-output.xlsx") as writer:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could also remove that comment I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

README.md Outdated
| `+, -, *, //, /, >, <, >=, <=` | Standard Math | |
| Function | Description | Example Usage |
|--------------------------------|------------------------------------------------------------------------------|----------------------------------|
| `+, -, *, //, /, >, <, >=, <=` | Standard Math | |
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Looks like this needs some more alignment correction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.github/workflows/test.yml Show resolved Hide resolved
README.md Outdated
@@ -71,6 +71,7 @@ $ venv
Install CommCare Export via `pip`

```shell
$ pip install setuptools
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Should we make a comment that this is for version 3.12?

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 just tested this in Python 3.12. Turns out we don't need setuptools if we install using pip install commcare-export. I'll drop this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -42,23 +43,23 @@ More about virtualenvs on https://docs.python.org/3/tutorial/venv.html
Setup a virtual environment using:

```shell
$ python3 -m venv .venv
$ python3 -m venv venv
Copy link
Contributor

Choose a reason for hiding this comment

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

oh, we are not keeping the folder hidden anymore.

Non blocking but for someone who does not understand these things well, they would get really confused of two "venv"s, about which one is command and which one is a folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! I completely misunderstood your comment,

Any reason to change that back to venv?
I had made that change earlier to make the name more specific and avoid conflicts with any other setup since that is the name suggested by virtualenv documentation by default. We use the same name for CommCareHQ, venv.

I thought you were asking me to change .venv to venv in order to be consistent with its name in CommCare HQ. Sorry for my confusion.

avoid conflicts

virtualenvwrapper puts all your virtual environments in one place, so it's important to give them unique names. But the Standard Library's venv is simpler, and doesn't have a special place for all your virtual environments. In my experience, most people just use a subdirectory in the repository's root named "venv", so there is no risk of conflicts. This convention is used in GitHub's template .gitignore file for Python projects. I've just applied the same convention here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay.

@kaapstorm kaapstorm merged commit 6f7a0c8 into master Feb 15, 2024
5 checks passed
@kaapstorm kaapstorm deleted the nh/readme branch February 15, 2024 00:59
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