Check out madzak [1] and their project python-json-logger [2].
Json Formatter for the standard python logger
References:
[1]: https://github.com/madzak
[2]: https://github.com/madzak/python-json-logger
Publishing rhythm
Four Github Actions for Python
If you are developing python packages and using GitHub here are four actions
that you can use today to automate your release workflow. Since python tools
generally have such a simple cli I have opted to use the cli for most of these,
that way I know exactly what is happening and have more control over it if I
need.
h2 img { width: 100%; box-shadow: .5rem .5rem 3rem #141F2D, -.5rem -.5rem 3rem rgba(255,255,255,.1);}
img{ max-width: 100% !important;}
If you are developing python packages and using GitHub here are four actions that you can use today to automate your release workflow. Since python tools generally have such a simple cli I have opted to use the cli for most of these, that way I know exactly what is happening and have more control over it if I need.
- Lint
- Test
- Package
- Upload to PyPi
Lint With flake8 # [1]
flake8 is pythons quintessential linting tool to ensure that your code is up to the standards that you have set for the project, and to help prevent hidden...
Check out justmarkham [1] and their project scikit-learn-tips [2].
🤖⚡ 50 scikit-learn tips
References:
[1]: https://github.com/justmarkham
[2]: https://github.com/justmarkham/scikit-learn-tips
Check out Textualize [1] and their project rich [2].
Rich is a Python library for rich text and beautiful formatting in the terminal.
References:
[1]: https://github.com/Textualize
[2]: https://github.com/Textualize/rich
Variables names don't need their type
So often I see a variables type() inside of its name and it hurts me a little
inside. Tell me I’m right or prove me wrong below.
Examples # [1]
Pandas DataFrames are probably the worst offender that I see
# bad
sales_df = get_sales()
# good
sales = get_sales()
Sometimes vanilla structures too!
# bad
items_list = ['sneakers', 'pencils', 'paper', ]
# good
items = ['sneakers', 'pencils', 'paper', ]
Edge Cases? # [2]
It’s so common when you need to get inside a data structure in a special way that itsn’t provided by the library…. I am not exactly sure of a good way around it.
# bad ??
sales = get_sales()
sales_dict = sales.to_dict()
# good
🤷♀️
Containers are plural # [3]
Always name your containers plural, so that naming while iterating is simple.
prices = {}
items = ['sneakers', 'pencils', 'paper', ]
for item in items:
prices[item] = get_price(item)
Before I start fights 🥊 in code review, am I inline here or just being pedantic?
References:
[1]: #examples
[2]: #edge-cases...
I’m really excited about cpython [1], an amazing project by python [2]. It’s worth exploring!
The Python programming language
References:
[1]: https://github.com/python/cpython
[2]: https://github.com/python
I recently discovered scully [1] by scullyio [2], and it’s truly impressive.
The Static Site Generator for Angular apps
References:
[1]: https://github.com/scullyio/scully
[2]: https://github.com/scullyio
I came across pydevto [1] from lpellis [2], and it’s packed with great features and ideas.
Unofficial dev.to api
References:
[1]: https://github.com/lpellis/pydevto
[2]: https://github.com/lpellis
I’m really excited about kedro-pandas-profiling [1], an amazing project by brickfrog [2]. It’s worth exploring!
A simple wrapper to use Pandas Profiling easily in Kedro
References:
[1]: https://github.com/brickfrog/kedro-pandas-profiling
[2]: https://github.com/brickfrog
The work on gregives.co.uk [1] by gregives [2].
Personal site and portfolio of software engineer Greg Ives
References:
[1]: https://github.com/gregives/gregives.co.uk
[2]: https://github.com/gregives
I’m impressed by act [1] from nektos [2].
Run your GitHub Actions locally 🚀
References:
[1]: https://github.com/nektos/act
[2]: https://github.com/nektos
Send Emails with GitHub Actions
Here is one useful thing that you can do with GitHub actions no matter what language you use, send email. You might want to know right away when your ci passes. You might want to give your team a nice pat on the back when a new release is deployed. There might be subscribers wanting to see the latest release notes in their inbox as soon as the latest version is deployed. Whatever it is, its pretty easy to do with an action right out of the actions marketplace.
Mail on Star # [1]
Here is a silly example that sends an email to yourself anytime someone stars your repo.
name: Mail on Star
on:
watch:
types: [ started ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "email"
email:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: ✨ Send email, you star
uses: dawidd6/acti...
I’m really excited about awesome-python-bytes [1], an amazing project by JackMcKew [2]. It’s worth exploring!
😎 🐍 Awesome lists about Python Bytes https://pythonbytes.fm/
References:
[1]: https://github.com/JackMcKew/awesome-python-bytes
[2]: https://github.com/JackMcKew
Check out get-diff-action [1] by technote-space [2]. It’s a well-crafted project with great potential.
GitHub Actions to get git [3] diff
References:
[1]: https://github.com/technote-space/get-diff-action
[2]: https://github.com/technote-space
[3]: /glossary/git/
If you’re into interesting projects, don’t miss out on react-toastify [1], created by fkhadra [2].
React notification made easy 🚀 !
References:
[1]: https://github.com/fkhadra/react-toastify
[2]: https://github.com/fkhadra
What Are GitHub Actions
GitHub actions are an amazing tool that allows us to run code based on triggers
inside of our repo. Their is a large and growing community of actions inside
the marketplace to use with very little effort. Best of all they are free for
public repositories, and private repos have a very generous free tier.
h2 img { width: 100%; box-shadow: .5rem .5rem 3rem #141F2D, -.5rem -.5rem 3rem rgba(255,255,255,.1);}
img{ max-width: 100% !important;}
I have been diving deep into Github actions for about a month now and they are wicked good! They allow you to run any sort of arbitrary code based on events in your repo, webhooks, or schedules. They are very reasonably priced. The interface that GitHub hs developed for them is top-notch! It’s so good I have done 90% of my editing of them right from github.com.
TLDR # [1]
some interaction to your repository triggers code to run.
[2] # [3]
The online editor for actions is pretty amazing. When creating a new workflow it automatically sets up a ...
Getting Started with GitHub Actions
Github actions are written in configuration files using the YAML syntax. YAML
is a superset of JSON. Most YAML can be expressed inline with JSON syntax.
Similar to python YAML is whitespace driven by whitespace rather than brackets
tags. The argument for using YAML for configuration files such as actions is
that it is more human-readable and editable. It’s much easier to see the
whitespace layout than it is to get closing brackets correct. For actions, I
believe this is mostly true. I don’t see any use case to get past 3-5 indents,
which is completely manageable.
Can I just say that I learned more than I realized about YAML by writing this
article
Arrays and Objects # [1]
In YAML or JSON, the most basic containers for data are arrays, a 1D list
of things, and objects, for key-value pairs.
Arrays # [2]
The start of an array container is signified with a leading -. This is
probably one of the big things I didn’t understand about YAML before writing
this post, but hats off to the ...
Check out poke95 [1] by wobsoriano [2]. It’s a well-crafted project with great potential.
🚀 A Windows 95 style Pokédex built with React.
References:
[1]: https://github.com/wobsoriano/poke95
[2]: https://github.com/wobsoriano
Looking for inspiration? img-resizer [1] by sharadcodes [2].
An action for resizing images
References:
[1]: https://github.com/sharadcodes/img-resizer
[2]: https://github.com/sharadcodes
Check out generate-changelog-action [1] by ScottBrenner [2]. It’s a well-crafted project with great potential.
GitHub Actions Hackathon 2020 winner - lob/generate-changelog Action
References:
[1]: https://github.com/ScottBrenner/generate-changelog-action
[2]: https://github.com/ScottBrenner