HNHacker News
TopNewBestAskShowJobs

franey

127 karma · joined February 29, 2016

https://johnfraney.ca
submissionscomments
franey··on Create and Publish a Python Package with Poetry
I recently took Poetry for a spin when releasing Flake8 Markdown[1], and I thought it might be helpful to walk through the process of making a package using Poetry, from start to finish.

I found it more straightforward than using setup.py and twine, which I used for other packages.

How are you publishing to PyPI these days?

[1] https://github.com/johnfraney/flake8-markdown

franey··on Handy Keymaps in Vim
By far my favourite remap in (Neo)vim is to map : to ; and ; to ,

I don't know how many thousand key presses I've saved by not having to hit "Shift" for every command.

    " Use ; rather than : for commands
    nore ; :
    nore , ;
franey··on Show HN: Flake8 Markdown – lint Python code blocks in Markdown files
This is a little project I put together to help ensure that the code examples in my Pelican-built blog are correct and to build a package using Poetry[1].

It's a thin wrapper around Flake8[2] that extracts backtick-style Python code blocks from Markdown files, pipes those code blocks to flake8, and updates flake8's stdout output with line numbers from the original file.

Thanks for looking!

[1] https://poetry.eustace.io/

[2] http://flake8.pycqa.org/en/latest/

[3] https://pre-commit.com/

franey··on Black – Uncompromising Python code formatter
I've been meaning to update that post to mention that Poetry has been releasing fixes and improvements more frequently than Pipenv. Poetry is great for developing packages, too.

(Showing up in an HN thread is a neat little milestone for my blog and me. Thanks for sharing!)

franey··on Personal Blog Analytics – Which Numbers Really Matter
Yep! They changed that in version 1.1.0[1], released back in October.

[1] https://github.com/usefathom/fathom/releases/tag/1.1.0

franey··on Personal Blog Analytics – Which Numbers Really Matter
I use Fathom[1] for simple, privacy-conscious analytics on my blog. It is interesting to know which pages people are visiting and where they're visiting from. It's rewarding to see month-over-month increases in traffic, too--even if I don't get a lot of traffic. It's motivating to see that people are spending their own time to read what I've written.

Different people will use analytics for different purposes, and different metrics will matter to different people. For me, seeing people read multiple posts (when the number of page views is greater than the number of visitors) is the most rewarding metric. It's one thing to click through from Google. It's another to click through one article and want to read more.

[1] https://github.com/usefathom/fathom

franey··on Going hungry affects children for their whole lives
Yes.
franey··on Removing Array Duplicates
There's also the classic one-liner:

    unique_array = list(set(non_unique_array))
franey··on Julian Assange Indictment (2018)
Link for the lazy:

https://www.law.cornell.edu/uscode/text/18/1030

franey··on Julian Assange Indictment (2018)
You're conflating two different things: publishing classified material, which the DOJ under Obama didn't charge, and a CFAA violation.

Assange is getting charged for a CFAA violation. "Hacking" isn't a great description of what the law forbids. It forbids obtaining information by "intentionally access[ing] a computer without authorization or exceed[ing] authorized access".

https://www.law.cornell.edu/uscode/text/18/1030

franey··on Django 2.2
A person can use Transcrypt[1] to transpile quite a bit of Python to JavaScript.

As a proof-of-concept, I put together a Django plugin[2] that uses Django's validators[3] along with Transcrypt to share validation logic between the server and a `ModelForm`.

I thought it was a neat way to centralize validation logic.

[1] http://www.transcrypt.org/

[2] https://github.com/johnfraney/django-front-end-validators

[3] https://docs.djangoproject.com/en/2.2/ref/validators/

franey··on Russiagate is a death-blow for the reputation of the American news media
Saying that no indictment has been because of collusion isn't true, since Manafort was indicted in part for lying to investigators about his contacts with Kilimnik.

Surely you'd agree that Trump's campaign chair giving US polling data to a Russian cut-out counts as colluding.

https://www.cbc.ca/news/world/paul-manafort-trump-polling-da...

franey··on Show HN: FastAPI: build Python APIs with Go-like speed and automatic UI docs
FastAPI extends Starlette, so the developer didn't build an entirely new framework from scratch.

Encode, the team that develops Starlette, also develops Django REST Framework. They help make the Python web development ecosystem what it is.

franey··on Show HN: FastAPI: build Python APIs with Go-like speed and automatic UI docs
It seems like a lot of the "FastAPI features"[1] are coming not from FastAPI but from Starlette:

- Just Modern Python

- Editor support

- Short

- Unlimited "plug-ins"

Would it be fair to say that this is Starlette + an API schema + OAuth2 + data validation?

[1] https://fastapi.tiangolo.com/features/#fastapi-features

franey··on Kdenlive: an open-source video editor
I've been using Antergos for years now. It's a great way to get Arch on a machine.

I just replaced my GPU today. I ran `sudo pacman -S nvidia`, rebooted, and I was good to go.

As an aside: Arch isn't as "bleeding edge" as some people would have you believe. They have a testing repository, so packages get vetted before making it into the main package repositories. They often wait for a point-release of some software (like Gnome Shell) to help ensure that only stable versions make it in.

Plus, the Arch wiki is the most useful Linux resource I've found. I reference it even when I'm using an Ubuntu machine.

franey··on GrapesJS – Free and Open Source Web Builder Framework
One of the things I like most about CSS grid is being able to rearrange template areas for responsive design. Using flexbox inside a grid template area gives us the best of both worlds.
franey··on Python Developer Survey 2018 Results
3.4 is EOL at the end of March, so we'll be seeing less and less of it.
franey··on Microsoft Is Worth as Much as Apple. How Did That Happen?
I've been using Caps Lock as Esc for around a year now (and Shift + Shift for caps). It's a big ergonomic win for me on both my laptop and desktop keyboards.
franey··on Show HN: Django Front End Validators – form input validation using transpiled JS
Hello! This is a little plugin I threw together after wondering how I might be able to use Transcrypt[1] alongside Django. It's in its early stages (no tests) and has a limited feature set (no class-based validator support; only functions), but I think it's a neat proof-of-concept for a useful application of Python-to-JS transpiling.

Let me know what you think, and I'll try to keep an eye out today so I can respond.

[1] http://www.transcrypt.org/

franey··on Types, and Why You Should Care [video]
Python has optional static typing since at least 3.6[1]. apistar[2], a REST framework, uses modern Python's typing to serialize data, which is neat.

[1] https://docs.python.org/3/whatsnew/3.6.html#pep-526-syntax-f...

[2] https://github.com/encode/apistar

franey··on Tea if by sea, cha if by land: Why the world only has two words for tea
In my part of the world (Nova Scotia, Canada), "dinner" often means either lunch or the largest meal of the day. When planning for Christmas dinner I've found myself asking, "Lunch dinner or supper dinner?"
franey··on Orion Ubuntu Laptop Review: The Powerful MacBook Pro Alternative
I'm not sure. I hadn't heard of Entroware before. If the laptop has an Intel WiFi chip it should work out-of-the-box with distros running a recent Linux kernel. I ordered my laptop without an OS and have been running Arch on it for over a year.
franey··on Orion Ubuntu Laptop Review: The Powerful MacBook Pro Alternative
This laptop is getting a fair amount of coverage, but as far as I can tell it isn't anything new. It's a rebranded Clevo laptop shipped with Ubuntu, just like the System 76 Lemur.

Disclosure: I'm registered as a Sager reseller (another company selling Clevo laptops), but I'm not actively selling their products.

franey··on Vim for Humans
Huh! This is really neat. Thanks for taking the time to evangelize. I might have to try this for a day.
franey··on Build a Swarm cluster
I've been using it for quite a while! At least since September 7, 2015 (thanks, GitHub), and it's come a long way since then.
franey··on Build a Swarm cluster
In my experience Dokku is perfect for this. It uses Heroku's buildpacks to build your app inside a Docker container (or containers) and serves it on yourapp.yourserver.com via a git push: https://github.com/dokku/dokku

I've got ~5 low-traffic websites running on a 1GB Droplet.

franey··on Highly Available Block Storage
It's against DO's terms of service to "use the Services in violation of the copyrights, trademarks, patents or trade secrets of third parties", which appears to be the issue here.

https://www.digitalocean.com/legal/terms/

franey··on Raspberry Pi 3 on Sale
Newark is the element14 partner (subsidiary?) in Canada: https://canada.newark.com
← PreviousPage 2 of 2