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

Remove eachdist from documentation #1995

Closed
wants to merge 3 commits into from

Conversation

ocelotl
Copy link
Contributor

@ocelotl ocelotl commented Jul 27, 2021

Fixes #1994

@ocelotl ocelotl requested a review from a team as a code owner July 27, 2021 21:44
@ocelotl ocelotl requested review from owais and codeboten and removed request for a team July 27, 2021 21:44
@ocelotl ocelotl self-assigned this Jul 27, 2021
@@ -45,18 +45,11 @@ during their normal contribution hours.

## Development

To quickly get up and running, you can use the `scripts/eachdist.py` tool that
Copy link
Member

@Oberon00 Oberon00 Jul 29, 2021

Choose a reason for hiding this comment

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

Please document how to achieve this with tox or otherwise (e.g. I'd like to be able to go-to-definition across projects within VS code/Pylance)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, @Oberon00 I don't understand the following:

(e.g. I'd like to be able to go-to-definition across projects within VS code/Pylance)

Can you please give me more context? ✌️

Copy link
Member

@Oberon00 Oberon00 Jul 29, 2021

Choose a reason for hiding this comment

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

If I just clone the repository, create an empty virtualenv and open the folder in VS Code, it will not be able to resolve an import of, e.g., Span from opentelemetry-api while I'm editing a file in opentelemetry-sdk.

If I do pip install -e ./opentelemetry-api, it will be able to resolve the import.
So one way to do this without eachdist.py is of course to pip install -e everything, or everything I'm interested in, manually, in the right order (dependencies before depending projects).

But it would probably possible to replace this with tox somehow. E.g. I saw there is a recent feature with a promising name https://tox.readthedocs.io/en/latest/example/devenv.html.

But what we would need is a tox environment that does a pip install -e for each distribution in the project (I think that's where I got eachdist.py's name from originally).
EDIT: Or maybe I'm the only one that thinks this is useful, and there would be a better workflow I'm not aware of?

Copy link
Member

@Oberon00 Oberon00 Jul 29, 2021

Choose a reason for hiding this comment

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

We could maybe have a tox ennvironment called (pyxx-)devenv that just calls eachdist.py develop {posargs} behind the scenes for now. This could be transparently replaced with a solution that does not use the script (I have stated my personal opinion on that removal in #1462, but assuming you want 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.

Every time you run tox, virtual environments are created in the .tox folder and you can activate them, for example, for tox -e lint: source .tox/lint/bin/activate.

Copy link
Member

@Oberon00 Oberon00 Jul 30, 2021

Choose a reason for hiding this comment

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

I get that, but I was asking was whether there is

a tox environment that does a pip install -e for each distribution in the project

Looking at the toxfile now, the lint environment seems to do this. Could we mention that here?

Like

To quickly get up and running, you can run tox -e lint and then activate the resulting virtual environment with . .tox/lint/bin/activate. This has all distributions in the repository installed in editable mode, as well as the black autoformatter and the pylint and flake8 linting tools.

Copy link
Member

Choose a reason for hiding this comment

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

Of course, the "quickly" part is hapered a bit by the fact that this environment will run the very slow pylint, so maybe a dedicated environment would still be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I understand now what you mean. I think that is outside of the scope of this PR, adding that feature to tox.ini would be better tracked in a separate issue.

Copy link
Member

@Oberon00 Oberon00 Jul 30, 2021

Choose a reason for hiding this comment

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

Make sense, but maybe suggesting the environment created by tox -e lint would still be better than nothing.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like with that devenv feature @Oberon00 shared, you could just update the instructions to say tox --devenv venv -e lint and that prevents the commands from running:

The --devenv option skips the commands= section of that configured test environment and always sets usedevelop=true for the environment that is created.

to run tests. `git clone git@github.com:open-telemetry/opentelemetry-python-contrib.git opentelemetry-python-contrib`.

You can then run `scripts/eachdist.py test` to test everything or
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to run tox without linting (only tests)? For me, the pylint step takes probably longer than everything else together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, tox -e py39-test-core-api, for example.

Copy link
Member

@Oberon00 Oberon00 Jul 29, 2021

Choose a reason for hiding this comment

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

OK, but I guess there is no way to run all tests without either listing them one by one or also running lint, etc at the same time. Not a must-have feature though.
EDIT: something like tox -e py39-test-*, but I don't think tox supports that kind of patterns.

@ocelotl ocelotl added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 29, 2021
Comment on lines +65 to +73
`tox -e lint` checks the style of the code. It uses [`black`](https://black.readthedocs.io/en/stable/), [`isort`](https://pycqa.github.io/isort/)
and [`pylint`](http://pylint.pycqa.org/en/latest/) for this purpose. `black` and `isort`-related errors can be fixed automatically by following
the next steps:

1. `tox -e lint`
2. `source .tox/lint/bin/activate`
3. `black .`
4. `isort .`
5. `deactivate`
Copy link
Member

Choose a reason for hiding this comment

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

We should just create a new tox env to do this, so users can simply run tox -e fix.

@owais
Copy link
Contributor

owais commented Aug 2, 2021

I don't mind removing it from docs and relying completely on tox but just wanted to say that eachdist script was very nice when working with custom venvs outside tox. It'd be nice to keep it around even if undocumented.

@ocelotl
Copy link
Contributor Author

ocelotl commented Oct 27, 2021

This PR is pretty outdated now, closing.

@ocelotl ocelotl closed this Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation mentions eachdist
4 participants