Skip to content
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

Integrate skeleton-python-library and Migrate to Python 3 #2

Merged
merged 381 commits into from
Dec 2, 2020

Conversation

mcdonnnj
Copy link
Member

@mcdonnnj mcdonnnj commented Nov 11, 2020

🗣 Description

This PR merges histories with cisagov/skeleton-python-library to bring this project into the modern era. This also results in dropping Python 2 support and becoming a Python 3 project. This closes #1 .

This PR should only be merged along with the following PRs:
cisagov/cyhy_amis#292
https://github.com/jsf9k/cyhy-commander/pull/17

Opinions Wanted

I would like to remove the Dockerfile from this repo as it is not used as far as I am aware. If a Docker configuration was required I believe it would be straightforward to create a new project based on cisagov/skeleton-docker to fill that need.

💭 Motivation and Context

Python 2 support is very dead, so any Python projects we are actively using need to migrate to Python 3. This project is not dependent on other CyHy projects, so it can migrate to Python 3 without issue.

This will also allow instances that use only this project (like the portscan and vulnscan instances in the CyHy environment) to drop Python 2 altogether and use a recent OS version (such as Debian Buster).

🧪 Testing

I deployed portscan and vulnscan instances in a cisagov/cyhy_amis testing environment and was able to send work and retrieve results successfully.

✅ Checklist

  • This PR has an informative and human-readable title.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • All new and existing tests pass.

felddy and others added 30 commits October 17, 2019 16:21
Switch CI from Travis to GitHub actions
…t_autoupdate

Add updates from running pre-commit autoupdate
Replace Travis-CI with GitHub actions
Split workflow into multiple jobs.  Add artifact output.
…nsible-lint and the updated version is included in the version being used now.
Pull upstream changes from skeleton-generic.
These seem to be very large caches.  Restoring an old one and updating 
it results in a cache larger than the maximum allowed cache size: 200MB. 
 
"Cache size of 254757924 bytes is over the 200MB limit, not saving 
cache."
So if the config changes it is best to just take the cache-miss and 
start from scratch.
Add GitHub action caching of pre-commit hooks and pip packages.
Copy link
Member

@jsf9k jsf9k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but please see my comments. In particular, please see my comment regarding preserving repository history.

Dockerfile Outdated
FROM python:2
MAINTAINER Mark Feldhousen <mark.feldhousen@hq.dhs.gov>
FROM python:3
MAINTAINER Mark Feldhousen <mark.feldhousen@cisa.dhs.gov>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we are thinking of getting rid of this file, but please note that this is no longer the preferred way to specify the maintainer. You should use a label instead. @felddy recently had a PR (I can't find that PR right now - can you provide a link @felddy?) where he used the set of labels specified by the Open Container Initiative](https://opencontainers.org/). See here, for example. The OCI label standard supersedes the other standard in common use, which was Label Schema.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the PR you are looking for is cisagov/skeleton-docker#38, specifically this Dockerfile bit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the PR you are looking for is cisagov/skeleton-docker#38, specifically this Dockerfile bit.

Yep, that's the one!

download_url="https://github.com/cisagov/cyhy-runner",
# Author details
author="Cyber and Infrastructure Security Agency",
author_email="ncats@hq.dhs.gov",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the issue to mention updating the URL as well.

# Standard Python Libraries
from typing import List

from ._version import __version__ # noqa: F401
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment here explaining what F401 is would be good. I recognize that this change might be better made upstream.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a suggestion for this for ease of resolution

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created an issue upstream to flesh them both out: cisagov/skeleton-python-library#58

src/cyhy_runner/cyhy_runner.py Show resolved Hide resolved
# Standard Python Libraries
from typing import List

from ._version import __version__ # noqa: F401
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from ._version import __version__ # noqa: F401
# Module imported but unused - ignored to preserve skeleton functionality
from ._version import __version__ # noqa: F401

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not directly used, which is what makes flake8 mad, but it populates cyhy_runner.__version__, which is used to get version information about the package. A comment fleshing out why it's got a noqa on it should be added to cisagov/skeleton-python-library. This is related to how we've chosen to SSoT the package version from the options recommended by Python packaging conventions.

Copy link
Contributor

@hillaryj hillaryj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦖

Sort the install_requires and extras_require["test"] arguments by key.
@lgtm-com
Copy link

lgtm-com bot commented Nov 13, 2020

This pull request fixes 3 alerts when merging 01fcc26 into 74d2cfb - view on LGTM.com

fixed alerts:

  • 3 for Unused import

mcdonnnj and others added 15 commits November 15, 2020 23:02
Group related pre-commit hooks together. Make sure that hooks are
alphabetically sorted within those groups.
Switch to the file line reading version of extracting the version from
https://packaging.python.org/guides/single-sourcing-package-version/
instead of the exec method on the same page. The exec method required us to use
a "# nosec" to manually disable Bandit checking on that line. Although that
method is more straightforward, I do not feel that it is worth using an exec in
the codebase when another option is available.
…gihub-dir

Ensure that the cisagov devs are the owners of the .github directory
…re-simply

Use the python version output by actions/setup-python
Also updated the test and build jobs in the build workflow to mirror cache key
format changes in the lint job.
⚠️ CONFLICT! Lineage pull request for: skeleton
Sort the Package Requirements in setup.py
Remove or Explain Manual Testing Check Disables
@lgtm-com
Copy link

lgtm-com bot commented Dec 2, 2020

This pull request fixes 3 alerts when merging 514e491 into 74d2cfb - view on LGTM.com

fixed alerts:

  • 3 for Unused import

@mcdonnnj mcdonnnj merged commit 3f21365 into develop Dec 2, 2020
@mcdonnnj mcdonnnj deleted the skeletonize branch December 2, 2020 18:18
mcdonnnj added a commit that referenced this pull request Aug 4, 2021
I believe that this was missed when #3 was merged due to
timing between when this change was made in cisagov/skeleton-python-library#51
and when #2 was merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This issue or pull request involves changes to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update runner to Py3
5 participants