anyvar 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. anyvar-1.0.0/.dockerignore +33 -0
  2. anyvar-1.0.0/.env.example +42 -0
  3. anyvar-1.0.0/.git-blame-ignore-revs +3 -0
  4. anyvar-1.0.0/.github/CODEOWNERS +1 -0
  5. anyvar-1.0.0/.github/ISSUE_TEMPLATE/bug-report.yaml +93 -0
  6. anyvar-1.0.0/.github/ISSUE_TEMPLATE/feature-request.yaml +68 -0
  7. anyvar-1.0.0/.github/labels.yml +3 -0
  8. anyvar-1.0.0/.github/workflows/labels.yml +29 -0
  9. anyvar-1.0.0/.github/workflows/python-package.yml +133 -0
  10. anyvar-1.0.0/.github/workflows/release.yml +102 -0
  11. anyvar-1.0.0/.github/workflows/stale.yml +11 -0
  12. anyvar-1.0.0/.gitignore +126 -0
  13. anyvar-1.0.0/.pre-commit-config.yaml +21 -0
  14. anyvar-1.0.0/.readthedocs.yaml +16 -0
  15. anyvar-1.0.0/.service_info_example.yaml +14 -0
  16. anyvar-1.0.0/CITATION.cff +35 -0
  17. anyvar-1.0.0/Dockerfile +39 -0
  18. anyvar-1.0.0/LICENSE +201 -0
  19. anyvar-1.0.0/Makefile +141 -0
  20. anyvar-1.0.0/PKG-INFO +323 -0
  21. anyvar-1.0.0/README.md +61 -0
  22. anyvar-1.0.0/compose.yaml +90 -0
  23. anyvar-1.0.0/docs/Makefile +20 -0
  24. anyvar-1.0.0/docs/source/_templates/module_summary.rst +8 -0
  25. anyvar-1.0.0/docs/source/_templates/module_summary_no_inherit.rst +9 -0
  26. anyvar-1.0.0/docs/source/api/api/anyvar.anyvar.rst +8 -0
  27. anyvar-1.0.0/docs/source/api/api/anyvar.core.metadata.rst +8 -0
  28. anyvar-1.0.0/docs/source/api/api/anyvar.core.objects.rst +8 -0
  29. anyvar-1.0.0/docs/source/api/api/mapping/anyvar.mapping.liftover.rst +8 -0
  30. anyvar-1.0.0/docs/source/api/api/queueing/anyvar.queueing.celery_worker.rst +8 -0
  31. anyvar-1.0.0/docs/source/api/api/storage/anyvar.storage.base.rst +9 -0
  32. anyvar-1.0.0/docs/source/api/api/storage/anyvar.storage.mapper_registry.rst +9 -0
  33. anyvar-1.0.0/docs/source/api/api/storage/anyvar.storage.mappers.rst +9 -0
  34. anyvar-1.0.0/docs/source/api/api/storage/anyvar.storage.no_db.rst +9 -0
  35. anyvar-1.0.0/docs/source/api/api/storage/anyvar.storage.orm.rst +9 -0
  36. anyvar-1.0.0/docs/source/api/api/storage/anyvar.storage.postgres.rst +9 -0
  37. anyvar-1.0.0/docs/source/api/api/translate/anyvar.translate.base.rst +8 -0
  38. anyvar-1.0.0/docs/source/api/api/translate/anyvar.translate.vrs_python.rst +8 -0
  39. anyvar-1.0.0/docs/source/api/api/vcf/anyvar.vcf.ingest.rst +8 -0
  40. anyvar-1.0.0/docs/source/api/index.rst +73 -0
  41. anyvar-1.0.0/docs/source/changelog.rst +7 -0
  42. anyvar-1.0.0/docs/source/conf.py +62 -0
  43. anyvar-1.0.0/docs/source/configuration/async.rst +99 -0
  44. anyvar-1.0.0/docs/source/configuration/authentication.rst +155 -0
  45. anyvar-1.0.0/docs/source/configuration/docker_compose.rst +156 -0
  46. anyvar-1.0.0/docs/source/configuration/dotenv_example.rst +4 -0
  47. anyvar-1.0.0/docs/source/configuration/index.rst +26 -0
  48. anyvar-1.0.0/docs/source/configuration/logging.rst +66 -0
  49. anyvar-1.0.0/docs/source/configuration/service_info.rst +23 -0
  50. anyvar-1.0.0/docs/source/configuration/snowflake.rst +97 -0
  51. anyvar-1.0.0/docs/source/configuration/storage.rst +41 -0
  52. anyvar-1.0.0/docs/source/contributing.rst +58 -0
  53. anyvar-1.0.0/docs/source/features.rst +74 -0
  54. anyvar-1.0.0/docs/source/getting_started/docker_compose.rst +46 -0
  55. anyvar-1.0.0/docs/source/getting_started/index.rst +14 -0
  56. anyvar-1.0.0/docs/source/getting_started/manual_setup.rst +100 -0
  57. anyvar-1.0.0/docs/source/help.rst +10 -0
  58. anyvar-1.0.0/docs/source/index.rst +26 -0
  59. anyvar-1.0.0/docs/source/license.rst +4 -0
  60. anyvar-1.0.0/docs/source/usage/index.rst +16 -0
  61. anyvar-1.0.0/docs/source/usage/python.rst +164 -0
  62. anyvar-1.0.0/docs/source/usage/rest_api.rst +189 -0
  63. anyvar-1.0.0/docs/source/usage/rest_service.rst +35 -0
  64. anyvar-1.0.0/pyproject.toml +197 -0
  65. anyvar-1.0.0/scripts/vcf_benchmark.py +157 -0
  66. anyvar-1.0.0/setup.cfg +4 -0
  67. anyvar-1.0.0/src/anyvar/__init__.py +13 -0
  68. anyvar-1.0.0/src/anyvar/anyvar.py +266 -0
  69. anyvar-1.0.0/src/anyvar/core/__init__.py +1 -0
  70. anyvar-1.0.0/src/anyvar/core/metadata.py +41 -0
  71. anyvar-1.0.0/src/anyvar/core/objects.py +60 -0
  72. anyvar-1.0.0/src/anyvar/mapping/__init__.py +1 -0
  73. anyvar-1.0.0/src/anyvar/mapping/liftover.py +260 -0
  74. anyvar-1.0.0/src/anyvar/queueing/__init__.py +1 -0
  75. anyvar-1.0.0/src/anyvar/queueing/celery_worker.py +321 -0
  76. anyvar-1.0.0/src/anyvar/restapi/__init__.py +1 -0
  77. anyvar-1.0.0/src/anyvar/restapi/auth.py +286 -0
  78. anyvar-1.0.0/src/anyvar/restapi/main.py +101 -0
  79. anyvar-1.0.0/src/anyvar/restapi/meta_router.py +19 -0
  80. anyvar-1.0.0/src/anyvar/restapi/objects_router.py +486 -0
  81. anyvar-1.0.0/src/anyvar/restapi/schema.py +315 -0
  82. anyvar-1.0.0/src/anyvar/restapi/search_router.py +64 -0
  83. anyvar-1.0.0/src/anyvar/restapi/vcf_router.py +664 -0
  84. anyvar-1.0.0/src/anyvar/storage/__init__.py +7 -0
  85. anyvar-1.0.0/src/anyvar/storage/base.py +200 -0
  86. anyvar-1.0.0/src/anyvar/storage/mapper_registry.py +69 -0
  87. anyvar-1.0.0/src/anyvar/storage/mappers.py +246 -0
  88. anyvar-1.0.0/src/anyvar/storage/no_db.py +80 -0
  89. anyvar-1.0.0/src/anyvar/storage/orm.py +307 -0
  90. anyvar-1.0.0/src/anyvar/storage/postgres.py +407 -0
  91. anyvar-1.0.0/src/anyvar/storage/snowflake.py +754 -0
  92. anyvar-1.0.0/src/anyvar/translate/__init__.py +15 -0
  93. anyvar-1.0.0/src/anyvar/translate/base.py +84 -0
  94. anyvar-1.0.0/src/anyvar/translate/vrs_python.py +131 -0
  95. anyvar-1.0.0/src/anyvar/vcf/__init__.py +1 -0
  96. anyvar-1.0.0/src/anyvar/vcf/ingest.py +240 -0
  97. anyvar-1.0.0/src/anyvar.egg-info/PKG-INFO +323 -0
  98. anyvar-1.0.0/src/anyvar.egg-info/SOURCES.txt +126 -0
  99. anyvar-1.0.0/src/anyvar.egg-info/dependency_links.txt +1 -0
  100. anyvar-1.0.0/src/anyvar.egg-info/requires.txt +43 -0
  101. anyvar-1.0.0/src/anyvar.egg-info/top_level.txt +1 -0
  102. anyvar-1.0.0/tests/__init__.py +0 -0
  103. anyvar-1.0.0/tests/conftest.py +165 -0
  104. anyvar-1.0.0/tests/data/service_info_openapi.yaml +122 -0
  105. anyvar-1.0.0/tests/data/variations.json +510 -0
  106. anyvar-1.0.0/tests/integration/restapi/conftest.py +67 -0
  107. anyvar-1.0.0/tests/integration/restapi/objects_router/test_annotation.py +63 -0
  108. anyvar-1.0.0/tests/integration/restapi/objects_router/test_location.py +18 -0
  109. anyvar-1.0.0/tests/integration/restapi/objects_router/test_mappings.py +194 -0
  110. anyvar-1.0.0/tests/integration/restapi/objects_router/test_variation.py +196 -0
  111. anyvar-1.0.0/tests/integration/restapi/test_search_router.py +26 -0
  112. anyvar-1.0.0/tests/integration/restapi/vcf_router/test_annotate_vcf.py +383 -0
  113. anyvar-1.0.0/tests/integration/restapi/vcf_router/test_ingest_vcf.py +343 -0
  114. anyvar-1.0.0/tests/unit/__init__.py +0 -0
  115. anyvar-1.0.0/tests/unit/mapping/__init__.py +0 -0
  116. anyvar-1.0.0/tests/unit/mapping/test_liftover.py +234 -0
  117. anyvar-1.0.0/tests/unit/restapi/__init__.py +0 -0
  118. anyvar-1.0.0/tests/unit/restapi/test_auth.py +1031 -0
  119. anyvar-1.0.0/tests/unit/restapi/test_meta_router.py +65 -0
  120. anyvar-1.0.0/tests/unit/restapi/test_schema.py +14 -0
  121. anyvar-1.0.0/tests/unit/storage/__init__.py +0 -0
  122. anyvar-1.0.0/tests/unit/storage/conftest.py +35 -0
  123. anyvar-1.0.0/tests/unit/storage/storage_test_funcs.py +483 -0
  124. anyvar-1.0.0/tests/unit/storage/test_no_db.py +38 -0
  125. anyvar-1.0.0/tests/unit/storage/test_postgres.py +121 -0
  126. anyvar-1.0.0/tests/unit/storage/test_snowflake.py +107 -0
  127. anyvar-1.0.0/tests/unit/storage/test_snowflake_dyntable.py +128 -0
  128. anyvar-1.0.0/tests/unit/test_anyvar.py +43 -0
