Skip to main content

code

This repo holds a variety of tools in support of the GDA Score Project (General Data Anonymity Score Project).

The code here is still very much alpha, and little effort has gone into making it easy for others to install and use.

The primary language is Python, and requires Python3.7 or later. API documentation for some of the tools can be found at https://gda-score.github.io/.

To run

Installing via pip:

  • step 1: $ pip install gda-score-code

  • step 2: if you would like to stick to default configuration then skip this step. otherwise try executing $ gdascore_init in your console to modify the configuration. This initiation script can also set required environment variables (step 3) automatically.

  • step 3: gdascore package needs at least 4 environment variables as for fatabase credentials. to set those on windows, go to "Edit the system environment variable > Environment Variables... > New..." and set:

    • GDA_SCORE_DIFFIX_USER : gda-score_ro_user
    • GDA_SCORE_DIFFIX_PASS : moquaiR7
    • GDA_SCORE_RAW_USER : gda-score_ro_user
    • GDA_SCORE_RAW_PASS : moquaiR7
  • step 4: use import statements such as the following in your code (see examples in attacks and utility repos):

    from gdascore.gdaAttack import gdaAttack
    from gdascore.gdaScore import gdaScores    
    from gdascore.gdaTools import setupGdaAttackParameters  
    from gdascore.gdaQuery import *   
    

How to update package on pip

Please follow the steps below if you are a contributor and want to upload new release of the library on pip.

  1. open pypi.org and create a new account if you don't have one.
  2. send us your username to be added as a maintainer of the package on pypi that lets you upload a new release
  3. install twine using: pip install twine
  4. clean build files if there is any by running: python setup.py clean --all and also delete any folder named dist as the setup will create that itself and you won't face vrsion confilict because of past builds anymore.
  5. update the version of package in the file setup.py and increase it. it is not possible to upload same version twice so remember to do that. name parameter should not change. For example:
setuptools.setup(  
    name="gda-score-code",  
    version="2.2.6", # increase it
    author="Paul Francis",
    ...
  )
  1. build the package: python setup.py sdist bdist_wheel
  2. upload to pypi: twine upload dist/*
  3. it will first ask for your username and password and then start uploading.

note: you can always first upload the package into test.pypi.org instead of the main one to try installing it yourself and then upload to the main pypi repository. should you need to do that please refer to : https://packaging.python.org/guides/using-testpypi/

Documentation

Documentations for this project are being generated automatically out of "docStrings" available in the code. We use pdoc3 as a tool for that. Steps for updating documentation are as follows:

  1. install "pdoc3": pip install pdoc3
  2. populate the code with docStrings in python modules, classes, functions, etc.
  3. on your terminal go to project root folder and execute the command bellow:
pdoc -o ./docs --force --html --template-dir ./docs/template --filter gdaScore,gdaAttack,gdaTools gdascore
  • -o ./docs: defines output directory
  • --force: overrides current files in output directory
  • --html: defines output format
  • --template-dir ./docs/template: defines custom template directory that is used to generate output
  • --filter gdaScore,gdaAttack,gdaTools: defines modules that has to be documented from the package. any other python file in the package will be ignored for documentation.
  • gdascore: defines the name of package (directory)

How to exclude certain part of code from documentation

pdoc will by default include every piece of code that is "public" in the documentation. To avoid that, define a list on top of your module and name it __all__ and put the name of classes, functions, variables, etc. that you want to be documented in that list as strings. for example:

module.py


__all__ = ["increase"]

my_var = 0

def increase():
    """
    this function increases the value of 'my_var' by 1 and return it.
    """
    global my_var
    my_var += 1
    return my_var

Note that defining __all__ will override things that gets imported when you use from module import * later. However, you can have access to anything when you import them specifically like from module import my_var as well as import module. It is generally recommended to avoid from module import *

How to modify master html template for documentation

To modify the template that is used by pdoc for generating html formatted documentation, simply edit files under /docs/template:

  • credits.mako will be included in the footer of every page.
  • head.mako will be included in the <head>/<head> of every page. It is good for modifying css styles, title, etc. of the page.
  • logo.mako will be included in logo placeholder (or simply header) of the page.

In case you need to perform more modification to the template, please refer to original pdoc documentation

Release files for gda-score-code 2.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gda-score-code 2.3.5
File Size Uploaded
gda-score-code-2.3.5.tar.gz 34.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gda-score-code 2.3.5
File Interpreter ABI Platform
gda_score_code-2.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 72.6 kB

Release files / gda-score-code-2.3.5.tar.gz

Download URL gda-score-code-2.3.5.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d4a0c652c0e5571f9107ea8de72a9b38bfeb5f14aa4eba76e66fdb038041a1f7
BLAKE2b-256 checksum
How to use checksums
4b7894154a0b6b938a323fa31c9d3b45905b1bfa5751ead72dcefe61637050dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.9

Release files / gda_score_code-2.3.5-py3-none-any.whl

Download URL gda_score_code-2.3.5-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e39999d9573f406cd4b484784ca954cc6608abaea7f1dc7cc473f8f4cefa0d30
BLAKE2b-256 checksum
How to use checksums
07458a447ba30cc0aa2260c871e5c913a25c8f4a8c0927de56d3d06ee4474ace
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.9

Release history Release notifications | RSS feed

2.5.4

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.9

2 release files

2.4.8

2 release files

2.4.7

2 release files

2.4.6

2 release files

2.4.5

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.9

2 release files

2.3.8

2 release files

2.3.7

2 release files

2.3.6

2 release files

This release

2.3.5 This release

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.1.1

2 release files

2.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page