{"id":20648638,"url":"https://github.com/ccextractor/sample-platform","last_synced_at":"2025-04-07T07:08:29.516Z","repository":{"id":37796954,"uuid":"60988076","full_name":"CCExtractor/sample-platform","owner":"CCExtractor","description":"CCExtractor's Sample \u0026 CI platform. Developed during GSoC 2016","archived":false,"fork":false,"pushed_at":"2025-03-20T11:49:48.000Z","size":4162,"stargazers_count":24,"open_issues_count":17,"forks_count":50,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T05:08:03.288Z","etag":null,"topics":["ccextractor","hacktoberfest","python"],"latest_commit_sha":null,"homepage":"https://sampleplatform.ccextractor.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CCExtractor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-12T20:37:05.000Z","updated_at":"2025-03-22T06:41:18.000Z","dependencies_parsed_at":"2024-11-03T21:28:53.215Z","dependency_job_id":null,"html_url":"https://github.com/CCExtractor/sample-platform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCExtractor%2Fsample-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCExtractor%2Fsample-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCExtractor%2Fsample-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CCExtractor%2Fsample-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CCExtractor","download_url":"https://codeload.github.com/CCExtractor/sample-platform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608151,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ccextractor","hacktoberfest","python"],"created_at":"2024-11-16T17:09:37.970Z","updated_at":"2025-04-07T07:08:29.497Z","avatar_url":"https://github.com/CCExtractor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CCExtractor Sample Platform\n\n[![Run tests and code checks](https://github.com/CCExtractor/sample-platform/workflows/Run%20tests%20and%20code%20checks/badge.svg)](https://github.com/CCExtractor/sample-platform/actions?query=workflow%3A%22Run+tests+and+code+checks%22) [![codecov](https://codecov.io/gh/CCExtractor/sample-platform/branch/master/graph/badge.svg)](https://codecov.io/gh/CCExtractor/sample-platform)\n\nThis repository contains the code for a platform that manages a test suite bot, sample upload and more. This platform allows for a unified place to\nreport errors, submit samples, view existing samples and more. It was\noriginally developed during GSoC 2015 and rewritten during the 2016 edition. It was further improved and worked upon during GSoC 2017, 2018, 2019 and 2022.\n\nTo see the live version of the platform, simply go to\n[CCExtractor Submission Platform](https://sampleplatform.ccextractor.org/).\n\n## Concept\n\nWhile CCExtractor is an awesome tool and it works flawlessly most of the time,\nbugs occur occasionally (as with all existing software). These are usually\nreported through a variety of channels (private email, mailing list, GitHub,\nand so on...).\n\nThe aim of this project is to build a platform, which is accessible to\neveryone ([after signing up](https://sampleplatform.ccextractor.org/account/signup)), that provides a single place to upload, view \nsamples and associated test results.\n\n## Installation\n\nAn installation guideline can be found here:\n[installation guide](install/installation.md).\n\n## Sample Updates\n\nA lot of times it may happen that we add new features to ccextractor which render the result files associated with\nregression tests useless. In these cases, the tests can give false negative. For such cases, we should update the existing\nresult files by the following command.\n\n```shell\npython manage.py update /path/to/ccextractor/executable\n```\n\nNOTE: Please backup old results and be sure about updating them as there is no method to go back.\n\n## Database Migrations\n\nSample-Platform uses flask-migrate to handle database migrations.\n\nIf you want to perform more complex actions than the ones mentioned below, please have a look at the [flask-migrate \ncommand reference](https://flask-migrate.readthedocs.io/en/latest/#command-reference).\n\n**NOTE: For the below commands to function properly, `FLASK_APP=/path/to/run.py` should be set in the environment variables.**\n\n#### First Time With Flask-Migrate\n\nIf this is the first time that flask-migrate is being installed or run alongside existing database, use the \nfollowing command to create a head stamp in your database:\n\n```bash\nflask db stamp head\n```\n\n#### Applying Schema Update On Existing Database\n\nIt is recommeneded to perform Database upgrades, whenever database schema is updated, using the below commands:\n\n```bash\nflask db upgrade\n```\n\n#### Removing Last Schema Update On Existing Database\n\nRemove the last database update using the below commands:\n\n```bash\nflask db downgrade\n```\n\n#### Updating Schema\n\nWhenever a database model's schema is update, run the following command to generate migrations for it.\n\n```bash\nflask db migrate\n```\n\n## Contributing\n\nAll information with regards to contributing can be found here:\n[contributors guide](.github/CONTRIBUTING.md).\n\n## Testing\n\nSample-platform is regularly tested via Travis CI.\n\nWe use `nosetests` to manage testing and it can be run locally as follows:\n\nFor creating a virtual environment, we use [virtualenv](https://pypi.org/project/virtualenv/).\n\n```bash\nvirtualenv venv                          # create a virtual environment\nsource venv/bin/activate                 # activate the virtual environment\npip install -r requirements.txt          # install dependencies\npip install -r test-requirements.txt     # install test dependencies\nTESTING=True nose2\n```\n\n## Migrating platform between machines\n\nIn case you want to replicate/migrate a platform instance with all the data, samples, regression tests.etc., follow the following steps:\n- Install platform on the new instance, using the [installation guide](install/installation.md).\n- Now transfer the contents of the previous GCS bucket to the new GCS bucket and export the SQL database of the previous platform instance into a file using the following command:\n    ```\n    mysqldump -u PLATFORM_USER_USERNAME -p PLATFORM_DATABASE_NAME \u003e sample_platform.sql\n    ```\n    PLATFORM_USER_USERNAME and PLATFORM_DATABASE_NAME values are details for the SQL database of the previous platform instance.\n- Now import the database using the `sample_platform.sql` file into the new instance using the following command:\n    ```\n    mysql -u NEW_PLATFORM_USER_USERNAME -p NEW_PLATFORM_DATABASE_NAME \u003c sample_platform.sql\n    ```\n    NEW_PLATFORM_USER_USERNAME and NEW_PLATFORM_DATABASE_NAME values are details for the SQL database of the new platform instance.\n\n## Etiquettes\n\nWe follow certain etiquettes which include docstrings, annotation, import sorting etc.\n\n### DocStrings Testing\n\nSample-platform uses docstrings heavily to document modules and methods.\n\nWe use `pydocstyle` to oversee the docstring format and etiquettes. Please run the following to check if you've\nfollowed the style before sending a PR.\n\n```bash\npydocstyle ./           # check all .py files with pydocstyle\n```\n\n### Imports\n\nWe use `isort` to introduce a style on how imports should be made.\n\nPlease check your imports before making a commit using the following commands.\n\n```bash\nisort . --diff      # see proposed changes without applying them\nisort . --atomic    # apply changes to import order without breaking syntax\n```\n\n### Generate Typing And Annotations\n\nWe use `MonkeyType` or `PyType` to generate typing for our code. It is a simple tool that [semi] automates the\nprocess of generating annotations using runtime trace.\n\nTo generate typing for your code, follow the below procedure.\n\n#### Using MonkeyType\n\nThis method uses runtime trace information to generate typing and is **highly recommended** over using `PyType`.\n\nNOTE: You **must have written unit-tests for the new code** in order to add annotations using MonkeyType.\n\n```bash\nmonkeytype run `TESTING=True nosetests path/to/new.py/file:ClassName`     # classname where new tests added\nmonkeytype apply module.name                                               # apply the suggested changes\n```\n\n#### Using PyType\n\nThis method uses the knowledge of how the code is used to figure out the types.\n\nNOTE: Only use this method only if `MonkeyType` method fails for the file.\n\n```bash\npytype path/to/.py/file                    # path to the new code's file\nmerge-pyi -i path/to/.py/file .pytype/pyi/path/to/.pyi/file     # apply the suggested changes\n```\n\nOnce you've generated the annotations using the above tools, follow the below procedure.\n\n```bash\nisort --atmoic /path/to/new.py/file                                        # sort the imports\nmypy /path/to/new.py/file                                                  # fix the errors reported by mypy\ngit diff /path/to/new.py/file                                              # manually check the file for missing typings\npycodestyle ./ --config=./.pycodestylerc                                   # to check for PEP8 violations\n```\n\nNOTE: Manual inspection is very important. If then you feel that a mypy error is inappropriate or overkill, append\n`# type: ignore` at the end of the line.\n\nOnly once the above procedure is finished for all new files, one should commit the changes.\n\nReferences to know more:\n\n- To know about static typing: https://realpython.com/python-type-checking/#annotations\n- To know about MonkeyType: https://instagram-engineering.com/let-your-code-type-hint-itself-introducing-open-source-monkeytype-a855c7284881\n- To know about PyType: https://github.com/google/pytype\n- MyPy Cheatsheet for TypeHints: https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html\n\n### Static Typing Test\n\nWe use `mypy` to introduce a static typing.\n\nPlease check your code for static typing violations using the following commands.\n\n```bash\nmypy .\n```\n\n## Security\n\nEven though many precautions have been taken to ensure that this software is\nstable and secure, bugs can occur. In case there is a security related issue,\nplease send an email to ccextractor@canihavesome.coffee (GPG key\n[0xF8643F5B](http://pgp.mit.edu/pks/lookup?op=vindex\u0026search=0x3AFDC9BFF8643F5B),\nfingerprint 53FF DE55 6DFC 27C3 C688 1A49 3AFD C9BF F864 3F5B) instead of\nusing the issue tracker. This will help to prevent abuse while the issue is\nbeing resolved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccextractor%2Fsample-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccextractor%2Fsample-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccextractor%2Fsample-platform/lists"}