@@ -0,0 +1,33 @@
1
+ # Bytecode files
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+
6
+ # Virtual environment
7
+ venv/
8
+ .venv/
9
+
10
+ # Debug and log files
11
+ *.log
12
+ debug*.txt
13
+
14
+ # Data and media
15
+ data/
16
+ media/
17
+
18
+ # Temporary files and directories
19
+ tmp/
20
+ temp/
21
+ *.swp
22
+
23
+ # IDE and OS files
24
+ .idea/
25
+ .vscode/
26
+ .DS_Store
27
+
28
+ # Distribution files
29
+ dist/
30
+ build/
31
+ *.egg-info/
32
+
33
+ .env
@@ -0,0 +1,42 @@
1
+ ###############
2
+ # BASIC SETUP #
3
+ ###############
4
+
5
+ # Data resources -- see "Getting Started" -> "Manual Setup" in the docs
6
+ UTA_DB_URL=postgresql://anonymous@localhost:5432/uta/uta_20241220
7
+ SEQREPO_DATAPROXY_URI=seqrepo+file:///usr/local/share/seqrepo/2024-12-20
8
+
9
+ # Storage configuration -- see "Configuration" -> "Object Storage" in the docs
10
+ ANYVAR_STORAGE_URI=postgresql://anyvar:anyvar-pw@localhost:5432/anyvar
11
+
12
+ ############
13
+ # OPTIONAL #
14
+ ############
15
+
16
+ ## Service info definition -- see "Configuration" -> "Service-Info" in the docs
17
+ ANYVAR_SERVICE_INFO=./.service_info_example.yaml
18
+
19
+ ## Logging - see "Configuration" -> "Logging" in the docs
20
+ ANYVAR_LOGGING_CONFIG=path/to/logging/config/file.yaml
21
+
22
+ ## Celery - See "Configuration" -> "Asynchronous Processing" in the docs
23
+ CELERY_BROKER_URL=redis://localhost:6379/0
24
+ CELERY_BACKEND_URL=redis://localhost:6379/0
25
+ ANYVAR_VCF_ASYNC_WORK_DIR=/path/to/shared/file/system
26
+ ANYVAR_VCF_ASYNC_FAILURE_STATUS_CODE=500
27
+ CELERY_TASK_DEFAULT_QUEUE=anyvar_q
28
+ CELERY_EVENT_QUEUE_PREFIX=anyvar_ev
29
+ CELERY_TIMEZONE=UTC
30
+ CELERY_RESULT_EXPIRES=7200
31
+ CELERY_TASK_ACKS_LATE=true
32
+ CELERY_TASK_REJECT_ON_WORKER_LOST=false
33
+ CELERY_WORKER_PREFETCH_MULTIPLIER=1
34
+ CELERY_TASK_TIME_LIMIT=3900
35
+ CELERY_SOFT_TIME_LIMIT=3600
36
+ CELERY_WORKER_SEND_TASK_EVENTS=false
37
+
38
+ ## Testing - see "Contributing" -> "Testing" in the docs
39
+ ANYVAR_TEST_STORAGE_URI=postgresql://postgres:postgres@localhost/anyvar_test
40
+
41
+ # for Docker-based SeqRepo install
42
+ SEQREPO_INSTANCE_DIR="/usr/local/share/seqrepo/2024-12-20"
@@ -0,0 +1,3 @@
1
+ # .git-blame-ignore-revs
2
+ # Initial linting
3
+ 1c01e4880f1973bfad61b7c591508e96e99fe6bc
@@ -0,0 +1 @@
1
+ * @biocommons/anyvar-maintainers
@@ -0,0 +1,93 @@
1
+ name: Bug Report
2
+ description: Report a bug.
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ attributes:
7
+ label: Describe the bug
8
+ description: Provide a clear and concise description of what the bug is.
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ attributes:
13
+ label: Steps to reproduce
14
+ description: Provide detailed steps to replicate the bug.
15
+ placeholder: |
16
+ 1. In this environment...
17
+ 2. With this config...
18
+ 3. Run '...'
19
+ 4. See error...
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ attributes:
24
+ label: Expected behavior
25
+ description: What did you expect to happen?
26
+ validations:
27
+ required: true
28
+ - type: textarea
29
+ attributes:
30
+ label: Current behavior
31
+ description: |
32
+ What actually happened?
33
+
34
+ Include full errors, stack traces, and/or relevant logs.
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ attributes:
39
+ label: Acceptance Criteria
40
+ description: |
41
+ Provide the criteria that must be met in order for this issue to be considered fixed.
42
+ Be specific, and consider potential edge cases.
43
+ validations:
44
+ required: true
45
+ - type: textarea
46
+ attributes:
47
+ label: Possible reason(s)
48
+ description: Provide any insights into what might be causing the issue.
49
+ validations:
50
+ required: false
51
+ - type: textarea
52
+ attributes:
53
+ label: Suggested fix
54
+ description: Provide any suggestions on how to resolve the bug.
55
+ validations:
56
+ required: false
57
+ - type: textarea
58
+ attributes:
59
+ label: Branch, commit, and/or version
60
+ description: Provide the branch, commit, and/or version you're using.
61
+ placeholder: |
62
+ branch: issue-1
63
+ commit: abc123d
64
+ validations:
65
+ required: true
66
+ - type: textarea
67
+ attributes:
68
+ label: Screenshots
69
+ description: If applicable, add screenshots with descriptions to help explain your problem.
70
+ validations:
71
+ required: false
72
+ - type: textarea
73
+ attributes:
74
+ label: Environment details
75
+ description: Provide environment details (OS name and version, etc).
76
+ validations:
77
+ required: true
78
+ - type: textarea
79
+ attributes:
80
+ label: Additional details
81
+ description: Provide any other additional details about the problem.
82
+ validations:
83
+ required: false
84
+ - type: dropdown
85
+ attributes:
86
+ label: Contribution
87
+ description: Can you contribute to the development of this feature?
88
+ options:
89
+ - "Yes, I can create a PR for this fix."
90
+ - "Yes, but I can only provide ideas and feedback."
91
+ - "No, I cannot contribute."
92
+ validations:
93
+ required: false
@@ -0,0 +1,68 @@
1
+ name: Feature Request
2
+ description: Suggest an idea for this project.
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ attributes:
7
+ label: Feature description
8
+ description: Provide a clear and concise description of what you want to happen.
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ attributes:
13
+ label: Use case
14
+ description: |
15
+ Why do you need this feature? For example: "I'm always frustrated when..."
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ attributes:
20
+ label: Acceptance Criteria
21
+ description: |
22
+ Provide the criteria that must be met in order for this issue to be considered complete.
23
+ Be specific, and consider potential edge cases.
24
+ validations:
25
+ required: true
26
+ - type: textarea
27
+ attributes:
28
+ label: Proposed solution
29
+ description: Provide proposed solution.
30
+ validations:
31
+ required: false
32
+ - type: textarea
33
+ attributes:
34
+ label: Alternatives considered
35
+ description: Describe any alternative solutions you've considered.
36
+ validations:
37
+ required: false
38
+ - type: textarea
39
+ attributes:
40
+ label: Implementation details
41
+ description: Provide any technical details on how the feature might be implemented.
42
+ validations:
43
+ required: false
44
+ - type: textarea
45
+ attributes:
46
+ label: Potential Impact
47
+ description: |
48
+ Discuss any potential impacts of this feature on existing functionality or performance, if known.
49
+ Will this feature cause breaking changes?
50
+ What challenges might arise?
51
+ validations:
52
+ required: false
53
+ - type: textarea
54
+ attributes:
55
+ label: Additional context
56
+ description: Provide any other context or screenshots about the feature.
57
+ validations:
58
+ required: false
59
+ - type: dropdown
60
+ attributes:
61
+ label: Contribution
62
+ description: Can you contribute to the development of this feature?
63
+ options:
64
+ - "Yes, I can create a PR for this feature."
65
+ - "Yes, but I can only provide ideas and feedback."
66
+ - "No, I cannot contribute."
67
+ validations:
68
+ required: false
@@ -0,0 +1,3 @@
1
+ # file must contain an array, which may be empty
2
+
3
+ []
@@ -0,0 +1,29 @@
1
+ name: Sync labels
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - 'main'
7
+ paths:
8
+ - '.github/labels.yml'
9
+ - '.github/workflows/labels.yml'
10
+
11
+ permissions:
12
+ issues: write
13
+
14
+ jobs:
15
+ labels:
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ sparse-checkout: .github/labels.yml
22
+
23
+ - uses: EndBug/label-sync@v2
24
+ with:
25
+ config-file: |
26
+ https://raw.githubusercontent.com/biocommons/.github/main/etc/labels.yml
27
+ .github/labels.yml
28
+
29
+ delete-other-labels: false
@@ -0,0 +1,133 @@
1
+ name: Python package
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ lint:
12
+ name: lint
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Setup Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.11"
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v6
24
+ with:
25
+ enable-cache: true
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --extra dev
29
+
30
+ - name: Check style
31
+ run: uv run ruff check && uv run ruff format --check
32
+ test:
33
+ name: test
34
+ runs-on: ubuntu-latest
35
+ strategy:
36
+ matrix:
37
+ python-version: ["3.11", "3.12", "3.13"]
38
+ services:
39
+ postgres:
40
+ image: postgres:17
41
+ env:
42
+ POSTGRES_PASSWORD: postgres
43
+ options: >-
44
+ --health-cmd pg_isready
45
+ --health-interval 10s
46
+ --health-timeout 5s
47
+ --health-retries 5
48
+ ports:
49
+ - 5432:5432
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - name: Wait for Postgres
54
+ run: |
55
+ for i in {1..30}; do
56
+ pg_isready -h localhost -p 5432 -U postgres && exit 0
57
+ sleep 1
58
+ done
59
+ exit 1
60
+
61
+ - name: Initialize GiST extension
62
+ env:
63
+ PGPASSWORD: postgres
64
+ run: |
65
+ psql -h localhost -p 5432 -U postgres -d postgres \
66
+ -c "CREATE EXTENSION IF NOT EXISTS btree_gist;"
67
+
68
+ - name: Cache chainfiles for liftover
69
+ uses: actions/cache@v4
70
+ with:
71
+ path: ~/.local/share/wags_tails
72
+ key: ${{ runner.os }}-test-${{ hashFiles('pyproject.toml') }}
73
+
74
+ - name: Setup Python
75
+ uses: actions/setup-python@v5
76
+ with:
77
+ python-version: ${{ matrix.python-version }}
78
+
79
+ - name: Install uv
80
+ uses: astral-sh/setup-uv@v6
81
+ with:
82
+ enable-cache: true
83
+
84
+ - name: Install dependencies
85
+ run: uv sync --extra test --extra queueing
86
+
87
+ - name: Run tests
88
+ run: uv run pytest -vv -m "ci_ok"
89
+ env:
90
+ ANYVAR_TEST_STORAGE_URI: postgresql://postgres:postgres@localhost:5432/postgres
91
+
92
+ precommit_hooks:
93
+ runs-on: ubuntu-latest
94
+ strategy:
95
+ matrix:
96
+ cmd:
97
+ - "end-of-file-fixer"
98
+ - "trailing-whitespace"
99
+ - "mixed-line-ending"
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+
103
+ - name: Set up Python 3.12
104
+ uses: actions/setup-python@v5
105
+ with:
106
+ python-version: 3.12
107
+
108
+ - uses: pre-commit/action@v3.0.1
109
+ with:
110
+ extra_args: ${{ matrix.cmd }} --all-files
111
+ docs:
112
+ runs-on: ubuntu-latest
113
+ env:
114
+ SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115
+ steps:
116
+ - uses: actions/checkout@v4
117
+
118
+ - name: Set up Python
119
+ uses: actions/setup-python@v5
120
+ with:
121
+ python-version: 3.11
122
+
123
+ - name: Install uv
124
+ uses: astral-sh/setup-uv@v6
125
+ with:
126
+ enable-cache: true
127
+
128
+ - name: Install dependencies
129
+ run: uv sync --extra docs
130
+
131
+ - name: Attempt docs build
132
+ working-directory: ./docs
133
+ run: source ../.venv/bin/activate && make html
@@ -0,0 +1,102 @@
1
+ # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2
+ name: Publish Python distribution to PyPI
3
+
4
+ on:
5
+ release:
6
+ types: [created]
7
+
8
+ jobs:
9
+ build:
10
+ name: Build distribution
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.x"
21
+ - name: Install pypa/build
22
+ run: >-
23
+ python3 -m
24
+ pip install
25
+ build
26
+ --user
27
+ - name: Build a binary wheel and a source tarball
28
+ run: python3 -m build
29
+ - name: Store the distribution packages
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+ publish-to-pypi:
35
+ name: >-
36
+ Publish Python distribution to PyPI
37
+ needs:
38
+ - build
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/anyvar
43
+ permissions:
44
+ id-token: write # IMPORTANT: mandatory for trusted publishing
45
+ steps:
46
+ - name: Download all the dists
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+ - name: Publish distribution to PyPI
52
+ uses: pypa/gh-action-pypi-publish@release/v1
53
+
54
+ build-and-push-image:
55
+ # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action
56
+ runs-on: ubuntu-latest
57
+
58
+ permissions:
59
+ contents: read
60
+ packages: write
61
+ attestations: write
62
+ id-token: write
63
+
64
+ env:
65
+ REGISTRY: ghcr.io
66
+ IMAGE_NAME: ${{ github.repository }}
67
+
68
+ steps:
69
+ - name: Checkout repository
70
+ uses: actions/checkout@v6
71
+
72
+ - name: Log in to GHCR
73
+ uses: docker/login-action@v3
74
+ with:
75
+ registry: ${{ env.REGISTRY }}
76
+ username: ${{ github.actor }}
77
+ password: ${{ secrets.GITHUB_TOKEN }}
78
+
79
+ - name: Extract metadata (tags, labels) for Docker
80
+ id: meta
81
+ uses: docker/metadata-action@v5
82
+ with:
83
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
84
+ tags: |
85
+ type=raw,value=latest,enable=${{ !github.event.release.prerelease }}
86
+ type=semver,pattern={{version}}
87
+
88
+ - name: Build and push Docker image
89
+ id: push
90
+ uses: docker/build-push-action@v6
91
+ with:
92
+ context: .
93
+ push: true
94
+ tags: ${{ steps.meta.outputs.tags }}
95
+ labels: ${{ steps.meta.outputs.labels }}
96
+
97
+ - name: Generate artifact attestation
98
+ uses: actions/attest-build-provenance@v3
99
+ with:
100
+ subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
101
+ subject-digest: ${{ steps.push.outputs.digest }}
102
+ push-to-registry: true
@@ -0,0 +1,11 @@
1
+ # https://github.com/actions/stale
2
+
3
+ name: 'Close stale issues and PRs'
4
+ on:
5
+ workflow_dispatch:
6
+ schedule:
7
+ - cron: '1 1 * * *'
8
+
9
+ jobs:
10
+ stale:
11
+ uses: biocommons/.github/.github/workflows/stale.yml@main
@@ -0,0 +1,126 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # IDEs and editors
7
+ .vscode/
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ *.DS_Store
19
+ eggs/
20
+ .eggs/
21
+ .idea/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Testing stuff and coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ anyvar-test.duckdb
55
+ tests/tmp_async_work_dir
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # pyenv
83
+ .python-version
84
+
85
+ # celery beat schedule file
86
+ celerybeat-schedule
87
+
88
+ # SageMath parsed files
89
+ *.sage.py
90
+
91
+ # Environments
92
+ .env
93
+ .venv
94
+ env/
95
+ venv/
96
+ ENV/
97
+ env.bak/
98
+ venv.bak/
99
+
100
+ # Lockfiles
101
+ Pipfile.lock
102
+ uv.lock
103
+
104
+ # Spyder project settings
105
+ .spyderproject
106
+ .spyproject
107
+
108
+ # Rope project settings
109
+ .ropeproject
110
+
111
+ # mkdocs documentation
112
+ /site
113
+
114
+ # mypy
115
+ .mypy_cache/
116
+ *~
117
+ *.orig
118
+ archive
119
+
120
+ # local dev tooling
121
+ .justfile
122
+
123
+ docker/data*
124
+
125
+ # logging configs
126
+ logging.yaml
@@ -0,0 +1,21 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0 # pre-commit-hooks version
4
+ hooks:
5
+ - id: check-added-large-files
6
+ - id: detect-private-key
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ exclude: "^docs/source/_templates/.*\\.rst"
10
+ - id: check-merge-conflict
11
+ - id: detect-aws-credentials
12
+ args: [ --allow-missing-credentials ]
13
+ - id: mixed-line-ending
14
+ args: [ --fix=lf ]
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.12.8 # ruff version
17
+ hooks:
18
+ - id: ruff-format
19
+ - id: ruff
20
+ args: [ --fix, --exit-non-zero-on-fix ]
21
+ minimum_pre_commit_version: 4.2.0
@@ -0,0 +1,16 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: "ubuntu-20.04"
5
+ tools:
6
+ python: "3.11"
7
+
8
+ python:
9
+ install:
10
+ - method: pip
11
+ path: .
12
+ extra_requirements:
13
+ - docs
14
+
15
+ sphinx:
16
+ configuration: docs/source/conf.py