Skip to content

Commit

Permalink
‣ Move 'conf' directory under 'readmeai' to fix PyPI installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
eli64s committed Aug 29, 2023
1 parent 3cd9a99 commit 60dc0f5
Show file tree
Hide file tree
Showing 17 changed files with 283 additions and 268 deletions.
32 changes: 18 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Exclude markdown files
*.md

# Exclude lock and toml files
poetry.lock
pyproject.toml
# Git and GitHub metadata
.git/
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Makefile
CHANGELOG.md

# Exclude all .pyc files
**/__pycache__

# Exclude all test-related files
# Build artifacts
dist/
*.tar.gz
*.whl

# Test and setup scripts
tests/
setup/
scripts/

# Exclude unnecessary directories and files
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
# Jupyter notebooks
notebooks/

# Example files
examples/
setup/environment.yaml
3 changes: 1 addition & 2 deletions .github/workflows/build_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
- name: Build package
run: python -m build
- name: Publish package
run: |
python -m twine upload --skip-existing dist/*
run: python -m twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,5 @@ notebooks/
.benchmarks/

# Work In Progress
conf/templates
src/redis_cache.py
conf/prompts.toml
readmeai/app.py
readmeai/conf/templates
readmeai/conf/prompts.toml
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,13 @@ All notable changes to this project will be documented in this file.
- *File Permissions Management:* Explicitly manage file permissions to prevent potential security risks when the image operates in varied contexts.

---

## [v0.0.6] - *2023-08-29*

### 🛠️ Fixed

- Corrected PyPI issue where the *readmeai* package was not being installed correctly.
- The [conf](./readmeai/conf/) directory was not being included in the PyPI distribution as it was located in the project's root directory.
- The tool now uses the [pkg_resources](https://setuptools.pypa.io/en/latest/pkg_resources.html#) module to access the *conf* directory from the *readmeai* package.

---
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Before you begin, ensure that you have the following prerequisites installed:

#### 📂 Repository

Most user's will run *README-AI* using the command-line, specifying their repository on run-time. However, if you would like to use the default configuration, you will need to update the [configuration file](./conf/conf.toml) with your repository's remote URL or a local path to your codebase.
Most user's will run *README-AI* using the command-line, specifying their repository on run-time. However, if you would like to use the default configuration, you will need to update the [configuration file](./readmeai/conf/conf.toml) with your repository's remote URL or a local path to your codebase.

```toml
[git]
Expand Down Expand Up @@ -312,7 +312,7 @@ poetry install

### 🎮 Using *README-AI*

Use the command-line to provide the OpenAI API key (if not already set) and specify an output path for your README file, along with the path to your local repository or remote code repository. You can also provide the output path in the [configuration file](./conf/conf.toml)
Use the command-line to provide the OpenAI API key (if not already set) and specify an output path for your README file, along with the path to your local repository or remote code repository. You can also provide the output path in the [configuration file](./readmeai/conf/conf.toml)

Command-Line Arguments:

Expand Down
427 changes: 211 additions & 216 deletions poetry.lock

Large diffs are not rendered by default.

40 changes: 18 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "readmeai"
version = "0.1.6"
version = "0.2.3"
description = "🚀 Generate awesome README.md files from the terminal, powered by OpenAI's GPT language model APIs 💫"
authors = ["Eli <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/eli64s/readme-ai"
documentation = "https://github.com/eli64s/readme-ai/blob/main/README.md"
keywords = [
"markdown",
"readme",
"python-cli",
"readme-template",
"shieldsio",
"readme-md",
"awesome-readme",
"readme-generator",
Expand All @@ -24,23 +25,18 @@ keywords = [
"auto-readme",
"gpt-4",
"llms",
"awesome-chatgpt",
"openai-python",
"chatgpt-python",
"openai-chatbot",
"gpt-35-turbo",
"gpt-4-api",
"openai-cli",
"llm-prompting",
"llm-agent",
"llm-agent"
]
include = ["readmeai", "readmeai.*"]

[tool.poetry.dev-dependencies]
black = "*"
flake8 = "*"
isort = "*"
pytest = "*"
pytest-cov = "*"
pre-commit = "*"
ruff = "*"
[tool.poetry.scripts]
readmeai = "readmeai.main:cli"

[tool.poetry.dependencies]
python = "^3.8.1"
Expand All @@ -59,8 +55,14 @@ toml = "^0.10.2"
pydantic = "^1.10.9"
click = "^8.1.6"

[tool.poetry.scripts]
readmeai = "readmeai.main:cli"
[tool.poetry.dev-dependencies]
black = "*"
flake8 = "*"
isort = "*"
pytest = "*"
pytest-cov = "*"
pre-commit = "*"
ruff = "*"

[tool.ruff]
line-length = 88
Expand All @@ -75,6 +77,7 @@ extend-select = [
"PTH", # flake8-use-pathlib
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports

]

[tool.ruff.isort]
Expand All @@ -84,13 +87,6 @@ split-on-trailing-comma = false
[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"

[tool.isort]
profile = "black"
line_length = 88
multi_line_output = 3
include_trailing_comma = true
virtual_env = ["venv", ".venv", "env", ".env", ".tox", ".nox"]

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"
Expand Down
5 changes: 3 additions & 2 deletions readmeai/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pathlib import Path
from typing import List, Tuple

from pkg_resources import resource_filename

from . import conf, factory, logger, utils

LOGGER = logger.Logger(__name__)
Expand Down Expand Up @@ -34,8 +36,7 @@ def create_markdown_sections(
name = config.git.name
repository = config.git.repository
user_repo = utils.get_user_repository_name(repository)
cwd_path = Path.cwd()
badges_path = cwd_path / config.paths.badges
badges_path = resource_filename("readmeai", f"{config.paths.badges}")
badges_dict = factory.FileHandler().read(badges_path)

markdown_badges = config.md.badges.format(
Expand Down
5 changes: 3 additions & 2 deletions readmeai/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from urllib.parse import urlparse, urlsplit

import openai
from pkg_resources import resource_filename
from pydantic import BaseModel, Field, SecretStr, validator

from . import factory, logger
Expand Down Expand Up @@ -199,7 +200,7 @@ def __post_init__(self):
]

for path in conf_path_list:
path = Path("conf/").joinpath(path).resolve()
path = Path(resource_filename("readmeai", f"conf/{path}")).resolve()
conf_dict = handler.read(path)

if "dependency_files" in conf_dict:
Expand All @@ -214,7 +215,7 @@ def __post_init__(self):

def _get_config_dict(handler: factory.FileHandler, filename: str) -> dict:
"""Get configuration dictionary from TOML file."""
path = Path("conf/") / filename
path = resource_filename("readmeai", f"conf/{filename}")
return handler.read(path)


Expand Down
2 changes: 1 addition & 1 deletion conf/conf.toml → readmeai/conf/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ slogan = "Conceptualize a catchy and memorable slogan for the GitHub project: {}
[md]
default = "`ℹ️ INSERT-DESCRIPTION`"
dropdown = """<details closed><summary>{}</summary>\n\n{}\n\n</details>\n"""
header = """\n<div align="center">
header = """<div align="center">
<h1 align="center">
<img src="https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/ec559a9f6bfd399b82bb44393651661b08aaf7ba/icons/folder-markdown-open.svg" width="100" />
<br>{}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion conf/ignore_files.toml → readmeai/conf/ignore_files.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ files = [
".gitignore",
".whitesource",
".prettierrc",
]
]
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion conf/svg/badges.json → readmeai/conf/svg/badges.json
Original file line number Diff line number Diff line change
Expand Up @@ -16927,4 +16927,4 @@
"svg": "M14.135 6.818v1.715h-1.217V9.92h1.217v2.601c0 1.624.943 2.487 2.355 2.487.236 0 .562-.025.785-.076v-1.348c-.146.039-.312.05-.47.05-.708 0-1.205-.328-1.205-1.138V9.92h1.675V8.533h-1.671V6.818ZM20.873 8.4c-1.846 0-3.299 1.441-3.299 3.3 0 1.909 1.454 3.36 3.324 3.36 1.572 0 2.788-.89 3.024-2.238h-1.467c-.132.553-.746.918-1.531.918-1.034 0-1.688-.589-1.871-1.531h4.908c.026-.12.039-.445.039-.617 0-1.87-1.399-3.192-3.127-3.192ZM0 8.533v1.399h3.928L0 13.532v1.4h5.719v-1.4h-3.94l3.94-3.6V8.533Zm6.037 0 2.54 6.059-1.151 2.59h1.57l3.611-8.649h-1.57l-1.715 4.358-1.717-4.358Zm14.758 1.19c.875 0 1.49.511 1.623 1.244h-3.324c.21-.786.838-1.244 1.7-1.244z"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9655,4 +9655,4 @@
"https://img.shields.io/badge/Zyte-B02CCE.svg?style&logo=Zyte&logoColor=white",
"B02CCE"
]
}
}
11 changes: 11 additions & 0 deletions scripts/build_pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

bash scripts/clean.sh

python -m build

twine upload --verbose --repository-url https://upload.pypi.org/legacy/ -u __token__ -p $PYPI_API_KEY dist/*

echo "Successfully pushed new readmeai package to PyPI!"

0 comments on commit 60dc0f5

Please sign in to comment.