Skip to content

Commit

Permalink
setup.py: added scm for version control
Browse files Browse the repository at this point in the history
  • Loading branch information
yonidavidson committed May 15, 2023
1 parent cc6f99f commit d56dfbb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Pipfile
Expand Up @@ -6,6 +6,8 @@ name = "pypi"
[packages]
django = "==4.2"
graphqlclient = "==0.2.4"
install = "*"
setuptools-scm = "*"

[dev-packages]
build = "*"
Expand Down
58 changes: 53 additions & 5 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions djangoviz/management/commands/djangoviz.py
Expand Up @@ -8,11 +8,17 @@
from django.core.management.base import BaseCommand
from django.db.migrations.loader import MigrationLoader
from graphqlclient import GraphQLClient
from pkg_resources import get_distribution, DistributionNotFound

HOST = "https://gh.atlasgo.cloud"
API_ENDPOINT = f"{HOST}/api/query"
UI_ENDPOINT = f"{HOST}/explore"
VERSION = "0.0.1"
try:
# Change 'Your-Package-Name' to the name of your package
dist_name = "djangoviz"
__version__ = get_distribution(dist_name).version
except DistributionNotFound:
__version__ = "unknown"


def _get_ordered_app_configs():
Expand Down Expand Up @@ -151,7 +157,7 @@ def handle(self, *args, **options):
self.stdout.write(self.style.ERROR("no migrations found"))
return
client = GraphQLClient(endpoint=API_ENDPOINT)
client.inject_token("user-agent", f"djangoviz/{VERSION}")
client.inject_token("user-agent", f"djangoviz/{__version__}")
try:
atlas_schema = _get_atlas_schema(client, migrations, db_driver)
if atlas_schema is None:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -13,7 +13,8 @@

setup(
name="djangoviz",
version="0.0.1",
use_scm_version={"version_scheme": "release-branch-semver", "local_scheme": "no-local-version"},
setup_requires=["setuptools_scm"],
description="A visualization tool.",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit d56dfbb

Please sign in to comment.