|
Boris Galerkin posted:Why not use tempfile for temp dirs? Iirc a tempfile.TemporaryDirectory should automatically clean itself up if you use it in a with statement, or you can call its cleanup() method explicitly. Doesn't work for me right now (needs to be long-lived but cleared before next run and other code depends on it being not in OS temp dir) BUT definitely filing this away for future use because it looks so drat useful I'm sure I could use it other places. Being able to delete crap when the context manager closes is gonna be a useful thing and I never even considered there might be a module in the STL to do it. mr_package fucked around with this message at 06:59 on Sep 9, 2019 |
# ? Sep 9, 2019 06:56 |
|
|
# ? Jun 8, 2024 07:28 |
|
Pytest has this as a built-in fixture as well, which is incredibly useful for testing.
|
# ? Sep 9, 2019 19:00 |
|
Hey dudes. Would anyone be willing to help test if Python binaries I built work on similar systems? Looking for someone with a Ubuntu or Debian install to try this, and specify a Python version you don't have, >= 3.4. Looking for someone with Windows who doesn't have Python 3.7 installed to try it with Python 3.7 specified. Much appreciated. Ie download and run the deb or MSI, navigate to an empty folder, run `pypackage install`, and enter an applicable version when asked. Run `pypackage python`, and see if the REPL shows the right version. Dominoes fucked around with this message at 02:13 on Sep 10, 2019 |
# ? Sep 10, 2019 02:03 |
|
Dominoes posted:Hey dudes. Would anyone be willing to help test if Python binaries I built work on similar systems? Looking for someone with a Ubuntu or Debian install to try this, and specify a Python version you don't have, >= 3.4. Looking for someone with Windows who doesn't have Python 3.7 installed to try it with Python 3.7 specified. Much appreciated. Install a vm and do it yourself dude
|
# ? Sep 10, 2019 02:57 |
|
I don't get along well with Docker, and am looking for help on an open-source project. You might even be interested in using this later, if not now. What I'm specifically asking for help on is a proof-of-concept for getting official binaries hosted on python.org.
Dominoes fucked around with this message at 03:21 on Sep 10, 2019 |
# ? Sep 10, 2019 03:18 |
|
Dominoes posted:I don't get along well with Docker, and am looking for help on an open-source project. You might even be interested in using this later, if not now. What I'm specifically asking for help on is a proof-of-concept for getting official binaries hosted on python.org. I’d like to suggest amazon workspaces free tier for windows. Takes about 4 seconds to set up.
|
# ? Sep 10, 2019 03:42 |
|
CarForumPoster posted:I’d like to suggest amazon workspaces free tier for windows. Takes about 4 seconds to set up.
|
# ? Sep 10, 2019 03:44 |
|
What's the typical pattern for loading credentials from something like AWS SSM Parameter Store into an API wrapper while keeping class initialization lightweight? Is it typicallycode:
code:
|
# ? Sep 10, 2019 04:56 |
|
Dominoes posted:I don't get along well with Docker, and am looking for help on an open-source project. You might even be interested in using this later, if not now. What I'm specifically asking for help on is a proof-of-concept for getting official binaries hosted on python.org. https://developer.microsoft.com/en-us/windows/downloads/virtual-machines free 60 day vms (just keep rebuilding it) No docker needed. But a trivial dockerfile for this would be worth it since all you do is setup and d/l. And with microsoft's free CI/CD it'd run automatically which is a lot more reliable than asking idiot goons like myself to test
|
# ? Sep 10, 2019 05:04 |
|
Fluue posted:What's the typical pattern for loading credentials from something like AWS SSM Parameter Store into an API wrapper while keeping class initialization lightweight? Is it typically The iron rule of dependency injection strongly suggests you do the latter. Your API wrapper should have no idea where it gets its keys.
|
# ? Sep 10, 2019 05:07 |
|
Malcolm XML posted:https://developer.microsoft.com/en-us/windows/downloads/virtual-machines GitHub Actions 2.0 is nice if you can get into the beta. You can get a full sample of it using Azure Pipelines (it's a fork) and forward port the setup to GitHub Actions 2.0 once it is released.
|
# ? Sep 10, 2019 05:24 |
|
Malcolm XML posted:https://developer.microsoft.com/en-us/windows/downloads/virtual-machines
|
# ? Sep 10, 2019 05:30 |
|
What’s the reason you can’t just include functionality to download the official binaries and installing them into your custom ~/python-installs directory? Maybe you’ve said it already but I can’t find it in recent posts.crazysim posted:GitHub Actions 2.0 is nice if you can get into the beta. You can get a full sample of it using Azure Pipelines (it's a fork) and forward port the setup to GitHub Actions 2.0 once it is released. I got into the Actions beta! Except I have no idea what to do with it. I really should take some time to look into CI/CD stuff again because it sounds pretty neat. I got into the GitHub packages beta too. I hope they add the ability to host python packages there too but I think right now it’s just js stuff. Boris Galerkin fucked around with this message at 09:19 on Sep 10, 2019 |
# ? Sep 10, 2019 09:14 |
|
Boris Galerkin posted:What’s the reason you can’t just include functionality to download the official binaries and installing them into your custom ~/python-installs directory? Maybe you’ve said it already but I can’t find it in recent posts. Dominoes fucked around with this message at 09:46 on Sep 10, 2019 |
# ? Sep 10, 2019 09:41 |
|
Active discussion
|
# ? Sep 10, 2019 11:58 |
Dominoes posted:Sweet. I'm not sure why I've had such trouble with VMs before; tried Docker to help someone repro a bug and got nowhere, despite most people having no trouble. Also having flashbacks of an old Django tutorial that used Vagrant/Chef/Virtualbox. Looks like Windows Subsys for Linux now supports several distros, which may help too. Man I'm glad I'm not the only one for whom Docker seems like watching kids today with their intendos and wondering when I got so old. Wasn't someone going to start an All Things Docker thread?
|
|
# ? Sep 10, 2019 12:26 |
|
bashing my head against the wall irl trying to upload something to pypi, here's my folder layout:code:
(from . import projectname, import projectname, not declaring any import, nothing works) please tell me where I hosed up so i can fix it and never interact with this again i'm pretty sure the issue is in the init
|
# ? Sep 10, 2019 16:21 |
|
Malcolm XML posted:The iron rule of dependency injection strongly suggests you do the latter. Your API wrapper should have no idea where it gets its keys. Right. I'm asking whether it's better to init an instance of the API wrapper in the module itself or init the wrapper elsewhere (E.g. when it's needed). This is running in an AWS lambda, btw, which typically advises creating reusable instances
|
# ? Sep 10, 2019 16:22 |
|
Meyers-Briggs Testicle posted:bashing my head against the wall irl trying to upload something to pypi, here's my folder layout: Read this: https://blog.ionelmc.ro/2014/05/25/python-packaging/ I recommend putting everything in src. Then if you only have one module (.py file) you don't need to bother with a package (folder containing an __init__.py). Just src > projectname.py. But if you really want to make a module inside a package, your import path is essentially projectname.projectname.thing. So your options are 1) empty __init__.py. From the interpreter, import like code:
code:
code:
code:
|
# ? Sep 10, 2019 18:03 |
|
Fluue posted:Right. I'm asking whether it's better to init an instance of the API wrapper in the module itself or init the wrapper elsewhere (E.g. when it's needed). The latter, again. For lambdas and scripts I ve always had a driver function that gets all of the config from wherever and then initializes the modules that do the work
|
# ? Sep 10, 2019 18:15 |
|
Meyers-Briggs Testicle posted:bashing my head against the wall irl trying to upload something to pypi, here's my folder layout: Dominoes fucked around with this message at 20:34 on Sep 10, 2019 |
# ? Sep 10, 2019 20:31 |
|
I'm still not clear on how you're going to handle multiple conflicting versions of package X when you can't reliably refactor import statements in packages since many packages have dynamic imports with importlib. With traditional methods you get a warning from, say poetry, during install if there's conflicting dependencies. With your method it seems like your code will let you install conflicting dependencies, but then, since you can't be sure you refactored all import statements because of dynamic imports, the user won't know that their application won't work until they try to run it. Or, worse, their application works, but its behavior is subtly different because its dynamically importing the wrong version of a dependency.
|
# ? Sep 10, 2019 21:19 |
|
I haven't attacked importlib and dynamic imports yet, so that's an open question. If at least able to detect them, failing on them, but otherwise passing is still a better option than failing on all traditionally non-resolvable graphs. As you point out, hard-failing (Pipenv and Poetry's behavior) is better than undefined behavior. Do you have an example on PyPi that uses importlib or dynamic imports I could test with? edit: The stopgap may be failing all must-rename dependencies that use importlib. I suspect this, along with deps that use relative imports in compiled modules, represent a minority of cases. Dominoes fucked around with this message at 21:51 on Sep 10, 2019 |
# ? Sep 10, 2019 21:33 |
|
New Humble Bundle of Python-related stuff has some books and videos IDK about but each of the three tiers includes a few months of a PyCharm Professional license (new users only) -- two months at $1, four at the average ~$13 and six at $20. Don't remember off the top of my head what Pro adds if you aren't doing any web/db type stuff but if you are you should absolutely try it out for a few bucks. Highlight for me with Django is Professional adds code completion for a ton of stuff the free version doesn't see cause I'm guessing it's attributes on objects Django cobbles together at runtime.
|
# ? Sep 11, 2019 00:09 |
|
Dominoes posted:I haven't attacked importlib and dynamic imports yet, so that's an open question. If at least able to detect them, failing on them, but otherwise passing is still a better option than failing on all traditionally non-resolvable graphs. As you point out, hard-failing (Pipenv and Poetry's behavior) is better than undefined behavior. Django and DRF both do a lot of dynamic imports. That's what all that stuff you configure in settings.py by a dotted path is.
|
# ? Sep 11, 2019 00:40 |
|
Thermopyle posted:Django and DRF both do a lot of dynamic imports. Follow-up to the virtualization: Made it work by installing a few diff Linux versions from the Win10 store. Can't get the Py builds I made on one OS to work (fully) on any other! Not even diff versions of Ubuntu, Debian, two Win10 computers etc. Hoping the CPython team handles this. The Rust-compiled app itself appears to be cross-platform. Adding functionality to run isolated scripts in their own env without configuring/managing it manually. This is a related Py wart that's somewhat different from normal package management. Decision's still up in the air, but going to parse the file's imports, then download the newest version, stored in a global venv under the script's name. Need to think how to deal with multiple scripts with the same name, cleaning up envs when you delete scripts etc. Quick+dirty solution for quick+dirty scripts. Dominoes fucked around with this message at 06:18 on Sep 11, 2019 |
# ? Sep 11, 2019 06:09 |
|
Dominoes posted:Adding functionality to run isolated scripts in their own env without configuring/managing it manually. This is a related Py wart that's somewhat different from normal package management. Decision's still up in the air, but going to parse the file's imports, then download the newest version, stored in a global venv under the script's name. Need to think how to deal with multiple scripts with the same name, cleaning up envs when you delete scripts etc. Quick+dirty solution for quick+dirty scripts. Have you taken a look at pipx to see what they do? It’s what I use to install python based CLI tools that I’m always using, like black, flake8, other tools I’ve wrote and packed mainly for myself. Their workflow is basically “pipx install black” or something like that and now black is in your PATH and is isolated from everything else. For running scripts (not CLI tools) in their own environment poetry lets me do “poetry run scriptname_or_pathtofile” and it works quite well too. Boris Galerkin fucked around with this message at 07:20 on Sep 11, 2019 |
# ? Sep 11, 2019 07:18 |
|
Boris Galerkin posted:Have you taken a look at pipx to see what they do? quote:For running scripts (not CLI tools) in their own environment poetry lets me do “poetry run scriptname_or_pathtofile” and it works quite well too. (You've subtly pointed out a confusing term both in my post you quoted, and in the community: "script" may refer to one of two different things! It's already getting confusing in my code and docs. I think I'm going to use "script" to refer to a one-off file, and "CLI tool" for something like black or poetry) Dominoes fucked around with this message at 07:42 on Sep 11, 2019 |
# ? Sep 11, 2019 07:40 |
|
Yeah my bad. I meant script in the sense of a script inside my python project folder which isn’t meant to be “installed”. E: apparently that’s your same definition as well
|
# ? Sep 11, 2019 07:43 |
|
Please help me understand a Django issue: Python 3.6, Django 1.10* code:
code:
code:
What am I missing? Other uses of session work just fine, nothing seems amiss in my settings or in other places in my project. I thought maybe 'tasks' was somehow reserved and tried different key names; I've tried storing strings, ints, tuples, lists, etc. inside the list in session. I've tried multiple iterations of code and can't seem to pin down anything other than "works in other projects, doesn't work here". I'm wondering if I made some small mistake upfront and I'm just continually missing it? * I teach** intro web development with a company that insists we use Django 1.10 instead of 1.11 for some reason; I appear to have the same problem in 1.11 as well, although I haven't tested as extensively. ** this post may not inspire much faith in my ability to teach - trust me, I'm not having much faith in this today, either
|
# ? Sep 12, 2019 04:21 |
|
Dominoes posted:I'm thinking the same. Post it. I'd recommend not titling your main script the same as your project, to avoid having 3 levels of same-name. https://github.com/MortimerMcMire/cyclist tell me where I went wrong please preferably related to pypi but im open to all critiques
|
# ? Sep 12, 2019 17:11 |
|
Epsilon Plus posted:Please help me understand a Django issue: I used to know the answer to this long ago, but I can't recall offhand. The session in 1.11 is implemented here. I don't really feel like tracing through this anymore, mainly because I can't reproduce your issue. If you can give a minimal example project showing the issue I'll look into it more. Otherwise, you'll just have to examine the code linked to above. My first thought is it's going to have something to do with the __getitem__ method and/or the _get_session method/property and python's unique pass-by-object-reference model. Also, if you can pin it down to working in one version of Django and not the other, you can diff that class to see what changed. Keep us updated!
|
# ? Sep 12, 2019 17:58 |
|
Meyers-Briggs Testicle posted:https://github.com/MortimerMcMire/cyclist
|
# ? Sep 12, 2019 23:28 |
|
Can anyone point me in the direction of a breakdown of installing OpenCV on a RasPi? I've gone through a few now and they've all just been nightmares of dependencies, omitted steps, depreciated projects, and some egregious spelling.
|
# ? Sep 13, 2019 22:33 |
Humble Bundle has a python bundle again, https://www.humblebundle.com/level-up-your-python. I'm starting to apply again to some PhD programs for numerical analysis and machine learning, and Python commonly comes up as a desired language. I'm pretty used to doing math stuff in MATLAB and C, but less so in Python. Admittedly I'm a couple years out of my masters' now and had to settle for a job outside my field so pretty rusty on what I do know. How useful would the books/tools in this bundle be to self-teaching myself some python compared to whatever free online (or cheaper books) I could find out there?
|
|
# ? Sep 13, 2019 23:00 |
|
Warbird posted:Can anyone point me in the direction of a breakdown of installing OpenCV on a RasPi? I've gone through a few now and they've all just been nightmares of dependencies, omitted steps, depreciated projects, and some egregious spelling. Step 1) Install the raspberry pi version of miniconda Step 2) Activate the conda environment Step 3) Use the conda command to install opencv Step 4) If for some reason that doesn't work, create a fresh conda environment and try again Step 5) If for some reason that doesn't work, create a fresh conda environment and try installing with pip
|
# ? Sep 13, 2019 23:38 |
|
Zerilan posted:Humble Bundle has a python bundle again, https://www.humblebundle.com/level-up-your-python. I'm starting to apply again to some PhD programs for numerical analysis and machine learning, and Python commonly comes up as a desired language. I'm pretty used to doing math stuff in MATLAB and C, but less so in Python. Admittedly I'm a couple years out of my masters' now and had to settle for a job outside my field so pretty rusty on what I do know. How useful would the books/tools in this bundle be to self-teaching myself some python compared to whatever free online (or cheaper books) I could find out there? IMO the best way to learn python is to find something you want to do and do it. There’s a stack overflow post or github pull request for literally everything.
|
# ? Sep 14, 2019 00:24 |
|
Zerilan posted:Humble Bundle has a python bundle again, https://www.humblebundle.com/level-up-your-python. I'm starting to apply again to some PhD programs for numerical analysis and machine learning, and Python commonly comes up as a desired language. I'm pretty used to doing math stuff in MATLAB and C, but less so in Python. Admittedly I'm a couple years out of my masters' now and had to settle for a job outside my field so pretty rusty on what I do know. How useful would the books/tools in this bundle be to self-teaching myself some python compared to whatever free online (or cheaper books) I could find out there? Warbird posted:Can anyone point me in the direction of a breakdown of installing OpenCV on a RasPi? I've gone through a few now and they've all just been nightmares of dependencies, omitted steps, depreciated projects, and some egregious spelling.
|
# ? Sep 14, 2019 02:00 |
|
QuarkJets posted:Step 1) Install the raspberry pi version of miniconda I remember there being another sort of setup like this and I broke it all to hell; I historically haven't had much like with Python. I'll give it a shot and see what happens. I'm attempting to do this on a 0W though so it seems like that's far beyond reason.
|
# ? Sep 14, 2019 04:10 |
|
|
# ? Jun 8, 2024 07:28 |
|
I can't think of a super easy way to do this and I bet there is one. I have a pandas df: code:
code:
CarForumPoster fucked around with this message at 14:19 on Sep 14, 2019 |
# ? Sep 14, 2019 14:16 |