-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Add CI workflow as Github Action w/ security linting/scanning #45
Comments
As of 2025/02/05, I have made changes to above feature request. I have some detailed questions to make sure this is implemented correctly:
|
No, not currently. This would be a good task to carry out.
I personally only use pip install and have been happily coding for years without poetry, while I did see my colleagues suffer from having to use it in the past. That being said I have nothing against a poetry file living alongside if it would make some devs' lives easier, but I wouldn't encourage introducing it as the main venv setup without having a proper discussion about pros and cons.
I defer to your advice here - can you speak of what other options could be worth considering and if this list is a good starting point?
Haha, cool, let's do it quickly before anyone notices! 🤣 I would only say I'd prefer we don't do black. Pep8 ok? Some other suggestions? Frankly, I've been using the default Pycharm/Intellij IDEA formatter for years, which I think is pep8, and never had to look for alternatives. |
Sweet! Given >=3.8 is listed in
Yep completely understand the preference for pip and the concerns about introducing Poetry, especially if it might add complexity/breaking behavior for some developers. I agree that we shouldn't disrupt the current workflow. That said, I’d like to propose a "crawl, walk, run" approach to introducing Poetry in a way that doesn’t break anything for current developers but allows us to evaluate its benefits in a controlled manner. Here’s my thinking:
With this approach, we won't introduce any disruption to the current dev flow, we'll be able to provide flexibility to folks to want to try it out, then when we want to have the full discussion we can base it on our actual experiences trying it out. Happy to take any feedback or thoughts here. :)
My thoughts here are to have a starting point to introduce ibind to these types of checks and we evaluate the findings they come up with. Just start with something, especially since we don't plan on these blocking PRs. There's probably a very in depth discussion with a pros/cons matrix for the multiple scanning tools available. I'm thinking the open source versions of tools like SonarCube or Snyk. I'm sure I'm missing a few. I picked dlint and secure coding standard to start as they are plugins to Flake8, which makes setup trivial.
Just to clarify, I’m suggesting we use flake8 with security-focused plugins like dlint and flake8-secure-coding-standard for linting, not formatting. These tools help catch insecure coding practices (e.g., unsafe use of eval() or pickle) without affecting how the code is formatted. Your formatter shouldn't be affected :) |
Note that 3.8 is already EOL, 3.9 will reach EOL this year. Why support those? Going for 3.10+ would allow for gentle code modernization (e.g.
I'm a happy poetry user and have used |
Thanks for sharing your thoughts guys 👍 Regarding Python version - I don't have a strong opinion on this. If anyone can think of a good reason to support <3.10 then let's talk about it. Otherwise, I suggest we follow @salsasepp's advice and do 3.10+.
Thanks for describing these steps, if we decide to start introducing it they would be very useful. I admire your attention to introducing changes in a non-disruptive way. Before we do though, could we first have a brief discussion on why would we even try going this direction? As a non-user I don't understand the benefits of introducing Poetry. If you could list some existing issues in areas of IBind development that could be improved by introducing Poetry I think I'd get a better understanding behind it. Thanks for bearing with me on this 🙏
Superb, thanks for expanding on these. Let's follow your advice and introduce the two you've listed.
Right! Sorry, linting and formatting go hand in hand in my head hence I assumed we'd do dlint and flake8-secure-coding-standard alongside the formatter. Your comment about it quickly turning into religious discussion made me think of formatting exactly, I didn't think linting is also that susceptible to subjectivity! In either case, would it be worth doing CI formatting too? I'm indifferent, wondering what your opinion on this would be. |
I'm up for >=3.10 :) I imagine we would want to specify in our next release that we're bumping the python version in
No problem at all, I wouldn't want us to add something just because it's flashy, it should solve a clear problem :) So the 2 biggest things I like about poetry are a/ When I am writing Python, I love the fact that just typing My dev flow when cloning a python repo at work is git clone, poetry install, poetry shell. b/ Now another argument to be made could be to make the maintainer's life (yours) easier. Now I won't strongman this argument since I haven't done it with a python package myself, but allegedly poetry makes package versioning and publishing to pypi much easier. Not sure what you're current process is for releases so I'll just denote some poetry features:
Happy to hear your thoughts :)
I'm up for CI'ing all the things, was just introducing the ideas slowly haha |
@weklund many thanks for the detailed writeup on Poetry 🙌 Really appreciate you pointing out these different areas. Here are my thoughts on what you brought up: In general, I have two observations:
Point A
I understand your thinking here, having to worry about one thing less can be great. To clarify what you said: 'it's localized to the project scope' - is it though? My understanding is that Poetry installs to some global In Poetry I understand that you just run something like
Could you expand on what makes it hard to you? Having 15 years of developing with Python I'm gonna need to take a couple steps back here to understand how it may be troublesome to newer developers - appreciate your patience here 🙏 I've personally never found this hard; it's a relatively simple system that you don't need to think much about which boils down to one short sentence: Unless you're in an active venv shell, all installs are global. If I want a local install, I need a venv. Yes, it is one extra thing to keep in mind, and things will go not as expected if you forget it, but I wouldn't call it 'hard'. To me it's really simple to keep this one sentence in mind, so I'm curious what could be the pain point from your perspective here.
Once again, it's one step extra without Poetry, is that the pain point?
And once again, I've done this so many times I'm struggling to see the issue with it. It's remembering one bunch of commands or the other. I can recognise that ... Btw. doesn't your IDE handle the venv automatically for you? It does for me - I specify the venv when I set up the project and everything from then on happens in that venv for that project - which is possibly why I don't mind doing the Point B
Fair enough! If that really does happen here then that would be enough to convince me. Has it happened to you when trying to install deps in IBind? Or when building CI? I would be cautious of saying 'never happens' as I have the opposite argument here that comes from the exact same place - I've seen Poetry failing to install something in CI or other type of virtual machine; removing it and switching to pip resolved the problem. These are anecdotical and case specific, so not much to add to the argument; let's focus on present situation - can we see any current build issue on your machine or CI that Poetry would solve? And just to clarify,
Again, possibly on a more complex project it could. Currently the steps are really easy:
I've considered putting a shell script to do this on several projects, but to be fair - I could never be bothered to; it's too easy as it is. I agree that if Poetry would turn this into I did some reading on what the internet says on the subject - it seems to be aligned with what you describe. I think main argument brought up is the dependency solving and avoiding the issues when building. There doesn't seem to be a clear winner and the choice does seem somewhat subjective after all; although for larger complex projects, or ones with a large amount of developers, Poetry seems to be recommended. (Whatever the outcome, I appreciate you making me take this time to learn more about Poetry!) In conclusion, it seems a lot like a matter of remembering to do things one way or the other, rather than bringing in game-changing simplification or solutions. If the main argument is that without Poetry one needs to learn and remember the If the main argument is the ease of build across platforms or developer machines, then I'd want to hear if you're running into any problems currently. If so, let's consider it, otherwise I suggest we consider introducing Poetry the moment we observe these happening, but not preemptively. |
No problem! I love going deep on these topics. Improves our understanding and helps us "truth seeking" or making the right decision for our needs. 😁
+1000 let's not switch just for some commands to remember :) I believe there's value past just some commands.
Well theoretically we're about to add several for linting, secure code lint plugin, bandit, etc etc. I believe in the pip world you would have a
Ah whoops sorry I always switch the config to project directory in my .zshrc
Yep it's more of a papercut :P
Neovim doesn't haha, but I am tinkering with Cursor. I believe it's a fork of VS Code.
In fairness this hasn't happened at all with ibind, and it does seem less likely to happen given the low amount of deps needed. You’re right that re: architectures, I've personally spent days debugging an issue where I was building a AWS lambda function in Python, and the bundled deps were using a Darwin OS rust binary that fails to import the Cryptography package when loading the lambda function during the lambda runtime on a linux OS. Happy to deep dive if needed, but this could theoretically happen with the oauth implementation depending on user's runtime. I know we're using pycryptodome not cryptography, but theoretically there should be some underlying binary to secure the compute for signature generation. Catching an obscure issue like this is better in CI than from a user. Sorry I don't have anything tangible with my current use of ibind, so the thoughts are "what if" scenarios. Thanks again for the thoughtful discussion—I really appreciate your openness to exploring this! Let me know what you think. :) |
Regarding flake8, I've actually been doing a deep dive into python linters, and asking my team about a few python open source repos we manage. Seems
|
Good point. Yes, you have these two.
Haha all good, it's helpful to understand. Thanks for expanding on the IDE too. So, how would you install a new package in your current setup? In CLI?
Understood 👍
You're right that
Oh absolutely, I've been having issues with this package too. But it wasn't related to Python, more to missing some c++ compilers, or something along these lines. Does Poetry handle non-package dependency installation, like compilers, too? In fact, I've removed cryptography package from the OAuth PR exactly for that reason, it was proposed there originally.
It's superb you're thinking about this already. We'll still be able to do CI without Poetry though, catching obscure issues like this, right?
Fair enough. And I think it's a valid argument to think about things in advance, but here I'd say if there's nothing to fix with Poetry at the moment then let's focus on other things and revisit this topic should problems that Poetry could address would appear. Just to clarify - I'm not hating Poetry, I really don't have a strong opinion here, and would gladly give it a shot if good arguments appear for it. I'm just being cautious in introducing it on a 'well everyone is using it!' basis, as I'm reading around that it is a bit of a learning curve and it brings in issues of its own, while as far as I know we have no issues with the current setup.
Likewise! 🙌 Thanks for your patience as well as researching and presenting various arguments for it. I'm enjoying this conversation and the learning alongside it a lot! |
Amazing! 👏👏👏 Green light to go ahead with it, and superb job managing to reduce two tools into one. Great job! 🙌 |
Describe the feature
Enable flake8 (for linting) and bandit (for security checks) in GitHub Actions to improve code quality and security as a CI (continuous integration) step. Initially, the workflow will be informative and non-blocking. Once we gain trust in the signal, we can enforce these checks to block PRs until issues are resolved.
Expected interaction
Example: .github/workflows/ci.yml:
Possible implications
Additional context
There is currently no CONTRIBUTING.md file in the repository to provide guidance on contributing. I'm open to feedback on how best to help out :)
The text was updated successfully, but these errors were encountered: