Closed jrobinAV closed 4 months ago
I would like to contribute to this issue. Could you please assign it to me?
Hello @Luke-0162, thank you for joining our project. I assigned the issue to you.
Please let me know if you need more information about the issue.
Hello @trgiangdo, thank you for your response. I am looking forward to solve this issue.
Could you please help clarify which functions or methods I will need to edit exactly in order to resolve this issue? I have been examining the _fetchconfig method within the scenario.py file, but I want to make sure I am on the right track.
In https://github.com/Avaiga/taipy/blob/develop/taipy/core/taipy.py, you can find the get_scenarios()
and get_primary_scenarios()
functions.
These 2 functions return a list of scenarios.
You should add 2 new parameters to this 2 functions, first is sorted: bool
which indicates if the returned lists of scenarios is sorted or not, and second is the sort_key: str
which indicates which key or attribute is used to sort the scenario.
The default value of the sort_key
can be discuss latter.
For example, it should be something like:
def get_scenarios(
cycle: Optional[Cycle] = None,
tag: Optional[str] = None,
sorted: bool = False,
sort_key: str = "creation_date",
) -> List[Scenario]:
...
# Get the list of scenarios (already implemented)
...
# Sort the scenario list and return the list
Similarly for the get_primary_scenarios()
method
Hello @trgiangdo,
Once again, thanks a lot for helping me out. I have completed the implementation of the functions as discussed. Additionally, I have made a local test project which uses Taipy. This setup aims to allow me to test the new implementation of the get_scenarios() and get_primary_scenarios() functions. However, when I now install my edited version of Taipy by using the command "pip install -e ." inside the directory in which I put the Taipy GitHub project and try to use my version of Taipy in the test project, the modules "Config, Scope, Gui" (which are the only ones I am using) are not recognised. Meanwhile, I noticed that the Taipy import itself is recognised. So, I was wondering if you know how this problem is fixed and more specifically what is common practice for testing quickly whether a function works.
Additionally, I'm curious about any further steps required to address this issue. Should I be considering creating unit tests?
Thank you for your time and assistance. Looking forward to your insights!
pip install -e
. You can either create a separate environment for running the test and install Taipy from your edited folder, or you can run the test from the taipy folder itself.Hello @trgiangdo ,
I have finished implementing the sorting mechanism into the tp.get_scenarios()
or tp.get_primary_scenarios()
functions. Additionally, I have added unit tests that cover my implementations. However, when I try to commit my code in my fork repository and the mypy check is triggered, all checks pass except from some checks concerning overloaded function signature. I cannot commit my code despite not being the initiator of these errors, as I have only edited existing functions and have not added any additional functions (apart from the unit tests). Can you inform me on how to continue?
Once again, thanks a lot for your help!
You can try to ignore the mypy error by adding the option -n
to the commit command. Something like
git commit -m "message" -n
I successfully committed, however, now I am trying to submit a pull-request. As this is the first time for me to do this for an open-source project, I am not sure whether I have done it correctly. Can you help me out? @trgiangdo
We can see your PR now. Let's start working from there
Description
When calling
tp.get_scenarios()
ortp.get_primary_scenarios()
, the user should be able to provide an optional field for sorting the scenarios. The sort should be increasing or decreasing. The sort could be on the name (default), id, creation_date, or tag.