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

Support for Python Private Packages Using Private : : Classifier #3968 #3982

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alok1304
Copy link

@alok1304 alok1304 commented Nov 9, 2024

Fixes #3968
Changes Implemented:
Added support for the Private :: Do Not Upload classifier in the setup configuration.
Updated the setup.cfg file to enable users to designate their packages as private using this classifier.

Signed-off-by: Alok Kumar <alokkumarjipura9973@gmail.com>
@stefan6419846
Copy link

How does this solve the linked issue? Your change basically declares scancode-toolkit as a private package, which surely is not what the issue has been about.

@alok1304
Copy link
Author

alok1304 commented Nov 12, 2024

Hi @stefan6419846 , thanks for the feedback! I see now that my recent commit may have inadvertently declared scancode-toolkit as private, which wasn’t the intention. I think here is the goal here is to add support for theis_privateflag by detecting the Private :: classifier in user packages, rather than marking scancode-toolkit itself as private.

can you tell how I work on it.

@AyanSinhaMahapatra
Copy link
Member

@alok1304 you have to update the pyproject.toml parser at https://github.com/aboutcode-org/scancode-toolkit/blob/develop/src/packagedcode/pypi.py#L503 to make sure we handle these private package manifests correctly. See also f848741 to check how we did this for other package ecosystems. Start by adding a test file from #3968 (comment), similarly like the tests in https://github.com/aboutcode-org/scancode-toolkit/blob/develop/tests/packagedcode/test_pypi.py#L305

@alok1304
Copy link
Author

@AyanSinhaMahapatra Thankyou!!

@alok1304
Copy link
Author

@AyanSinhaMahapatra

name = project_data.get('name')
is_private = False

# Check for privacy classifier
classifiers = project_data.get('classifiers', [])
for classifier in classifiers:
    if 'Private ::' in classifier:
        is_private = True
        break  # Once a private classifier is found, no need to continue checking

# If no classifier or name, package is private by default
if not name:
    is_private = True

is this correct??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Python private packages
3 participants