-
Notifications
You must be signed in to change notification settings - Fork 3
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
Port codebase to Python3 #2
base: main
Are you sure you want to change the base?
Conversation
When I did the PyPy conversion, I remember just using the |
|
Yes please, if we weren't using anything but the |
@@ -1,7 +1,6 @@ | |||
name: sus-env2 | |||
name: sus-env3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is environment.yml
for anyway? Is this still Conda garbage? I thought I got rid of that for PyPy
Did you need to use this to install? It would be nice if this worked without dependencies, but if we need dependencies, maybe moving to poetry
, that's what I did last time I modernized Python code
Clarifying the installation would be good, since we'll have to change that when we resetup the server environment to run this with python 3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed you were using conda
to get Python 2 running, but I can get PyPy set up. We will need dependencies because it uses js2py
to grab some data from Pokemon Showdown. I'll just leave it as conda for now, but we can move it to PyPy/poetry later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marty-D do you remember the deal with this? I feel like I got rid of this dependency at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I didn't get rid of it. Either way I don't know how to use Conda. We should have instructions on how to use it in the README. We don't have to switch to something else in this PR if it works OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: PyPy, my understanding is that it's not as useful with recent versions of Python now that it has its own JIT. So just having it work in whatever configuration is used on the server is fine. I'm not sure my changes ever got used in the main workflow anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marty-D do you remember the deal with this? I feel like I got rid of this dependency at some point
I'm not sure, I wanted to use your changes on the new sim server but couldn't find how to configure PyPy on nix, or if I even had the right permissions to do so. Didn't have time to waste getting sh or whoever to do it so I just used the old conda stuff, which I feel like ended up taking longer to figure out than in 2019.
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
~/miniconda3/bin/conda init bash
git clone https://github.com/Marty-D/Smogon-Usage-Stats
cd Smogon-Usage-Stats/
conda env create
tmux attach
cd Smogon-Usage-Stats/
conda env create
cd ..
source ~/.bashrc
conda --version
cd Smogon-Usage-Stats/
tmux attach
source activate sus-env2
conda info --envs
# conda environments:
#
base /home/marty/miniconda3
sus-env2 * /home/marty/miniconda3/envs/sus-env2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I didn't get rid of it. Either way I don't know how to use Conda. We should have instructions on how to use it in the README. We don't have to switch to something else in this PR if it works OK.
This can happen in a different PR then.
The rest looks OK to me. Thanks for taking this on |
If you could revert the |
And also a comment on the trainer name unicode stuff, what you had before was sensible and the obvious thing to do, so down the line it might not be clear to someone doing further cleanups why this is the way it is |
Did |
Did |
If it works locally for you then I approve these changes. Thanks again for the effort. I'll leave it unmerged until @Marty-D has time to integrate it in his workflow. |
Co-authored-by: Christopher Monsanto <[email protected]>
There is a bug in this code that I'm still looking through; I'll put more details once I'm back at my computer. |
To follow up on the bug, it's present in the Python 2 version as well, you can merge this PR. |
Well, what is the bug? |
In the synthetic data that I used to test the Tera types feature, I came across an issue where when
Specifically, the line that goes I thought it appeared when porting to Python 3, but when I ran it in Python 2 with the same data, the same result appeared. I know that when the code runs the following (on line 235 of for i in range(len(table)):
if (total > .95 and x != 'Abilities') or (x == 'Abilities' and i>5) or (x == 'Spreads' and i>5) or (x == 'Teammates' and i>10) or (x == 'Checks and Counters' and i>11):
if x == 'Moves':
line = ' | %s %6.3f%%' % ('Other',400.0*(1.0-total))
elif x not in ['Teammates','Checks and Counters']:
line = ' | %s %6.3f%%' % ('Other',100.0*(1.0-total)) the Tldr; fixing this (if it even is an issue) is better saved for another PR. |
Okay, it can be addressed later |
Co-authored-by: Christopher Monsanto <[email protected]>
Includes updating
print
statementsand replacing the maintenance-only ujson with orjson.