Skip to content

Fix issue with path when mvs is installed as a package#607

Merged
Bachibouzouk merged 24 commits intodevfrom
fix/mvs-path
Oct 21, 2020
Merged

Fix issue with path when mvs is installed as a package#607
Bachibouzouk merged 24 commits intodevfrom
fix/mvs-path

Conversation

@Bachibouzouk
Copy link
Copy Markdown
Collaborator

@Bachibouzouk Bachibouzouk commented Oct 14, 2020

Fix #594, Fix #598

Changes proposed in this pull request:

  • Remove REPORT_PATH constant
  • Add report assets and example simulation to package_data in setup.py
  • Add a util function to copy report asset to simulation output folder when user generates the report
  • Remove reference to git branch ID in the report
  • Make sure report can be generated even if figures are missing from simulation outputs
  • Move the code located in mvs_report.py into multi_vector_simulator.cli:report
  • Add entrypoints for mvs_tool and mvs_report in ´setup.py´
  • Update installation steps in README and in RTD
  • If default folder does not exist when code is executed, example simulation's inputs are used from package_data

To be able to use package_data, one has to install the package locally python setup.py install, for developers python setup.py develop or pip install -e .. However this does not install package_data properly, so developers cannot use complete default values. They can use ´mvs_tool -i tests/inputs´ when being in the root of the repository (maybe need to add this in CONTRIBUTING, but after we merge #601)

The following steps were realized, as well (if applies):

  • Use in-line comments to explain your code
  • Write docstrings to your code (example docstring)
  • For new functionalities: Explain in readthedocs
  • Write test(s) for your new patch of code (pytests, assertion debug messages)
  • Update the CHANGELOG.md
  • Apply black (black . --exclude docs/)
  • Check if benchmark tests pass locally (EXECUTE_TESTS_ON=master pytest)

For more information on how to contribute check the CONTRIBUTING.md.

@Bachibouzouk Bachibouzouk mentioned this pull request Oct 14, 2020
7 tasks
@Bachibouzouk Bachibouzouk marked this pull request as ready for review October 14, 2020 20:46
@Bachibouzouk
Copy link
Copy Markdown
Collaborator Author

@smartie2076 - it could have been split in two PRs, but some features were depending on one another so I grouped everything under one PR

Copy link
Copy Markdown
Collaborator

@smartie2076 smartie2076 left a comment

Choose a reason for hiding this comment

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

One comment to the installation instructions: Those are user-focused in README.md, aren`t they? Is there a link somewhere that points to the dev installation procedure, or is there no difference?

Wouldnt it make sense to directly read from the README.rst and load the installation procedure into Installation.rst?

className="cell imp_info",
children=[
html.P(f"MVS Release: {version_num} ({version_date})"),
html.P(f"Branch-id: {branchID}"),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

But printing the used branch in the report was important for me, so that we do not mess up comparing two scenarios that are used with different dev versions or something. Is removing it necessary?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If you run the simulation after installing the package with pip, you might run a simulation not from the root of this repository, therefore the code to fetch the branch id of this repository fails because you are not anymore within a repository when you run the code.

Ultimately, the version number is the only thing which matters (it is uniquely mapped to a commit id in the master branch of the repo) as on pip you cannot have two release with same version numbers, you can only bump version number up.

If you want to keep the branch-id feature, we should pack this into a function of utils which detects if the person executing the code does it from the root of the repository or not and provide, or not, the branch id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mhm... okay. Actually, as the end-user will use the simplest way to install the MVS, we probably do not need to print the branch-id.

For devs: When working on the dev branch, we have the same version number as the master release, dont we? Could we not bump the version number of dev to something like vX.Y.Z.dev? and then we are at least warned when we compare dev to real releases. Additionally, we can then check the simulation date to guess if large changes might already have been applied to dev...

Copy link
Copy Markdown
Collaborator Author

@Bachibouzouk Bachibouzouk Oct 21, 2020

Choose a reason for hiding this comment

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

We can reintroduce the ID in a subsequent PR what do you say @smartie2076 ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You mean as in "introduce in another way"? Sounds fine. Can you create an issue noting down your thoughts?

Otherwise it would be better to just revieve it now.

- If default folder does not exist when code is executed, example simulation's inputs are used from package_data (#607)

### Removed
- Remove reference to git branch ID in the report (#607)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because you are within this repository only when you execute the code from somewhere else there is no repository

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok, I got the idea. I hope there wont be too many mess-ups when we as devs simulate the pilots with the dev version. Maybe we should just prohibit people to do that xD

@smartie2076
Copy link
Copy Markdown
Collaborator

Does this PR address that currently the tables are not displayed in the pdf report? See here: #606 (comment)

@Bachibouzouk
Copy link
Copy Markdown
Collaborator Author

Does this PR address that currently the tables are not displayed in the pdf report? See here: #606 (comment)

I can see the tables with code from this PR

@smartie2076
Copy link
Copy Markdown
Collaborator

Does this PR address that currently the tables are not displayed in the pdf report? See here: #606 (comment)

I can see the tables with code from this PR

"Tables with code" You mean, the tables with values? Nice.

@Bachibouzouk
Copy link
Copy Markdown
Collaborator Author

Does this PR address that currently the tables are not displayed in the pdf report? See here: #606 (comment)

I can see the tables with code from this PR

"Tables with code" You mean, the tables with values? Nice.

--> "I can see tables" + "with the code from this PR"

@Bachibouzouk Bachibouzouk merged commit 5ced113 into dev Oct 21, 2020
@Bachibouzouk Bachibouzouk deleted the fix/mvs-path branch October 21, 2020 16:09
@smartie2076 smartie2076 mentioned this pull request Nov 10, 2020
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.

The REPO_PATH variable might now be suitable anymore for a package mindset [Bug] The report cannot be processed with the new release

2 participants