« first day (3 days earlier)      last day (631 days later) » 
00:00 - 06:0006:00 - 00:00

00:02
Since password security is a pain why don't we just use google sign in?
^ good idea
does python have a module like passport?
@Christopher2EZ4RTZ what if I'd rather not use my google account?
@Riker then you can leave
basically allows 1 line integration for adding Facebook/Twitter login while also giving option for custom user system
open ID is a thing though
00:05
@Riker meh
alternative idea: use nodejs and have working PPCG-v2 in around 5 hours
@Downgoat sure, along with jquery right?
@Riker no, react
alt idea: use java and flash and have it working in 20 minutes but takes 6 hours to load
@Christopher2EZ4RTZ it'll take 20 minutes just to boot eclipse
00:06
@Downgoat but jquery is great and does all things
6 hours to finish writing boilerplate
I'd prefer to use NodeJS, (especially seeming as I can't even get MySQL Connector/Python for Python3.5)
@Christopher2EZ4RTZ lol, I don't even konw if I still have flash
@ATaco node would probably work fine as long as jquery is used
Node.js also supports nice things like sass/scss and other flashy technologies that that guy at the tech confrence has stickers of on his laptop
@Riker "konw" would vote mod again
00:07
@ATaco brb creating PPCG-v2.1 nodejs
Python is perfectly fine, I just don't know how to use it and everyone should cater around my needs.
@Christopher2EZ4RTZ you angry with me or something?
that's 2 semi-rude comments in a short amount of time
legitimately sorry if I did something to offend you
also python does things like this:
I'm out now, going to the library
and does not have automatic build + install + etc. integration
00:08
@Downgoat python is great and does all things
also ooh nice terminal
zsh?
Sorry that you took them as offensive :()
powerline9k IIRC
cool, I should try that
@Christopher2EZ4RTZ We're doing stack exchange sign in at first
00:09
@Christopher2EZ4RTZ it's all good
@Riker brb finding item to take offence at :P (2017 colorized)
if I can get a node.js PPCG-v2 working by end of day would we be willing to switch to that
@Downgoat what happen to goathub
Apparently I can full stack node.js, not well, but I can do it.
00:11
@Christopher2EZ4RTZ see TNB
@ATaco You want this connector: dev.mysql.com/downloads/file/?id=472643
Run python3 setup.py install
> Python 2
@Downgoat No
mysql-connector-python-2.1.7.tar.gz
@ATaco Don't question it it works
00:11
@Pavel pls assist in fix python weirdness
also how to setup SASS with Python?
Ok what do you need
it says no module ConfigPrasre
but a couple lines up it shows it has been succesful install
@Downgoat Yeah the pip package doesn't actually work
Please see the connector I just linked ATaco too
also is the entire app going to really be in 1 main.py or will there be at least seperate MVC in codebase
The Python 2.7 works better for Python 3.5 then the python 3.2 version. Screams into the Pythonic void
00:14
@Downgoat I don't think the project currently warrants multiple python files.
^ why I don't like python in one message
@ATaco They just didn't update the version number on the filename trust me it's the python 3 one.
can we do hot reloading or does python not do that?
IDK what that means
basically I modify file and I don't need to restart server
00:16
No project deserves to be crowded into one file.
@Downgoat Theoretically you could import the modified file again
But no, not really
:(
also can I request we write the code with at least some docs
@Downgoat Sure. Not much to document so far.
python main.py
Traceback (most recent call last):
  File "main.py", line 6, in <module>
    import config
ImportError: No module named 'config'
Help
@ATaco Yeah the config contains your sql password
So we don't have it in the repo
# config.py
db_config = {
    'user': 'root',
    'password': 'PASSWORD',
    'host': '127.0.0.1',
    'database': 'ppcg'
}
00:21
(Can we add that default to the repo..?)
@ATaco I believe Downgoat's on it.
00:37
Screams whilst trying to get MySQL working
Wait a second, I'm already running a MySQL on localhost.
ಠ_ಠ
Also, for the love of god, please fix theಠ__ಠ bug in your userscript.
btw how to get write access
Well, I've got it working.
@Downgoat Ask mego
@Mego could I get write access?
btw to serve a SASS file is there a special way to do that or do I just pre-build it and then statically serve it
00:47
@Downgoat Don't think there's a special way.
Pretty sure you just pre-build it.
(A-ta.co dynamically builds it, for a-ta.co reasons)
looks like there's a flask thing: flask-assets.readthedocs.io/en/latest
but idk how to even flask
Bad idea: Use Flask as a C Pre-compiler.
@ATaco You mean the template language?
Yeah.
00:51
¯\_(ツ)_/¯
:O flask-asset support babel
@Downgoat Make sure to add Flask-Assets to requirements.txt
I did that
is there a way to install all things from requiements.txt
@Downgoat pip install -r requirements.txt
do you know what static_url_path is by default set to?
00:54
@Downgoat Nope
@Downgoat If you use PyCharm it will try to install the packages automatically
idk how to multi-file python so if anyone knows how to do that I think that might help de-clutter the main.py
where should I create a myclass.py
I don't think it should go in root
should I make a folder?
how do I import a folder in python
@Downgoat import <name> runs everything in <name>.py, and makes all assignments to the namespace <name>. For folders, import path/to/module.
:O that works
should I call it src or in python is it not like that
if I have multiple files which import foo. is foo run multiple times or just once?
@Downgoat Just once
@Downgoat you may need to change Flask("PPCGv2") to Flask("PPCGv2", template_folder="<LOCATION>") so it can find the templates if you move main.py.
Where should I keep the source .scss files should I do like /assets or like make /templates/assets
01:04
@Downgoat Probably /templates/assets, but we should ask Mego when he gets back.
If it doesn't work out we can just move it
I was looking at flask folder structure and it shows this:
config.py
requirements.txt
run.py
instance/
    config.py
yourapp/
    __init__.py
    views.py
    models.py
    forms.py
    static/
    templates/
why would confnig.py be listed twice?
oh wait nevemrind
how do I export a variable so it can be imported
like if I have import app.db which declared db_conn @ top level. I am not able to access it
@Downgoat You just declare it in the global scope
so in this file: github.com/vihanb/PPCG-v2/blob/master/app/routes.py#L5 there is app.route, but that says app has no attribute route
app is declared in app.flask
any insight on why this is happening?
app = Flask("PPCG v2")
It's declared in main.py
I removed main.py and split up the contents
I pushed what's causing the error to GH btw
01:19
@Downgoat You named it flask.py, so there's a name conflict between the Flask package and your file.
I named it app.py before and I got the same error
Oic
Instead of import flask.app, from flask import app
@Downgoat ^
you mean from app import flask?
No.
ohhhhhhhhh
should I rename it to avoid the naming conflict?
01:22
Also, rename flask.py so there's no conflict
Yes
>_< do you have any name suggestion
Why not just app.py
and then from app import app
what's the difference between import app.app and from app import app
that still gives error >_<
@Downgoat import app.app == import app/app
@Downgoat Hmm, what error?
wait would I need to do from app.db import db_conn or would just import app.db work
01:25
@Downgoat import app.db would work but you'd have to call it with app.db.db_conn, the from/import syntax bring the imported function/var into the global namespace.
is there a way (maybe using init.py) to change that to like from app import db_conn
@Downgoat Why are you importing anything from app. Everything is already in the app directory.
I have a run.py from outside the app dir
thats what flask docs said
Ah.
weird:
from app.app import app
app.run(host=host, port=port)
gives an error that there is no app.run
01:28
Right, start.app.run()
You did import app.start and not from app.start import app
Ahh
No
I'm confused by all the namespaces
>_< same
run.py should say start.run, not just run
I do from app.start import run however
Oh, then is should work
That's not what you had on the GitHub
yeah, sorry, just pushed again
Traceback (most recent call last):
  File "./run.py", line 7, in <module>
    run(host='127.0.0.1', port=5000)
  File "/Users/vihan/Documents/Code/PPCG-v2/app/start.py", line 5, in run
    app.run(host=host, port=port)
AttributeError: module 'app' has no attribute 'run'
is the error
01:32
@Downgoat start has import app.app, but since start is already in app, should just be import app
I think
from app import app gives same error
I think it needs app.whatever though beacuse import routes for start.py doesn't work you need import app.routes
Ah
@Downgoat I think it's namespace confusion because everything is called app
maybe I should call it server.py?
That sounds good
this is not true please ignore
does python automatically re-export imported things?
with server.py still gives errors ;_;
01:37
@Downgoat I'm pretty sure it does not
Is it the same error, app has no attribute run?
oh interesting doing:
from app.server import app
import app.routes

def run(host, port):
    print(app)
    app.run(host=host, port=port)
prints:
<module 'app' from '/Users/vihan/Documents/Code/PPCG-v2/app/__init__.py'>
does that mean what I'm importing as app is actually the entire foldeR?
@Pavel yeah
Welp, it's namespace confusion.
wat ru even do python
It thinks the app is the entire folder
I'm starting to see the appeal of a single main.py
oh god that worked
ಠ____________________ಠ to python module system
01:40
I still prefer it to Node's. var foo = require("foo") bothers me.
this is why you use babel and get import foo from 'bar'
@Pavel im dissapointed with yer lack of py2
no excuse for that
py2 is best python
@Riker wat
ಠ_ಠ
py2 has too many crazy things
like not doing proper unicode
py2 is beautiful
01:42
Rigt just so everyone's clear I don't actually Python
@Downgoat actually I completely agree with that
:O flask do middleware
that and the lack of a list product function is really my only faults
The last time I wrote it before PPCGv2 was over 5 years ago.
omg I found this python snippet:
app = SharedDataMiddleware(app, {
    '/shared': os.path.join(os.path.dirname(__file__), 'shared')
})
> {
01:42
I'm still befuddled why there's no builtin for the product of a list
it's a brace!
like, what? really?
@Downgoat .. that's called a dictionary
it's basically a js object
> class MyFlask(Flask):
wtf is this subclass notation O_o
inheritance?
gives you all the properties of Flask, you can overwrite them as you wish
Also so we're clear, when we were deciding on the technology stack i voted for C# and ASP.NET Core
01:44
@Pavel lol nice try I don't think there are that many masochists here
@Downgoat i.e. any methods defined in Flask will be in MyFlask, but you can overwrite them as desired
you can also erase them by overwriting with pass iirc
The problems that come from ASP.NET Core are made up for by C#'s awesomeness.
@Pavel that is true carry on
Thank you.
:OOOOOO IT WORK
PYTHON IS AMAZE
what does?
but YAY!
@Downgoat YES
01:47
Less so than C#, but moreso than Java/Script
does python have something like redux
where you can pass server data to JS when generating the page
likely
what's this about?
iirc there's a library to literally use redux from python
@NoOneIsHere We're building PPCG, but better and not hosted on StackExchange
oh, wow
01:49
in The Nineteenth Byte, Nov 4 at 20:26, by Mego
With all these problems we've been having with SE, I wonder if it would be worth it to move PPCG elsewhere
since ppcg and SE aren't a great match
see: not a Q/A site, 6-8 til design, etc.
does anyone know how to do python unit test
@Downgoat heh, I gave you a quick review :P
@Downgoat I won't accept it, I'll wait for Mego to review it instead
@Christopher2EZ4RTZ just to clarify: SE is openID
02:03
@Riker :D
@Pavel omy seems complex
@Downgoat Just see the example
Do I need to __init__.py every directory?
that you changed I think
@Downgoat No clue tbh
Anonymous
@Christopher2EZ4RTZ I don't see a need to
Anonymous
02:13
@Downgoat No.
Anonymous
@Downgoat Flask does that
Oh cool
o/
@Mego I made a PR btw at github.com/Mego/PPCG-v2/pull/10
no model part of MVC yet though
Anonymous
@Downgoat Merged. You also have write access, so you don't need to fork anymore. You still have to branch, because master is write-protected.
02:21
@Mego As I learned, I can actually give reviews and merge PRs, (and I did so earlier).
Presumably Downgoat can now do the same.
Anonymous
Yep
quick question: the answer_votes table has field vote TINYINT(3). Is this like the type of the vote? Or the total number of votes
Anonymous
I'm going to restrict write access to people I trust to not write bad code.
Anonymous
@Downgoat Type of the vote (+/-1 or 0). There's unfortunately not a way to make MySQL only have a 2-bit integer, AFAIK.
Anonymous
@Christopher2EZ4RTZ If you continue to make pointless/stupid PRs like your 404 one, I will block you from the repo.
02:22
@Mego Wait there's not a boolean value
are we doing OAuth, OpenID, or SE auth
No one knows yet, I think.
Anonymous
@Pavel There is, but we need 3 values
Why do we need a 0 vote
Anonymous
@Downgoat AFAIK the only way to do SE logins is to do OAuth. I'm doing research into that now.
Anonymous
02:25
@Pavel For unvotes. We want to track full vote history to allow mods/admins to see voting abuse easier.
Anonymous
Also if we go the SE route of locking in votes, it's necessary
@Mego Wouldn't it make more sense to represent unvote with NULL
Anonymous
Possibly, but that's not clearer than 0. NULL implies that the vote data is missing or doesn't exist.
I suppose.
Can MySQL track history in a convenient way?
Anonymous
You mean a commit log? Or making a history table?
02:30
Yeah, like a commit log.
Anonymous
Yep, if you turn on the setting
how would I get the root path of the python project?
Cool, we can have our own PPCGDE
SO says ROOT_DIR but there is no ROOT_DIR variable :(
Anonymous
@Downgoat Why do you need it?
Anonymous
02:31
We could set ROOT_DIR (or something more appropriately named) ourselves, but there may be a better solution depending on what you're doing
I want to specify static/js/manifest.json as a path to a plugin without needing to do like "../../../static/js/manifest.json"
Anonymous
@Downgoat Use url_for('static', 'js/manifest.json') (from Flask)
oh ok thanks
Anonymous
Flask is great and does all things
    app.config["WEBPACK_MANIFEST_PATH"] = url_for('static', 'js/manifest.json')
TypeError: url_for() takes 1 positional argument but 2 were given
maybe no 'static'?
02:34
If there existed a port of flask for C# I'd be a happy man.
Anonymous
@Downgoat Oh you need the second to be a kwarg. url_for('static', filename='js/manifest.json')
@Mego ಠ_ಠ
How do you even define a python function that must take arguments as kwargs
@Pavel def func(normal_arg, **kwargs) I think
@Downgoat That's awful so I assumed flask had a better way I guess
Anonymous
I don't know why Flask did that - I'm sure there's a justification
02:39
has anyone here used flask-assets before
Anonymous
@Downgoat Negative
I don't want to keep source files in static/ beacuse then anyone can see it
@Downgoat It shouldn't contain any sensitive info and the project is open source
oh that's true
I mean it will contain things like config files and source .scss files unless that is desired
Why not
02:45
oh crap flask caches >_<
sticky header: yay or nay
@Downgoat Yay
Anonymous
03:00
@Downgoat Optional
@Mego We don't have anything for storing personal settings yet
we can store it client-side using localStorage or we can do session idk how sessions work in flask though
In node you can have a middleware that automatically querys the DB for session-related info, not sure about that in flask
Anonymous
@Pavel Nope, but that's easy
Anonymous
@Downgoat Sessions in Flask work just like sessions in anything. You can store session data, and even encrypt it by providing a key to Flask.
Can SQL store dictionaries?
Anonymous
03:09
You can also just straight up load session data from the DB and pass it to Flask
Anonymous
@Pavel You can store basically anything with BLOB
How does BLOB differ from LONGTEXT?
Anonymous
@Pavel It stores binary data
@Pavel blob is for binary (i.e. no char set)
Anonymous
It's like wb versus w for file opening
03:11
Got it. So we can pickle an object representing settings and store it.
Anonymous
Yep
do we have a name for this btw? Are we calling it "PPCG 2" or "Code Golf"?
Anonymous
We could also JSONify it and store it as LONGTEXT
Anonymous
@Downgoat PPCG v2 is the working name. We will need a different name than either of those, because both would run into trademark issues with SE.
Anonymous
Naming things is hard, and I'm crap at it (see: Seriously, Actually), so I'm going to let the rest of you lot come up with a good name
03:13
@Mego Eh, takes up more time and space, and doesn't really have any benefit.
Anonymous
@Pavel The benefit would be not having to pickle/unpickle it, since we'd be working with JSON anyway from the session data
Anonymous
Also JSON is platform-independent, whereas pickled objects aren't guaranteed to always be backwards-compatible
@Mego Yes it is. That's the difference between pickle and marshal, pickle is guranteed to work for forever.
Anonymous
Err right
Anonymous
But occasionally different pickle formats are released (like with Py3), so we'd have to keep track of the version we're using
03:17
@Mego If Python 4 comes out while we're making this projects and breaks pickle, I don't think we're upgrading.
03:41
Name idea: Golfgoat
Is there a way to prevent caching with flask?
nevermind figured out
Anonymous
03:54
Man, the MySQL Connector/Python setup.py script is a mess. It's a small miracle that it works.
@Mego Good thing it does, the other alternatives are either dysfunctional or for Python 2.
Anonymous
@Pavel I'm working on fixing it so that it uses setuptools instead of distutils, so it's actually portable and more functional
Col
Oh, right, I looked at SQLAlchemy but I don't know enough about SQL to see how it's efectively different from the current solution.
ok so there is this thing called autoprefixer and it basically automatically prefixes CSS so you can run it on many more browsers. Problem is, is that on the development machine you need npm to be installed to install autoprefixer. Should I use it or no?
It is stilled compiled through Flask and all
Anonymous
1) Is it necessary/useful enough that the benefits outweigh the cost of needing Node? 2) Are there other options?
04:07
There is CSSPrefixer but the last time that was touched was 6 years ago
webassets says you should use autoprefixer: webassets.readthedocs.io/en/latest/…
Anonymous
Alright, I'll trust your judgment
Anonymous
04:37
Anonymous
Which means we can add mysqlpy to requirements.txt and make magic happen
@Mego Would we still need to run the ordinary mysql installer to configure a MySQL username, password, etc.?
Anonymous
@Pavel Yes, but that's for the sysadmin to deal with
Also all the contributors. Installing MySQL is a pain.
Anonymous
Well, we can set up a public-facing test DB without sensitive info for testing, and give out credentials to contributors
Anonymous
04:43
Also: the setup script in mysqlpy is 100% setuptools, so it's much better in every conceivable way
Anonymous
Also also: my ISP is doing maintenance tonight, so I may periodically/sporadically lose internet access
Anonymous
So if I don't respond for a few hours, that's why
Anonymous
I invited Thomas in here yesterday to talk about server hosting stuff, but he hasn't joined yet
Anonymous
04:58
@Pavel It looks like it works similarly to the mysql-net package for C# - declaring DB stuff in code rather than in SQL strings
(Of course, C# has LINQ, which makes everything better anyway)
@Mego I saw an awful lot of SQL strings looking through a tutorial.
Anonymous
@Pavel I'm looking at this - it looks like it tries to emulate LINQ's fluent interface. I like it.
05:17
@Mego Anything that looks like Linq is amazing and should be integrated into every project
Anonymous
Agreed
Anonymous
Also anything that removes the need to directly write SQL is amazing
05:29
does anyone happen to have a preferred choice of font: fonts.google.com
for headings & body
Anonymous
I'm absolutely terrible at picking out fonts, so I'll abstain
Anonymous
I like the font on the site title in the design userscript
Also we might want to pick out a theme colors/theme objects otherwise it's going to end up looking something like this: vihan.org/p/stories
@Downgoat Ubuntu font pls
Is best font
is ubuntu font on google font though
05:36
@Downgoat yes
oh ok
System fonts also might be a good choice
@Downgoat Right but Ubuntu font is best font
00:00 - 06:0006:00 - 00:00

« first day (3 days earlier)      last day (631 days later) »