-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
610accf
commit 5c38a19
Showing
22 changed files
with
212 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Author: Darren | ||
# | ||
# Utility script to build dazbo-aoc-commons and upload it to PyPI. | ||
# Then, install the module: | ||
# py -m pip install dazbo-aoc-commons | ||
|
||
Set-Location C:\Users\djl\localdev\Python\Advent-of-Code\scripts | ||
Set-Location ..\src\aoc_common\ | ||
"`nDeleting dist folder..." | ||
if (Test-Path "dist") { | ||
Remove-Item -LiteralPath "dist" -Recurse -Force | ||
} | ||
|
||
"`nRunning package build..." | ||
py -m setup sdist | ||
|
||
"`nUploading to PyPi..." | ||
py ..\..\scripts\upload_to_pypi.py | ||
|
||
"`nResetting folder." | ||
Set-Location ..\.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" Python to upload the dist folder to PyPi """ | ||
import os | ||
import subprocess | ||
from dotenv import load_dotenv | ||
|
||
def upload_to_pypi(): | ||
""" | ||
So that we can skip having to run this command (and pass in username and pwd) separately: | ||
twine upload dist/* | ||
""" | ||
load_dotenv() | ||
|
||
# expect vars to be stored in .env or environment vars | ||
username = os.getenv('PYPI_USERNAME') | ||
api_key = os.getenv('PYPI_API_KEY') | ||
|
||
if username is None or api_key is None: | ||
raise ValueError("PYPI_USERNAME and/or PYPI_PASSWORD are not set in the .env file") | ||
|
||
try: | ||
subprocess.run(['twine', 'upload', 'dist/*', '-u', username, '-p', api_key], check=True) | ||
except subprocess.CalledProcessError as e: | ||
print(f"An error occurred during the upload: {e}") | ||
|
||
upload_to_pypi() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ pip install dazbo-aoc-commons | |
|
||
## Use | ||
|
||
import aoc_common.aoc_commons as td | ||
import aoc_commons as ac |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Used to setup the aoc_commons package. | ||
Make sure you have installed twine first. | ||
py -m pip install twine | ||
1. Delete any existing dist folder from aoc_commons_package. | ||
2. Before updating, be sure to increment the version number. | ||
3. Create the package. From the aoc_commons_package folder, run: | ||
py -m setup sdist | ||
4. Upload to PyPi: | ||
twine upload dist/* | ||
5. Install the package from your venv at the project folder level: | ||
py -m pip install dazbo-aoc-commons | ||
""" | ||
from setuptools import setup | ||
|
||
setup( | ||
name='dazbo-aoc-commons', | ||
version='0.1.10', | ||
url='https://github.com/derailed-dash/Advent-of-Code', | ||
author='derailed-dash', | ||
description='A set up of helper functions and classes to assist with Advent of Code problems', | ||
long_description=open('README.md').read(), | ||
long_description_content_type="text/markdown", | ||
py_modules=["aoc_commons"], | ||
package_dir={'': '.'}, # Current directory | ||
install_requires=[], | ||
) |
Binary file not shown.
Oops, something went wrong.