pylembic 0.2.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.
- pylembic-0.2.0/.coveragerc +15 -0
- pylembic-0.2.0/.github/CODE_OF_CONDUCT.md +132 -0
- pylembic-0.2.0/.github/workflows/release.yml +91 -0
- pylembic-0.2.0/.github/workflows/testing.yml +25 -0
- pylembic-0.2.0/.gitignore +159 -0
- pylembic-0.2.0/.python-version +1 -0
- pylembic-0.2.0/.vscode/settings.json +13 -0
- pylembic-0.2.0/LICENSE +21 -0
- pylembic-0.2.0/PKG-INFO +137 -0
- pylembic-0.2.0/README.md +103 -0
- pylembic-0.2.0/pyproject.toml +36 -0
- pylembic-0.2.0/src/pylembic/__init__.py +4 -0
- pylembic-0.2.0/src/pylembic/cli.py +46 -0
- pylembic-0.2.0/src/pylembic/exceptions.py +8 -0
- pylembic-0.2.0/src/pylembic/formatter.py +15 -0
- pylembic-0.2.0/src/pylembic/logger.py +30 -0
- pylembic-0.2.0/src/pylembic/migrations.py +152 -0
- pylembic-0.2.0/tests/cli_test.py +82 -0
- pylembic-0.2.0/tests/conftest.py +66 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/README +1 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/alembic.ini +117 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/env.py +32 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/script.py.mako +26 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/versions/001_initial.py +6 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/versions/002_add_table.py +6 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/versions/003_update_table.py +6 -0
- pylembic-0.2.0/tests/fixtures/circular_migrations/versions/004_branch.py +6 -0
- pylembic-0.2.0/tests/fixtures/migrations/README +1 -0
- pylembic-0.2.0/tests/fixtures/migrations/alembic.ini +117 -0
- pylembic-0.2.0/tests/fixtures/migrations/env.py +32 -0
- pylembic-0.2.0/tests/fixtures/migrations/script.py.mako +26 -0
- pylembic-0.2.0/tests/fixtures/migrations/versions/001_initial.py +6 -0
- pylembic-0.2.0/tests/fixtures/migrations/versions/002_add_table.py +6 -0
- pylembic-0.2.0/tests/fixtures/migrations/versions/003_update_table.py +6 -0
- pylembic-0.2.0/tests/fixtures/migrations/versions/004_branch.py +6 -0
- pylembic-0.2.0/tests/fixtures/migrations/versions/005_merge.py +6 -0
- pylembic-0.2.0/tests/fixtures/migrations/versions/006_head.py +6 -0
- pylembic-0.2.0/tests/migrations_test.py +63 -0
- pylembic-0.2.0/uv.lock +823 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
<marco@marcoespinosa.com>.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
+
ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
name: Create Release ✨ and Publish Python 🐍 distribution 📦 to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- '**/README.md'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
bump-version:
|
|
12
|
+
name: Bump Version
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
outputs:
|
|
15
|
+
new_version: ${{ steps.bump-version-step.outputs.new_version }}
|
|
16
|
+
# Ignore version bump commits to avoid a loop
|
|
17
|
+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
|
18
|
+
permissions:
|
|
19
|
+
contents: write # Required to modify the input file
|
|
20
|
+
steps:
|
|
21
|
+
- name: Bump version in pyproject.toml
|
|
22
|
+
id: bump-version-step
|
|
23
|
+
uses: maekind/github-actions/.github/actions/bump-version@main
|
|
24
|
+
with:
|
|
25
|
+
file: pyproject.toml
|
|
26
|
+
gh_token: ${{ secrets.GH_TOKEN }}
|
|
27
|
+
|
|
28
|
+
create-tag:
|
|
29
|
+
name: Create Tag
|
|
30
|
+
needs: bump-version
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
# Skip if the version was not bumped yet
|
|
33
|
+
if: ${{ always() && needs.bump-version.result == 'success' && github.ref_name == 'main' }}
|
|
34
|
+
permissions:
|
|
35
|
+
contents: write
|
|
36
|
+
steps:
|
|
37
|
+
- name: Create Git Tag
|
|
38
|
+
uses: maekind/github-actions/.github/actions/create-tag@main
|
|
39
|
+
with:
|
|
40
|
+
tag_name: v${{ needs.bump-version.outputs.new_version }}
|
|
41
|
+
title: ${{ github.event.head_commit.message }}
|
|
42
|
+
emoji: "🚀✨"
|
|
43
|
+
|
|
44
|
+
create-release:
|
|
45
|
+
name: Create Release
|
|
46
|
+
needs: [bump-version, create-tag]
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
# Skip if the version was not bumped yet
|
|
49
|
+
if: ${{ always() && needs.bump-version.result == 'success' && github.ref_name == 'main' }}
|
|
50
|
+
permissions:
|
|
51
|
+
contents: write # Required for creating a release
|
|
52
|
+
steps:
|
|
53
|
+
- name: Create GitHub Release
|
|
54
|
+
uses: maekind/github-actions/.github/actions/create-release@main
|
|
55
|
+
with:
|
|
56
|
+
tag_name: v${{ needs.bump-version.outputs.new_version }}
|
|
57
|
+
|
|
58
|
+
build-and-publish:
|
|
59
|
+
name: Build and Publish to PyPI
|
|
60
|
+
needs: create-release
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
# Skip if the release was not created yet
|
|
63
|
+
if: ${{ always() && needs.create-release.result == 'success' && github.ref_name == 'main' }}
|
|
64
|
+
permissions:
|
|
65
|
+
contents: read # Required to read the code for building the distribution
|
|
66
|
+
id-token: write # Required for publishing to PyPI
|
|
67
|
+
steps:
|
|
68
|
+
- name: Build Python 🐍 Distributions 📦
|
|
69
|
+
uses: maekind/github-actions/.github/actions/build-python-distribution@main
|
|
70
|
+
with:
|
|
71
|
+
python_version: "3.11"
|
|
72
|
+
|
|
73
|
+
- name: Publish distribution 📦 to PyPI
|
|
74
|
+
uses: maekind/github-actions/.github/actions/publish-to-pypi@main
|
|
75
|
+
|
|
76
|
+
github-release:
|
|
77
|
+
name: Sign and Upload to GitHub Release
|
|
78
|
+
needs: [bump-version, build-and-publish]
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
# Skip if the build and publish job failed
|
|
81
|
+
if: ${{ always() && needs.build-and-publish.result == 'success' && github.ref_name == 'main' }}
|
|
82
|
+
permissions:
|
|
83
|
+
contents: write # Required to upload artifacts to the release
|
|
84
|
+
id-token: write # Required for signing with Sigstore
|
|
85
|
+
steps:
|
|
86
|
+
- name: >-
|
|
87
|
+
Sign the Python 🐍 distribution 📦 with Sigstore
|
|
88
|
+
and upload them to GitHub Release
|
|
89
|
+
uses: maekind/github-actions/.github/actions/github-release@main
|
|
90
|
+
with:
|
|
91
|
+
tag_name: v${{ needs.bump-version.outputs.new_version }}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Pylembic testing 🧪 and coverage report generation 📝
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
- push
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
testing:
|
|
8
|
+
name: Python Testing and Coverage
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Run Python Tests
|
|
12
|
+
uses: maekind/github-actions/.github/actions/python-testing-and-coverage@main
|
|
13
|
+
with:
|
|
14
|
+
python_version: "3.11"
|
|
15
|
+
coverage_path: "./src"
|
|
16
|
+
|
|
17
|
+
upload-coverage:
|
|
18
|
+
name: Upload Coverage to Codecov
|
|
19
|
+
needs: testing
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- name: Upload Code Coverage
|
|
23
|
+
uses: maekind/github-actions/.github/actions/upload-codecov-coverage@main
|
|
24
|
+
with:
|
|
25
|
+
codecov_token: ${{ secrets.CODECOV_GH_PYLEMBIC }}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Coverage
|
|
2
|
+
.coverage
|
|
3
|
+
coverage.xml
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-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
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
114
|
+
.pdm.toml
|
|
115
|
+
.pdm-python
|
|
116
|
+
.pdm-build/
|
|
117
|
+
|
|
118
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
119
|
+
__pypackages__/
|
|
120
|
+
|
|
121
|
+
# Celery stuff
|
|
122
|
+
celerybeat-schedule
|
|
123
|
+
celerybeat.pid
|
|
124
|
+
|
|
125
|
+
# SageMath parsed files
|
|
126
|
+
*.sage.py
|
|
127
|
+
|
|
128
|
+
# Environments
|
|
129
|
+
.env
|
|
130
|
+
.venv
|
|
131
|
+
env/
|
|
132
|
+
venv/
|
|
133
|
+
ENV/
|
|
134
|
+
env.bak/
|
|
135
|
+
venv.bak/
|
|
136
|
+
|
|
137
|
+
# Spyder project settings
|
|
138
|
+
.spyderproject
|
|
139
|
+
.spyproject
|
|
140
|
+
|
|
141
|
+
# Rope project settings
|
|
142
|
+
.ropeproject
|
|
143
|
+
|
|
144
|
+
# mkdocs documentation
|
|
145
|
+
/site
|
|
146
|
+
|
|
147
|
+
# mypy
|
|
148
|
+
.mypy_cache/
|
|
149
|
+
.dmypy.json
|
|
150
|
+
dmypy.json
|
|
151
|
+
|
|
152
|
+
# Pyre type checker
|
|
153
|
+
.pyre/
|
|
154
|
+
|
|
155
|
+
# pytype static type analyzer
|
|
156
|
+
.pytype/
|
|
157
|
+
|
|
158
|
+
# Cython debug symbols
|
|
159
|
+
cython_debug/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
pylembic-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Marco Espinosa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pylembic-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pylembic
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: This package provides validation for Alembic migrations.
|
|
5
|
+
Author-email: Marco Espinosa <marco@marcoespinosa.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Marco Espinosa
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Requires-Dist: alembic>=1.14.0
|
|
30
|
+
Requires-Dist: matplotlib>=3.10.0
|
|
31
|
+
Requires-Dist: networkx>=3.4.2
|
|
32
|
+
Requires-Dist: typer>=0.15.1
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<!-- Shields -->
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://github.com/maekind/pylembic"><img src="https://img.shields.io/github/actions/workflow/status/maekind/pylembic/.github%2Fworkflows%2Ftesting.yml?label=tests&color=green" hspace="5"></a>
|
|
38
|
+
<a href="https://codecov.io/gh/maekind/pylembic"><img src="https://codecov.io/gh/maekind/pylembic/graph/badge.svg?token=JcGna50uJL" hspace="5"/>
|
|
39
|
+
</a>
|
|
40
|
+
<a href="https://github.com/maekind/pylembic/releases"><img src="https://img.shields.io/github/actions/workflow/status/maekind/pylembic/.github%2Fworkflows%2Frelease.yml?label=package&color=green" hspace="5"></a>
|
|
41
|
+
<a href="https://pypi.org/project/pylembic"><img src="https://img.shields.io/github/v/release/maekind/pylembic?color=blue&label=pypi latest" hspace="5"></a>
|
|
42
|
+
<br>
|
|
43
|
+
<a href="https://github.com/maekind/kairo/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-orange.svg" hspace="5"></a>
|
|
44
|
+
<a href="https://github.com/maekind/kairo"><img src="https://img.shields.io/github/repo-size/maekind/pylembic?color=red" hspace="5"></a>
|
|
45
|
+
<a href="https://github.com/maekind/pylembic"><img src="https://img.shields.io/github/last-commit/maekind/pylembic?color=black" hspace="5"></a>
|
|
46
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/github/languages/top/maekind/pylembic?color=darkgreen" hspace="5"></a>
|
|
47
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python%20version-%3E3.11-lightblue" hspace="5"></a>
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
# pylembic
|
|
51
|
+
|
|
52
|
+
## Description
|
|
53
|
+
|
|
54
|
+
This package provides validation of Alembic migrations for Python projects.
|
|
55
|
+
|
|
56
|
+
It will check:
|
|
57
|
+
|
|
58
|
+
- Linearity: Ensures a clean and predictable migration chain.
|
|
59
|
+
- Circular dependencies: Prevents migration failures due to loops in the
|
|
60
|
+
dependency chain.
|
|
61
|
+
- Orphan migrations: Identifies migrations improperly created without linking
|
|
62
|
+
to any other migration.
|
|
63
|
+
- Multiple bases/heads: Identifies multiple bases or heads in the migration graph.
|
|
64
|
+
- Graph visualization: Provides a visual way to catch anomalies and understand the
|
|
65
|
+
migration flow.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
You can install this package using pip:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install pylembic
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Usage
|
|
76
|
+
|
|
77
|
+
### Testing
|
|
78
|
+
|
|
79
|
+
You can use this module with your preferred testing framework as follows:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from os import path
|
|
83
|
+
|
|
84
|
+
from pytest import fixture
|
|
85
|
+
|
|
86
|
+
from pylembic.migrations import Validator
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@fixture
|
|
90
|
+
def with_alembic_config_path():
|
|
91
|
+
# We assume the migrations folder is at the root of the project,
|
|
92
|
+
# and this test file is in the tests folder, also at the root of the project.
|
|
93
|
+
# TODO: Feel free to adjust the path to your project's migrations folder.
|
|
94
|
+
return path.abspath(
|
|
95
|
+
path.join(path.dirname(path.dirname(__file__)), "migrations")
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_migrations(with_alembic_config_path):
|
|
100
|
+
migration_validator = Validator(with_alembic_config_path)
|
|
101
|
+
assert migration_validator.validate()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Visualizing the migration graph
|
|
105
|
+
|
|
106
|
+
You can show the migrations graph by calling the method `show_graph`:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
|
|
110
|
+
from os import path
|
|
111
|
+
|
|
112
|
+
from pylembic.migrations import Validator
|
|
113
|
+
|
|
114
|
+
alembic_config_path = path.abspath(path.join("your path", "migrations"))
|
|
115
|
+
|
|
116
|
+
migration_validator = Validator(alembic_config_path)
|
|
117
|
+
|
|
118
|
+
migration_validator.show_graph()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Command line
|
|
122
|
+
|
|
123
|
+
You can also use the command line for:
|
|
124
|
+
|
|
125
|
+
- Validating migrations:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pylembic ./path/to/migrations --validate
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- Visualizing the migration graph:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pylembic ./path/to/migrations --show-graph
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
(c) 2024, <a href="mailto:marco@marcoespinosa.com">Marco Espinosa</a>
|