#tools-and-devops
1 messages ยท Page 26 of 1
i see
do you have a requirement.txt file?
also, on your repo, you can add the venv folder to .ignore
and it won't send all those docs to your repor
oh true!
because I believe the env will break when moved anyway
unless you move it properly
hm, do you happen to have any good resources for virtual env, I think I have a grasp of it high level now
and then when you go to a different location, you can just reinstall the requirements
or should i just learn by using it and seeing how it breaks
one other thing, you can look into virtualenvwrapper, makes life so much easier
and no prob mate
Pycharm will automatically make virtual environments for you
I feel like my system level installs now are probably a gross mess between python 2 and 3
so virenv's will probably be really good for me
Settings -> Project Interpreter -> gear icon -> Add -> Then select a new environment
You can use Pycharm's default folder or select your own
You can mange packages from the same area in settings
Or open a terminal and activate the environment yourself
On Linux: source /path/to/environment/bin/activate
On Windows: & \path\to\environment\Scripts\activate
the terminal part, is that how I can switch from using 2.7 to 3 (or vise versa) as my default python?
mac
...ah
yeah ๐ฆ
The one platform I don't know
its similar to linux normally
Also the one with the most convoluted Python ecosystem
It's a weird BSD fork that has some of the standard tools, and doesn't have the rest because they're GPL licensed or some BS (/rant)
This is why virtualenvironments are so handy
Is there a tool that automatically formats the code with pep 8 recommendations?
yeah, that's exactly why this is piquing my interest now
sorry for cutting XD
Create a Python 2 one:
python -m pip install --user -U virtualenv
python -m virtualenv ~/py2env
source ~/py2env/bin/activate
Python 3:
python3 -m pip install --user -U virtualenv
python3 -m virtualenv --python=python3 ~/py3env
source ~/py3env/bin/activate
If you get an error about pip not being installed, do this: python -m ensurepip (possibly as sudo)
awesome, added it to my notes and will give it a shot
Doing the -m thingy gets you around annoying issues, and --user means you don't have to use sudo
@cunning fog Yes, several. Two I know are black (https://github.com/ambv/black) and yapf (https://github.com/google/yapf)
awesome, i'll man them too and read into it a bit more. Thanks!
Cool
Python actually has a virtual environment tool built in, venv
It's called venv on Python 3 at least, dunno on Python 2
But it's a little more limited than virtualenv
Oh, apparently there isn't a Python 2 version of venv
This might be worth reading: https://stackoverflow.com/a/41573588/2214380
bookmarked!
It's a 3-5 minute read
it worked thanks @forest bay
the yapf
but sometimes it doesnt work is strange
nvm, I just misused it Its working right now
yes it did
Nice, I'll have to try it again sometime. Ran into some issues when I tried, but also didn't have a whole lot of time to spend on it.
Yeah the thing is that you have to write a code instead of just clicking a button like autopep8, but the final result is much better for yapf imo
I heard something cool today on TPTM called https://pyup.io/ it checks dependancies and stuff your project requires for known security vulnerabilities
That sounds wack, nice
I've got a dependency that I've pulled from GitHub. How do I force pipenv to update it? pipenv install tells me the requirement is already satisfied, is there no way to pass the -U flag to pip? pipenv update doesn't do anything either.
try pipenv lock and then pipenv sync --dev
Then try rebooting and installing gentoo
there's also pipenv clean
if it completely refuses then: pipenv --rm and pipenv sync --dev that gives you a fresh env
Time for Gentoo you mean
how the fuck do i download emacs on windows 10
EMACS on Windows...that seems like heresy
Forgive him, Father Stallman, for that he has sinned. ๐
Hello everybody ๐๐ฟ
I'm trying to lint my files with pylint that import arcade (game library built on pyglet), but linting an empty file that only imports arcade takes 3 minutes to run and I have no need to lint the library itself. Somehow I fail to find documentation on how to skip checking a module, without having to modify the module itself (which I don't want to have to do, it's not my module), despite intense searching. I assume there must be some super easy fix and that it's a super common problem ... but yet I fail. Help?
I'm doing this for a course and want my students to quickly lint their own files, so putting this into CI is not an option.
@glass kindle Is the library also part of the project you're in?
Is there a physical separation somehow?
You can use a tox.inifile to exclude directories
well
assuming you're linting with flake8
the actual file you use depends on the tool
arcade is installed with pip so it resides in a completely different path.
I've been using pylint but if it's easy to do with flake8 I might use that instead
running flake8 on my files were instant, so looks like it's ignoring imported modules by default perhaps
sweet. I'll use that instead then. I don't really care too much about specific features, just that students try using some sort of linting so flake8 will do the job. Thanks!
If you find flake8 doesn't catch everything you want
it supports plugins
eg flake8-bugbear, flake8-import-order, etc
it's handy to look around at those
there's no configuration, you just install them and they work
good to know
pycharm automatically reformats file as the style guide says, why need flask8?
nope
Ctrl Alt L
it doesn't follow the usual style guides to that letter
it follows most of pep8
but not every project follows pep8 that closely
oh
most linters - eg flake8 - are much more strict as well
you need to understand that linters are a smaller part of a larger toolchain
But the ide's file reformat settings?
you set up a linter with your project's style guide so that you can enforce a consistent style across your entire project
usually, you use it as part of your CI process
so, someone pushes code
the CI server tests and lints the code
and rejects it if the code doesn't lint
oh
it's also way easier than forcing people to update their IDE settings
and it can be integrated into the workflow - eg, with git hooks
cool then
they're a very valuable part of the development process
although I agree that PyCharm's inspection tools are nothing short of amazing
you need to have more safeguards than that
linters are ๐ฏ the best part personally is how much I've learned by having bad coding practices pointed out to me
Octodude, is there a plugin or some other way to make pycharm check like flake8?
@plain saddle unfortunately not
There's a ticket open to have inspections driven by external tools
but it's not in yet
Okay. Thanks for the info
how can i make vscode always look at variables
how can I make PyInstaller use Python 2.7.10 instead of Python 3.7 (I am aware that it doesn't support 3.7)? I'm using it on a script that was written in 2.7 and python --version returns Python 2.7.10, but when I use PyInstaller it always outputs "Python: 3.7.0"
You need to make sure you use the pyinstaller installed to that interpreter
assuming it's a runnable module, python -m pyinstaller should work
@winged karma That question doesn't make sense, can you be more specific?
VS Code isn't an IDE though
Because it's fast and light
There might be a plugin for it, but the developers do not intend on adding such a feature
It seems the scientific community has gravitated to this IDE https://github.com/spyder-ide/spyder for reasons not completely apparent to me. From what I can see - there is a rather splendid variabl...
@copper compass thanks a lot! for some reason i derped and installed it with pip3 the first time around. now i'm getting a different error message but i think i can fix it.
No worries
@copper compass sorry to bother you again, but I was trying to add a folder with pyinstaller. So I did pyinstaller --add-data 'resources:resources' myscript.py and after I made the dist folder it contains both the executable as well as a folder called resources with all the files in it. But whenever I try running the executable I get "No such directory or file: 'resources/file.png'". I checked and resources/file.png is in the dist folder with the executable. Do you know what is going on? thanks!
didn't work 
does anyone know how to set up Eclipse style auto completion for parens/backets/quotes in Pycharm?Using Tab
https://youtrack.jetbrains.com/issue/IDEA-74666 this is original topic about Tab issue,but,it still doesnt solve my problem
do you run that version of pycharm?
It is an Early Access Program
PyCharm 2018.2 EAP 6
this is the latest early access version of pycharm 2018.2
Whatโs the best way to celebrate your independence? Fireworks and hot dogs go great with a hot new EAP.ย Get PyCharm 2018.2 EAP 6 now from the JetBrains website! New in PyCharm Setup.py support has โฆ
@civic hound thank you,just download EAP it work well
oh my bad,I didn't check my pycharm's version
that is no problem, luckily your latest screenshot gave me the answer you needed
I have to read carefully next time,however,thanks for helping ๐
You can use Jetbrains toolbox to keep your apps up to date automatically
There's a free download the website, price is for the licences themselves not the toolbox software itself
Has anyone used the dyanmic django scraper app? any feedback?
would you recommend pycharm to a beginner or should I use smth else
It can be difficult to know where to begin when you are first starting out with Python. On our website, we have compiled a list of both free and paid resources that we recommend for learning and mastering Python.
It is hard to say exactly where you should start, as everyone will have a different prefered method of learning, but whether you like video tutorials, books or courses, you should find a suitable resource on our resources page
There's a listing for IDEs here
Alrighty, I'm using my dads computer now because I do not have my own. After commiting and pushing the README.md (followed the instructions from gitlab), my dads full name came up on the commit and it said it was "authored by " my dad. Is there a way to remove the last commit from gitlab or at least remove my dads name from there? ^^
@vague silo ^ ๐
yeah, although it's somewhat complicated
if it's the last commit it's a bit easier
is it?
$ git commit --amend --author="Beat Su <email@address.com>"
and then ```sh
$ git push -f
to overwrite the history on the remote
found on https://stackoverflow.com/questions/3042437/how-to-change-the-commit-author-for-one-specific-commit#3042512 btw
@vague silo I ran the first command and it says "Please enter the commit message for your changes. Lines starting with "#" will be ignored, and an empty message aborts the commit."
And then my name<email>, the date and at last the commiter (Which now has my name, but still my dads name as well because it is his pc (dad@dads-macbook-pro.home))
commit message != commit author
for commit message, you can just leave that for amending
it will use the message from the last commit by default
just re-run the command and remove that from the message there
message and author aren't edited in the same field afaik
I didn't quite understand, but I cant write anything in the terminal now
Pressing enter only goes to the next #
@feral willow let me guess, it put you in vim and you don't know how to use vim
I dont know what vim is
It says ""Please enter the commit message for your changes. Lines starting with "#" will be ignored, and an empty message aborts the commit.""
ok... type this key sequence exactly to delete everything and quit vim to abort the commit: ESC, ggdGZZ
And everything is after # on each line
then export EDITOR=nano and do the command again
and hten ggd Shift+G and so on
gg moves to first line, dG deletes to end, and ZZ saves and quits
There
(If you're interested in learning vim, I'd be willing to help, but it'd be easier to just use nano to solve your problem for now)
now run nano to check if it's installed, then export EDITOR=nano, then do the commit command again
exit out of nano and do that in your shell, yeah
then when you do the commit command it'll come up in nano instead of vim and you'll be able to edit it normally
It says "Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?"
aaaa I dont understand any of this
in vim?
it's the temp file for the git commit message
This is really confusing
it should already be filled in with /whatever/.git/COMMIT_EDITMSG
I never wanted to change a commit message though
I only wanted to change the author of the last commit
you don't have to change it - it comes up with the original commit message and you can leave it alone
Or just delete the last commit all together with no traces
ok
So what do I write for "File Name to Write: "?
...it's not already filled in?
No
i asked, is this after you did the export and commit command, or did you just run nano by itself
i can't see what you're doing
ok just don't save then, i said multiple times "if this is after you did the commit command" and you didn't correct me
sorry i thought you were after that point since you were asking about the export command
Do I write export EDITOR=nano now?
yeah
then run the commit --amend command again, and you should be able to just exit without changing anything if you don't want to edit the commit message
i just realized, there's a --no-edit option you could have done to skip all this
Oh
Ok so I exited the nano editor thing after doing the export command
And ran the git commit --ammend command again with --no-edit
Maybe that wasn't the wisest choice
well what shows up now in git log
In git log theres a commit and it says the author is me
@sinful zinc Sorry for late answer, had to put my brothers to bed
do I just push now?
yeah
if the commit with the wrong author was already pushed you'll need --force or --force-with-lease (the latter is safer in cases of shared repositories)
ok, the last commit was pushed
So do I use --force or --force-with-lease? ^.^
I have also only ever used git push
Nothing else after that
Except for setting up repositories when it says git push -u origin or something
So shall I run git push --force-with-lease?
Or shall I add -u originor something in there?
@sinful zinc
just use --force-with-lease
there's not a downside to it other than being slightly longer to type tbh
so git push --force-with-lease?
yeah that should work
-u was only really needed once and the whole point of it was to make it so you didn't have to put origin every time
It said remote rejected
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
do you own the project or is it a shared project? you'll have to go into gitlab and change the settings
it might have made more sense to just delete the repository and start over if creating the readme is all you have
there's probably some setting in gitlab to unprotect the branch
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.
Ok i managed to delete it
or do that i guess
I'm just starting over
ok
So now I want to create a respository and be able to commit to it with my name, not the one from the current user I am on or computer name
ok
did you set up git config --global user.name and user.email ?
that's how you make it use the right one by default
(it can be a repository setting too, but it probably makes sense to set it globally)
ok I have done that a while ago
I guess I will do it again just to be sure
Can I choose not to show an email instead?
i mean, you can put anything you want in that field, technically, if you don't want your real email address, but i don't think you can just leave it blank
Oh okay
Ok
so if you really don't want to include an email address, just git config --global user.email '<>'
Ok done
Now, to add, commit and push files, I just do git add ., git commit -m "Message"and git pushright?
yeah
if you're going to use git add . you should list any files you don't want included (like *.pyc) in a .gitignore file
or you can git add specific file names instead
Ok, I created a file called run.pyto test
I ran git add ., git commit -m "First test commit" and git push
Nothing is happening now though, it is just blank after
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 258 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Ok there it finally finished
Took 1 minute
Sorry ๐
Alrighty, thanks for the help
yeah no problem
Aaaa git is annoying me
I'm just going to go without it because I don't understand anything and if I make 1 mistake, I have to run 5 commands and change some settings to revert it
eh, basic git is just git add, git commit, git push and git pull, plus maybe a hand full of lines you need once to set it up, which you can copy from somewhere...
it's really not that hard as long as you don't do complex stuff
@feral willow it's completely normal, i also felt overwhelmed with it at first. but once you understand it, it's really great to use
@lost rock I think I've got that in place, but undoing commits and stuff, I find it easier just to delete the repository alltogether and start again
--hard
Does anyone know why FROM python COPY ./src CMD ["python", "/src/get-pip.py"] in Dockerfile yields an error when trying to build
what's the error?
Error response from daemon: Dockerfile parse error line 1: FROM requires either one or three arguments
Very new to Docker so don't know what to make of this
just to be sure, is it all one line, there or is your dockerfile actually three lines?
it's all in one line
okay, I believe that's the issue, try it like this:
FROM python
COPY . /src
CMD ["python", "/src/get-pip.py"]
and mind the space between the . and /src
Thank you!! it work
๐
After pulling mythril/myth and running docker run -v $(pwd):/tmp mythril/myth -x /tmp/contract.sol I get an error: C:\Program Files\Docker Toolbox\docker.exe: invalid reference format: repository name must be lowercase.
I renamed my .sol file to exactly what's here (https://github.com/ConsenSys/mythril/wiki/With-Docker) and ran that exact code
@dusk elbow Security analysis tool? @deep estuary didn't allow me to share my security analysis tool. bad people can use it too.
uh it's public
kip, your security tool was a bruteforcer last time I checked
Not going to be shared here kthnx
it is same harmful as his project
but it looks like nothing in the repo is uppercase so i'm confused by the error
@dusk elbow I wonder if the real problem is actually the $(pwd). Seems you're running this on windows?
Yes I'm running on windows, what should I use if not pwd?
try giving it the actual path instead, depending on what terminal emulator you're using pwd might not even be supported, it certainly isn't in standard cmd
however it does exist in powershell, but returns an object not a string (as powershell does with everything)
so do I give the full path with C:// after docker run -v
if you are using the powershell terminal this might work: docker run -v "$(pwd)".tolower():/tmp mythril/myth -x /tmp/contract.sol but I am completely guessing right now :D
I suspect the problem is that pwd returns a string that contains some uppercase letters
I'm using the Docker Quickstart Terminal
alright, then I have no idea what to do
I can't even find the dir /tmp
what do you get if you pwd in the quickstart terminal?
that certainly contains some uppercase letters
looks like the quickstart terminal is some form of console emulator, so it's trying to be as linux-like as possible
which means C:\ gets turned into /c/
so the real issue then is that this: /c/Users/GuapFIEND/Docker Toolbox contains uppercase characters, and the docker command is not happy about that
if you can, then maybe yeah, might be worth a shot
Now I get the error docker: Error response from daemon: create $(pwd).tolower(): "$(pwd).tolower()" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path. See 'docker run --help'.
Same with docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path. See 'docker run --help'.
Running docker run -v cd:"C:\dockertoolbox\" mythril/myth -x contract.sol I get "docker run" requires at least 1 argument.
is there any tool/library other than matplotlib for graph building?
Any tips for learning git or just play around and read the docs?
ms paint
Depending on what you want to do, I think sucking it up and learning Matplotlib is worth it, even if only because most other plotting libraries are build on top of it.
Ya, Bokeh is an option. Pandas has a quick and dirty plot interface, if you're using pandas.
I've used seaborn quite a bit because it's pretty but I can still fiddle with the matplotlib knobs:
oooooo here's a list: http://pythonplot.com/
Git...
- https://try.github.io/
- http://ohshitgit.com/ (some of this is pretty advanced)
- https://git-scm.com/book/en/v2 (despite having "Pro" in the name I think it's pretty balanced, at least for the early stuff)
- It looks like https://blog.github.com/2012-07-04-try-git-in-your-browser/ got nuked, which is a shame
is there a reasonable way to get native python, native pip, native bash on android or is that a pipedream? i've only seen sandboxes which doesn't really fit what i'd like an environment to be
i'd assume if there was it would be a root kind of thing
Not AFAIK

figured, i'll keep on looking but i think that's fundamentally counter to the "app" model
i have probably the most absurd reason for wanting it: in my go-bag, i keep an android tablet with the 65gb full text + pics wikipedia, and would appreciate if i could still do data science in a post apocalyptic world
gnuroot seems to be the closest thing i see, but it's still a sandbox, and maybe that's a good thing
guys somebody uses syntastic in vim to programming ?
i use ALE, works pretty good
that one should fit most of your needs https://atom.io/packages/ide-python
although the installation is a bit more complex than hitting install in the atom package search
@heavy knot
wich one is better for python: pycharm or vs code?
Pycharm is a more fully-featured IDE, where VS Code is just an editor. If you want something lightweight and easy to dive into, use VS Code. If you're familiar with Python already and want professional-grade features, debugging, autocompletion, etc., use Pycharm.
Hey
I'm on a mac and I had to run some commands in order to see files beginning on ".". Is this easy to revert back to?
@vague silo You helped me with showing the "." files before in #help-coconut :P
Yeah it is, one second
try defaults write com.apple.finder AppleShowAllFiles FALSE
and then killall Finder
since you used TRUE to show all
thx Lord :3
hey i need help setting up nginx in docker compose, I am getting this error when trying to complete the build
ERROR: Service 'nginx' failed to build: lstat nginx/nginx.conf: no such file or directory
but the Dockerfile is in the same dir with nginx.conf
seems like it's searching for it in a subdirectory named nginx though
I responded in devops already
oh, I just noticed it got spammed over half the channels...
Posted in multiple locations, kind of annoying, yeah
does anyone have a list of small python tools or utilities that added a lot of quality of life to their development process, or can someone explain to me a good programming workflow? I feel like that gets skipped over a lot I feel like there has to be a better way than notepad and powershell
bot.tags.get("resources")
It can be difficult to know where to begin when you are first starting out with Python. On our website, we have compiled a list of both free and paid resources that we recommend for learning and mastering Python.
It is hard to say exactly where you should start, as everyone will have a different prefered method of learning, but whether you like video tutorials, books or courses, you should find a suitable resource on our resources page
the editor part there
also git together with github and/or gitlab is very nice
@jagged spire
thank you! Sorry I apparently missed that while reading the intro ๐ฆ
does pycharm have good integration with git? also, is there a way to use it with pipenv?
or integrate pipenv
you shouldnt use pycharm as a beginner
but yes pycharm has extremly good integration with git
like all jet brains ides
and pipenv
well pycharm operates using virtualenvs so you could tell pycharm to use the virtualenv generated by pipenv
Nix - I'm a beginner and I use pycharm. Why shouldn't I, as a beginner?
could you give a few examples?
all the autocomplete
all the imports
it does stuff for you you may not remember when you dont have it
and thats a problem because you cant always exepct pycharm to be present on your machine
I don't know anything it 'does for me', as such.
the autocomplete, sure it suggests what you can type from there, but itsn't always applicable.
im sure lemon or gdude can tell you a lot more
im just repeating their words
ยฏ_(ใ)_/ยฏ
I think it's good that pycharm rants about PEP compliancy for you
Also Ctrl+B is a godsend (vscode has F12 but it doesn't go as deep)
Also docstring autoformat
I have been doing python dev for a while now so I am looking for something to make development not as much of a pain in the ass
fortunately I got pycharm for free with their student license
pyhcarm is perfectly fine to use as a beginner, thats what i used initially. Although i do use vscode for quick projects.
But pycharm will setup git, publish it to github, sort out virtualenvs (or in the latest release pipenv) take care of .env files, sort out .gitignore.
it does a LOT of things for you
PyCharm Edu is good for beginners
But it's widely accepted among most communities that you start with an editor and not an IDE
I began with PyCharm as well
I won't use anything else lol
I can see it being overwhelming
For someone ENTIRELY new to programming
It's not about how overwhelming it is
I don't agree with Zed Shaw on much, but he gets one thing right in the LPTHW introduction:
The one skill that separates bad programmers from good programmers is attention to detail. In fact, it's what separates the good from the bad in any profession. You must pay attention to the tiniest details of your work or you will miss important elements of what you create. In programming, this is how you end up with bugs and difficult-to-use systems.```
It's about learning the fundamentals without a tool that does things for you
well, mostly right. I wouldn't call it "the one skill"
but yes to that and what G said, using tools that spot your mistakes for you hampers your ability to spot incorrect syntax and idioms without the aid of those tools
that's a large part of the reason we strongly advise that new programmers train their eyes before they switch to productivity enhancing tools
I think being lazy is a good thing. getting rid of tedious things is almost always good
it's sort of a give a man a fish/teach a man to fish situation. PyCharm is a fishing machine that does a lot of the hard work for you, but if you find yourself without the fishing machine, the fishing machine breaks, or the fishing machine starts catching the wrong fish, it would be good to be trained as an expert fisherman so you could handle the problem yourself
I like that analogy
yeah that works
hell i only just learnt basic stuff a few weeks ago, because i just used VSCode exclusively for a while
so i agree, but someone did say that, it can add even more confusion to an already confusing start
how I can make pycharm autocomplete methods from a new library I downloaded?
it works for some of then but not all
I have set up Sublime. I have made a factorial program. the program works fine as I have used it on other IDEs. On Sublime when I input a number and press enter nothing happens.
Perhaps you should request support in the sublime text server
wheres that?
So I can't input in the bottom box? why?
which editor should i use? i've been using sublime just cause i already had it when i started, but is there anything i should consider that looks/works better for python specifically?
It can be difficult to know where to begin when you are first starting out with Python. On our website, we have compiled a list of both free and paid resources that we recommend for learning and mastering Python.
It is hard to say exactly where you should start, as everyone will have a different prefered method of learning, but whether you like video tutorials, books or courses, you should find a suitable resource on our resources page
There should be a list of editors suggested on the resources page
thanks ๐
does visual studio code allow for running programs within the editor?
what i'm doing rn with sublime is writing the thing, then using cmd, but it's pretty wonky
sublime has a code runner as well
oh?
iirc it's something like ctrl + b?
ctrl+b for me, on windows
That would be it
ctrl + g just opened up a weird white thing at the top
pretty sure that's not it lol
Try b, I just remember it being in that general area
yeah, that worked. thanks
ctrl+g jumps you to a specific line if you type in a line number
ohhhh, that makes sense. thanks lol
ctrl+p and you can jump to a specific file if you type in the file name and it's in your project list
handy dandy
gosh golly darn
inorite
but uh, the code runner doesn't seem to let me input
no it only shows output
then where can i input things for the script?
I don't know actually
I guess executing in sublime is not that useful in this use case :(
You could just simulate an input with hardcoded input.. but probably not as favorable
I don't think vsc likes input either
crap
that kinda invalidates the point of making a code runner lol
then i'm not sure which editor to use
Can probably change it somehow given how this message is formulated. I just never bothered to find out
oh right, vsc as built in terminal
and code runner?
Code runner would work if you're testing things with hardcoded inputs and prints etc
While you can test the rest with the built in terminal
wait, so
can i run a program with the code runner and use the terminal at the same time and use it to handle inputs?
yeah, so i can use it to take inputs while running
In the terminal yes.
Using the code-runner addon it will just continuously wait for an input you can't provide
then what's the point of it?
Running anything that doesn't include input ๐
oh, so you mean boring programs ๐ค
Ehm, subject to own opinion I guess
Python can do a lot without the use of a userinput
but you're not gonna get the interactive aspect from it
And there are other forms of input anyway
That too
I mean, when was the last time you opened an application and it asked you to type into a terminal?
Does your browser do that? :P
but your browser isn't gonna do much if you don't tell it what to do after booting it up
also, does sublime have any way of getting the terminal?
I bet there's an package you can install to get that
Yeah but you don't interact with your browser by typing text commands
it's still user input
why are you hating, interactive cli tools are neat
yes, but it's not input()
You know what, just use some module like tkinker and make your own input terminal that would work with code-runner 
๐ค
i don't think i'm quite there yet
i spend half an hour earlier trying to make a program that removes decimals from a number, before i was told by a guy in another server you can just int(float(var))
still fun to do lol
and it's a way to learn too
That's an achievement in itself, to find the alternative ways of doing things
absolutely
that's what i like about coding, you've gotta think outside of the box and find solutions
And if that doesn't work, there's always a hacky way to do it ๐
๐ค
Hello

hey guys, i have a quick noob question about git which i suppose fits into here
does 'git clone ...' autoupdate?
what are you trying to do, and can you link what you're looking at?
i'm looking at this link atm: http://www.thisprogrammingthing.com/2013/automatically-updating-your-website-using-githubs-service-hooks/#
i have some code hosted on pythonanywhere
i cloned the repository in a terminal on the service, i want to be able to auto deploy whenever i push to the repository from my machine
it seems a bit involved, i think i'll be fine if i simply git pull each time i push to the repository
actually it's not so bad, it doesn't have to be super complicated, I run a small flask app that acts as my deployment starting point, that does exactly what this article you linked do, but using python instead of php obviously
i have a small flask app as well lol
you can basically set up github (or gitlab, or even bitbucket depending on what you're using) to send a webhook to the deployment app and have it pull the new code
yeah
to make it even more pro looking you could even set up CI with travis-ci and build and test your code, and have that send a custom webhook to your deployment api
are you familiar with using CI?
nope, i've never used CI before
never even heard of it ahaha
my app is only a personal project, i think using CI would be a bit overkill in my case
CI is super useful and it's well worth learning how to use, I can't recommend it enough, even for personal projects
and for coders who want to look favourable for potential employers it's a must
I'd be happy to help you get started if you want, a fair few people have already gone down this road too, so there's plenty of people here who can assist you
listens in
(plus it's fun, but I am biased because CI is my job)
listens in
:D
I feel like I should set up a reference repo
in fact I think I'll just do that now, but I gotta finish my lunch first
It's 2 pm

How are you having lunchs-+
I had a big breakfast, wasn't hungry until now :D
CI looks pretty nifty
for my next trick, I'll convince Viibrant to use docker \o/
I'm just going to point out, all this is alien to me.
I'm not being super serious, though docker is also very neat, however not super important right now, but CI is definitely the next step in your coding career
well you've come to the right place, cause ya'll gonna learn you some
Ready to learn
that's where my interests really lie but i'd like to touch up my general programming
any who, give me a minute to set up a repo and stuff, and then we can talk about what's going on
cheers dude
yeah that's always an easy thing
now I just need travis to actually build, which it for some reason does not want to do right now
ah I've named the travis file incorrectly
confused it with gitlab ci's build config naming convention
alright so, @hushed orbit @lapis hazel and @heavy knot here's the reference repo https://github.com/Inveracity/ci-reference there's a lot of files in there but I'll try and explain it as best as I can, and here's the current build of the code https://travis-ci.org/Inveracity/ci-reference
it's doing a build!
in a minute we should see the build either pass or fail depending on whether my lint and unit test are good or not
we're good, nice
in travis it collapses output to make the run easily digestible, you can expand the output using the small grey arrows on the left hand side
there's a line that says $ bash scripts/deploy.sh
if you expand it, you'll see it says "deploy"
in the repo itself you'll find the .travis.yml file
this file is what tells travis what to do
how are dependencies sorted out?
on line 24 and 25 in the travis file, you'll see the line - bash scripts/deploy.sh
python packages or are you thinking databases and other services?
packages
I see the pipfile
how is that linked to the travis yml?
oh actually I assume it's the command on line 18
exactly
please carry on
so the end goal is getting the lint and test to pass and finally deploy the code
so line 24 says "after_success" which tells travis only to run the deploy script if nothing fails
a failure is determined by commands returning exitcode 0
so you put whatever stuff inside the deploy.sh to deploy it to whatever platform i assume
we run the lint and test through pipenv commands, not because it's the best idea, but because it's a simple way to ensure we're inside the virtual environment created by pipenv
that's correct
nicee
the linter I'm using is flake8, but you can essentially use whatever you prefer
the tox.ini file in the repo determines what pep8 rules to follow and other things
the unit tests use pytest, and the unit testing is pretty straight forward
it runs the flask app and makes a mocked request to the root endpoint and expects it to return status code 200 and the other test expects it to return a dictionary object {"hello": "world"} which should pass, otherwise flask would be horrific
so those are the very basic
finally the readme contains the little badge, and it's a lovely little thing that'll tell everyone who looks in your repo that your code is solid
however it appears didn't add it correctly
the readme?
the badge in the readme
I'll openly admit this is above me ๐
me too but we gon learn
I know it's a lot to take in at first
I haven't used most of the other tools mentioned either, so i can't draw any connections
you could still work it out though
I am but a simple programmer 
bring the general concepts together
all these tools, flake8, pytest, pipenv are in my opinion foundational for every python programmer
That's why I'm still here
good good
alright so, if you wanna try all of this, I urge you to create your own repos, connect your github account to travis
and then try a minimum thing
and a minimum thing can look like this:
# mything.py
print("yey")
# .travis.yml
language: python
python:
- "3.6"
script:
- python mything.py
actually i have a question
what's the best free host to deploy to that integrates with travis?
i'm thinking heroku but that has a cap on the number of hours per month
I'm not sure actually, I've always paid for a VPS and I like to make my own automation, so I deploy everything to those
cool, I've never actually tried heroku, but I like the idea of it
any ways, that's kind of it, feel free to ping me any time btw, I might not always be around though
thank you for your help today
excellent, and this dude (bar pipenv) does everything you need too
really bloody useful
oh actually i cant use pythonanywhere
ssh isn't supported for free accounts rip
is Slack worth using as well?
sentry**
i meant sentry whoops
it definitely is if you are writing huge applications and have a big team deploying code every day
i'm guessing not for personal use then
also actually i'm not going to use flask
i'm trying to deploy a telegram bot and i was using flask for posting but i've just realised that the bot library has webhook functionality built in
this is all pretty general, you can write anything you want
oh ok
I'm new to Python, going on 3 months. I'm looking for some advice on IDE choices. I know lots of people have opinions of which ones are good or less-good.
Right now I'm using either Eclipse with PyDev or IDLE. I like IDLE better, but it's missing a few options I keep going back to Eclipse for (or I haven't noticed the options are available.) In general I don't like Eclipse; I have a strong K.I.S.S. mentality and my unusual background in programming didn't expose me to lots of the functions an IDE like Eclipse has.
First, I like the outline explore window for hopping around the file. Second, I like the passive error checking. I'd rather not have to execute the code to find out I forgot the ":" at the end of an if statement.
A couple clarifying things: I am writing scripts for a stream chatbot, which means I am not writing .py files which are their own executable, and it has to be good for Python 2.7
Normally I'd recommend PyCharm (as many would do here), which is a great IDE with many features, but as you're looking for something more simple, that might not be your cup of tea. I'd still suggest you to have a look at it if you don't mind.
IIRC we have a list of recommended IDEs and editors on the pydis website.
bot.tags.get resources
It can be difficult to know where to begin when you are first starting out with Python. On our website, we have compiled a list of both free and paid resources that we recommend for learning and mastering Python.
It is hard to say exactly where you should start, as everyone will have a different prefered method of learning, but whether you like video tutorials, books or courses, you should find a suitable resource on our resources page
i thought I remembered reading you had that resource somewhere, but I was mis-remembering it to be a channel. Thanks @lost rock
I see the bot responded in channel, but it has no message. Was there supposed to be something there?
@open mason vsCode has been great for me
vscode is very nice
sublime text is good as well if you have other stuff open because it's lightweight, it's not an ide though
Anyone here know about vscode tasks. I want to run a task that can send a command to the integrated terminal but am struggling as a lack of documentation and simple examples
Would it be better to do it as an extension
okay so pycharm has a search bar in the top left of the settings menu
suuuper useful
it does?
where is this
search for "theme" and presto!
how do I access this
you just open settings from File - Settings (or CTRL ALT S)
and then the search bar is in the top left
search for theme and click appearance and you should see your themes there.
huh, what version is that?
2017.1
anyway all the good themes are plugins so you might as well search for plugins
oh you might be in the wrong place there
where is the right place
you're in the Default Preferences
it should just be Preferences (or Settings on the version I'm using)
default settings
I'm using 2018.1.4 on linux, and I frankly have no idea where it is on mac.
maybe i should update
yeah, just realised it needs to actually be settings
I dunno where it is on mac either tbh
I'm on 2018.1.4 as well
click more at the bottom
i did not see.
oh, apparently it's called Preferences on mac? wut
he found it
no i didnt
oh
thats a py file
what about the wrench thingy
Maybe you need to update.
you're using a PyCharm that's like
over a year old
yeah I didn't realize it was that different, though
but just grab the latest version
it couldn't hurt
yeah
While on the subject of themes
Can i make pycharm look somewhat similar to my vsc atm 
why are you not using atom
You can set up your own colour themes
if that's your thing
but I prefer the material theme plugin
Can I modify icons as well?
you could probably make it look reasonably similar to that, yes.
I like cute high saturation icons
all colors can be fucked with
hey @hushed orbit, do you like COLOURS?
2018.1
Colourssssssssss
hot new logo
Sounds about right
dun dun dun
still goes to shelf
Naijs, just have to turn up that saturation a few notches 
You could wipe your settings and start again if you managed to break it
actually i think it was there before too
ok lol
still can't find it
what the fuck
ok
@hushed orbit Take a look at the Rainbow Brackets plugin, and also "semantic highlighting" in the settings
semantic highlighting assigns colours to variables by name
ooh material looks nice
and rainbow brackets.. well..
im definitely going with material
lol, neat
what do I after I've downloaded the theme
@copper compass also, how do I get rainbow brackets like yourself
Install the plugin and restart pycharm
That's a plugin
it's called rainbow brackets
Once the material theme is enabled, you'll get some new buttons in the toolbar
I have a bunch of .jar files
I should really get into the features of pycharm now that I like the look of it, at least before my pro runs out
oh shit I didn't know about rainbow brackets but that's lit
where is it
settings -> plugins
type plugins. go to browse repo
These buttons are what you get for the material theme plugin
that'll let you configure it
install icons and such
for some reason my screenshot keybinding does nothing when I have a menu open, but yeah
it's in there
ok
i got it
i think
still can't select it
oh
restart
yes, of course
ok what the hell
this is not what i installed
how do I get this
I told you
You click on the icon that has 2 circles within each other
click the toolbar buttons
this one
harha
yes
wait
is this it
yes
harha
i have achieved holiness
now i want more power
now i want
RAINBOW BRACKETS
Where do i change colors exactly?
Oh, i thought it was part of the Material plugin
Wow, ok. I can use a color picker from pycharm on my vsc. Perfection 
:>
what if you have 6 brackets
Where do I set line number color, and the color of open files? I've managed to change most other colors by now
Search for 'em
I tried, that's where i got most other pallets
Welp, line number was not there last time i tried.
It's great, isn't it? :P
Well, actually. I found line number. But I am not allowed to check background color for it?
hm, not sure about that
Might have to swap colors around then.. right now all bg colors just blend together
except project tree
rainbow brackets are beautiful!
^^^^^^
how do i get pycharm to actually update my files on git
ive tried commit and push and neither seems to update the repo
Push should, well, push, the files to your upstream repository (aka the thing you see on github)
Weird, push worked that time
Dropping this here. Lets you use your Python code for IOS, Android, Windows, OSX, Web Apps, etc.
hi guys, why might something install as an egg with python setup.py develop
instead of just linking to a packages directory?
@barren iron do you use a custom theme or something else. I love the look of yours
@crystal depot it is @mint briar s deadly combo
Ayu dark theme with Fira code
Them rainbow brackets
It looks deadlyyyy
cool iโll look up ayu dark mode
Does this mean I can use my scale way server as a full OpenVPN host?
(taken from the scaleway info page)
is Atom good for python?
atom is good as an editor, but it uses electron so it'll probably use a lot of memory
i find that VSCode and sublime 3 are recommended more than atom
vscode is getting more python features, but sublime is simpler but is still very useful
hey @heavy knot, welcome to our server!
we actually have a section in our FAQ for this that thematizes this, and and accompanying resources page for editors: https://pythondiscord.com/info/resources#editors
imo there is no "good" or "bad", just use what you're happy with, what's important is that you have the tooling to run python code and if you're using a text editor then you most likely already have that in another place
hi
@delicate gorge You were saying ...
first of all neovim has ofc integration for basically all languages implementing its protocol
so its a lot easier to make plugins for it
=> more plugins for neovim exist + neovim is backwards compatible with all vim plugins i tried
then ofc
there is async
but
thats plugin related again
tbh its mostly plugin related
if you are working without plugins they are pretty equal
New pycharm out bringing pipenv integration to us folks
nice
Oh, nice
Well I'm no science rocket, but it looks like Intellisense can't find that module
hey guys, i'm having a little trouble using git rebase
i'm trying to rebase to master, but any possible chain of commands I can think of I get fatal: needed a single revision
what specific commands are you trying
git rebase origin, git rebase origin master, git rebase (ticketname)
git rebase origin/master
though is that really the error you're getting with the ticket name (tag?)
i think I might be doing something pretty dumb - origin refers to the specific name of my checkout branch right?
origin is the name of the remote repository
my branch name is tickets/number
i.e. github or whatever you cloned from
wait
when i git rebase origin/master, do I use "ticket/number" as origin
or literally the word origin
git status
On branch tickets/DM-15004
Your branch is up to date with 'origin/tickets/DM-15004'.
if not you need to explain your situation more clearly
git rebase origin/master
fatal: Needed a single revision
invalid upstream 'origin/master'
is there a master branch?
git log --all --decorate --oneline --graph, do you see origin/master etc?
git show-ref - do all lines begin with "refs/heads", "refs/remotes/origin", "refs/stash", "refs/tags" etc? sometimes weird errors from reference name come from accidentally having created a reference that's not in the proper namespace
is there a local master branch? if you do git checkout master and git pull what do you see
lots of refs/tags/
is refs/remotes/origin/master present
is present
