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

Upgrade project structure so a package can be build #244

Merged
merged 7 commits into from
Apr 10, 2024

Conversation

javierdelapuente
Copy link
Contributor

@javierdelapuente javierdelapuente commented Apr 9, 2024

Applicable spec:

Overview

Currently, the repo https://github.com/canonical/gatekeeper-repo-test has a copy of all the code of this (discourse-gatekeeper) repo.

This is problematic, as it has to be updated from time to time. This PR prepares discourse-gatekeeper to be used as a package, so it can be easily included in https://github.com/canonical/gatekeeper-repo-test (see canonical/gatekeeper-repo-test#466 for a working example).

The main change of this PR is to put all the code under the gatekeeper module (instead of just under src) and preparing pyproject.toml for the building.

Rationale

Module Changes

Checklist

  • The contributing guide was applied
  • The documentation is generated using src-docs
  • The PR is tagged with appropriate label (urgent, trivial, complex)
  • Changelog has been updated
  • Version has been incremented

deusebio
deusebio previously approved these changes Apr 10, 2024
Copy link
Collaborator

@deusebio deusebio left a comment

Choose a reason for hiding this comment

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

This is REALLY great! It was definitely needed. I'm still ashamed of myself for doing the copy and paste of the source code for the discourse-test 😂

@deusebio
Copy link
Collaborator

Actually, one thought: maybe it would make things a bit more structured (and it should be rather straightforward) if when we merge to main, we also release the python package with github releases. Then one can simply install this using

pip install https://github.com/canonical/discourse-gatekkeeper/releases/download/vX.Y.Z/gatekeeper-X.Y.Z-py3-none-any.whl

Eventually we could publish this to pypi, but it is probably not needed right now, and I believe github releases would be good enough. This would however provide a bit of better versioning of this and allow version pinning. I would really not use

git+https://github.com/canonical/discourse-gatekeeper.git@main

We have done these things above in this repository: here is the CI and here are the releases.

jdkandersson
jdkandersson previously approved these changes Apr 10, 2024
.dockerignore Outdated Show resolved Hide resolved
@jdkandersson
Copy link
Contributor

Actually, one thought: maybe it would make things a bit more structured (and it should be rather straightforward) if when we merge to main, we also release the python package with github releases. Then one can simply install this using

pip install https://github.com/canonical/discourse-gatekkeeper/releases/download/vX.Y.Z/gatekeeper-X.Y.Z-py3-none-any.whl

Eventually we could publish this to pypi, but it is probably not needed right now, and I believe github releases would be good enough. This would however provide a bit of better versioning of this and allow version pinning. I would really not use

git+https://github.com/canonical/discourse-gatekeeper.git@main

We have done these things above in this repository: here is the CI and here are the releases.

I agree with this, probably we should do it as well :)

@javierdelapuente javierdelapuente dismissed stale reviews from jdkandersson and deusebio via 856e1bc April 10, 2024 12:18
@javierdelapuente
Copy link
Contributor Author

javierdelapuente commented Apr 10, 2024

Actually, one thought: maybe it would make things a bit more structured (and it should be rather straightforward) if when we merge to main, we also release the python package with github releases. Then one can simply install this using

pip install https://github.com/canonical/discourse-gatekkeeper/releases/download/vX.Y.Z/gatekeeper-X.Y.Z-py3-none-any.whl

Eventually we could publish this to pypi, but it is probably not needed right now, and I believe github releases would be good enough. This would however provide a bit of better versioning of this and allow version pinning. I would really not use

git+https://github.com/canonical/discourse-gatekeeper.git@main

We have done these things above in this repository: here is the CI and here are the releases.

I agree with this, probably we should do it as well :)

Do you mind to leave it for a following PR? Its first use is just for the e2e tests, which will use branches (and using main and failing is also good, as it is a test). Clearly publishing is better for the main case if the library is used outside the e2e use.

@deusebio
Copy link
Collaborator

Do you mind to leave it for a following PR? Its first use is just for the e2e tests, which will use branches (and using main and failing is also good, as it is a test). Clearly publishing is better for the main case if the library is used outside the e2e use.

It was not a blocking comment on my side (actually I had already approved I believe). Up to you guys

Copy link

Test coverage for 856e1bc

Name                                 Stmts   Miss Branch BrPart  Cover   Missing
--------------------------------------------------------------------------------
src/gatekeeper/__init__.py              97      0     42      0   100%
src/gatekeeper/action.py               159      0     48      0   100%
src/gatekeeper/check.py                 63      0     25      0   100%
src/gatekeeper/clients.py               12      0      0      0   100%
src/gatekeeper/commit.py                42      0     12      0   100%
src/gatekeeper/constants.py              9      0      0      0   100%
src/gatekeeper/content.py               50      0     10      0   100%
src/gatekeeper/discourse.py            159      0     34      0   100%
src/gatekeeper/docs_directory.py        33      0      8      0   100%
src/gatekeeper/download.py              22      0      2      0   100%
src/gatekeeper/exceptions.py            15      0      0      0   100%
src/gatekeeper/index.py                142      0     56      0   100%
src/gatekeeper/metadata.py              59      0     28      0   100%
src/gatekeeper/migration.py            102      0     33      0   100%
src/gatekeeper/navigation_table.py      65      0     20      0   100%
src/gatekeeper/reconcile.py            123      0     60      0   100%
src/gatekeeper/repository.py           293      0     88      0   100%
src/gatekeeper/sort.py                  43      0     26      0   100%
src/gatekeeper/types_.py               202      0     54      0   100%
--------------------------------------------------------------------------------
TOTAL                                 1690      0    546      0   100%

Static code analysis report

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:01
Run started:2024-04-10 13:14:14.292121

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 17878
  Total lines skipped (#nosec): 3
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@javierdelapuente javierdelapuente merged commit ec4c1b1 into main Apr 10, 2024
24 checks passed
@javierdelapuente javierdelapuente deleted the project-structure-for-package branch April 10, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants