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

Add Theory of Change Framework preprint #1523

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

sakshimohan
Copy link
Collaborator

Added preprint to publication list.

@sakshimohan
Copy link
Collaborator Author

@matt-graham @tbhallett I have added this publication to the Zotero library. But I haven't been succesful with step 3 of the process.

When I run in the tlo environment
tox -e update-publications
I get the following error -
ROOT: HandledError| provided environments not found in configuration file: update-publications

@matt-graham
Copy link
Collaborator

Hi @sakshimohan. Are you running the tox -e update-publications command from the root the TLOmodel repository and with the most recent version of master checked out? The error you got suggests tox is not able to find the update-publications environment defined in the tox.ini file - this was added in #1507 so should be available. You can also try running

python /home/matt/projects/TLOmodel/docs/tlo_publications.py --update-from-zotero

to directly run the script, but you will also need to run pip install pybtex requests first in this case to install the additional dependencies the script needs (tox deals with this automatically).

@sakshimohan
Copy link
Collaborator Author

sakshimohan commented Nov 21, 2024

Hi @sakshimohan. Are you running the tox -e update-publications command from the root the TLOmodel repository and with the most recent version of master checked out? The error you got suggests tox is not able to find the update-publications environment defined in the tox.ini file - this was added in #1507 so should be available. You can also try running

python /home/matt/projects/TLOmodel/docs/tlo_publications.py --update-from-zotero

to directly run the script, but you will also need to run pip install pybtex requests first in this case to install the additional dependencies the script needs (tox deals with this automatically).

Many thanks, @matt-graham . That problem is resolved. I get the following different error now -
File "/Users/sm2511/PycharmProjects/TLOmodel/docs/tlo_publications.py", line 103 toplevel[ ^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?

@matt-graham
Copy link
Collaborator

Many thanks, @matt-graham . That problem is resolved. I get the following different error now - File "/Users/sm2511/PycharmProjects/TLOmodel/docs/tlo_publications.py", line 103 toplevel[ ^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?

Oh that's an interesting one! That's suggesting there is a syntax error in

toplevel[
*(
tag("tr")[toplevel[tag("td")[tag("em")[key]], tag("td")[value]]]
for key, value in details.items()
)
]

which confusingly does not create any syntax errors when running for me 😕

Can I check what Python version you have and what the version pybtex that got installed was (should be able to check from Python packages tab / dialog in PyCharm or by running pip list pybtex in a terminal)?

@sakshimohan
Copy link
Collaborator Author

Many thanks, @matt-graham . That problem is resolved. I get the following different error now - File "/Users/sm2511/PycharmProjects/TLOmodel/docs/tlo_publications.py", line 103 toplevel[ ^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?

Oh that's an interesting one! That's suggesting there is a syntax error in

toplevel[
*(
tag("tr")[toplevel[tag("td")[tag("em")[key]], tag("td")[value]]]
for key, value in details.items()
)
]

which confusingly does not create any syntax errors when running for me 😕

Can I check what Python version you have and what the version pybtex that got installed was (should be able to check from Python packages tab / dialog in PyCharm or by running pip list pybtex in a terminal)?

I've got -
pybtex 0.24.0
Python version 3.10.13

@matt-graham
Copy link
Collaborator

Ah this could be an issue with the use of *(...) with a generator expression in the indexing operation as this seems to only work on Python 3.11+

As a more minimal example

import numpy as np
array = np.arange(12).reshape(3, 4)
array[*(i for i in range(1, 3))]

runs fine for me on Python 3.11+ but gives a syntax error in Python 3.10.

@sakshimohan
Copy link
Collaborator Author

sakshimohan commented Nov 21, 2024

Ah this could be an issue with the use of *(...) with a generator expression in the indexing operation as this seems to only work on Python 3.11+

As a more minimal example

import numpy as np
array = np.arange(12).reshape(3, 4)
array[*(i for i in range(1, 3))]

runs fine for me on Python 3.11+ but gives a syntax error in Python 3.10.

Got I will update to Python 11 in this case. Are you OK to merge this PR into master anyway?
I'm reluctant to update today because I have a deliverable due this evening and I'm afraid my analysis code might run into unexpected issues with the update which I will not have the time to address today.

@matt-graham
Copy link
Collaborator

I've got - pybtex 0.24.0 Python version 3.10.13

Probably worth updating to Python 3.11 as that is what we are currently recommending and testing against. For a quickfix for now to get this running in your Python 3.10 you can just change

 toplevel[ 
     *( 
         tag("tr")[toplevel[tag("td")[tag("em")[key]], tag("td")[value]]] 
         for key, value in details.items() 
     ) 
 ] 

to

 toplevel[ 
     tuple( 
         tag("tr")[toplevel[tag("td")[tag("em")[key]], tag("td")[value]]] 
         for key, value in details.items() 
     ) 
 ] 

that is swap * for tuple in docs/tlo_publications.py.

To update your environment to Python 3.11 the easiest way is to delete your current Conda environment

conda remove -n tlo --all

and the follow the installation instructions to create a new Python 3.11 environment with the dependencies.

@matt-graham
Copy link
Collaborator

Got I will update to Python 11 in this case. Are you OK to merge this PR into master anyway? I'm reluctant to update today because I have a deliverable due this evening and I'm afraid my analysis code might run into unexpected issues with the update which I will not have the time to address today.

Sorry missed this while writing previous message! Yes that's fine, once the checks / documentation workflows finish running I'll merge this assuming they pass!

@matt-graham matt-graham merged commit d5e6d31 into master Nov 21, 2024
2 checks passed
@matt-graham matt-graham deleted the sakshi/add_framwork_publication branch November 21, 2024 13:51
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